Skip to content

Use of --pre in requirements.txt breaks things in strange ways #242

@gforsyth

Description

@gforsyth

I was just trying to cut a new release of xonsh and ran into this -- took me a while to track it down.

Someone added a --pre specifier to our requirements.txt, which, on any rever activity that requires building a docker container fails now with

EnvironmentLocationNotFound: Not a conda environment: /root/black

The command '/bin/sh -c wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh &&     /bin/bash ~/miniconda.sh -b -p /opt/conda &&     rm ~/miniconda.sh &&     /opt/conda/bin/conda clean -tipsy &&     ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh &&     echo ". /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc &&     echo "conda activate base" >> ~/.bashrc &&     conda config --set always_yes yes &&     conda config --add channels conda-forge &&     conda update --all &&     conda install         --pre black cloud_sptheme codecov coverage doctr flake8         flake8-docstrings livereload matplotlib mypy numpy numpydoc         pip pre-commit prompt_toolkit psutil py pygments pytest         pytest-cov pytest-timeout pyzmq runthis-sphinxext sphinx         tornado &&     conda clean --all &&     conda info' returned a non-zero code: 1
activity-error:pytest:activity failed with execption:
Traceback (most recent call last):
  File "/opt/miniconda3/envs/rever/lib/python3.8/site-packages/rever/activity.xsh", line 83, in __call__
    self.func(*args, **kwargs)
  File "/opt/miniconda3/envs/rever/lib/python3.8/site-packages/rever/activities/pytest.xsh", line 27, in _func
    super()._func(code=command)
  File "/opt/miniconda3/envs/rever/lib/python3.8/site-packages/rever/activity.xsh", line 401, in _func
    docker.ensure_images(force_base=force_base, force_install=force_install)
  File "/opt/miniconda3/envs/rever/lib/python3.8/site-packages/rever/docker.xsh", line 284, in ensure_images
    build_image(base_file, base_image, make_base_dockerfile, **base_kwargs)
  File "/opt/miniconda3/envs/rever/lib/python3.8/site-packages/rever/docker.xsh", line 262, in build_image
    ![docker build -t @(image) -f @(dockerfile) --no-cache .]
  File "/opt/miniconda3/envs/rever/lib/python3.8/site-packages/xonsh/__amalgam__.py", line 20791, in subproc_captured_hiddenobject
    return xonsh.procs.specs.run_subproc(cmds, captured="hiddenobject", envs=envs)
  File "/opt/miniconda3/envs/rever/lib/python3.8/site-packages/xonsh/procs/__amalgam__.py", line 3494, in run_subproc
    command.end()
  File "/opt/miniconda3/envs/rever/lib/python3.8/site-packages/xonsh/procs/__amalgam__.py", line 907, in end
    self._end(tee_output=tee_output)
  File "/opt/miniconda3/envs/rever/lib/python3.8/site-packages/xonsh/procs/__amalgam__.py", line 926, in _end
    self._raise_subproc_error()
  File "/opt/miniconda3/envs/rever/lib/python3.8/site-packages/xonsh/procs/__amalgam__.py", line 1052, in _raise_subproc_error
    raise subprocess.CalledProcessError(rtn, spec.args, output=self.output)
subprocess.CalledProcessError: Command '['docker', 'build', '-t', 'xonsh/rever-base', '-f', 'rever/rever-base.dockerfile', '--no-cache', '.']' returned non-zero exit status 1.
rewinding to d3eda8e90bafe4edfc712c1038dec4b8267280e0

The --pre survives into the rever-base.dockerfile and ends up as

RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh && \
    /bin/bash ~/miniconda.sh -b -p /opt/conda && \
    rm ~/miniconda.sh && \
    /opt/conda/bin/conda clean -tipsy && \
    ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh && \
    echo ". /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc && \
    echo "conda activate base" >> ~/.bashrc && \
    conda config --set always_yes yes && \
    conda config --add channels conda-forge && \
    conda update --all && \
    conda install \
        --pre black cloud_sptheme codecov coverage doctr flake8 \
        flake8-docstrings livereload matplotlib mypy numpy numpydoc \
        pip pre-commit prompt_toolkit psutil py pygments pytest \
        pytest-cov pytest-timeout pyzmq runthis-sphinxext sphinx \
        tornado && \
    conda clean --all && \
    conda info

Note the --pre in the conda install line. Clearly this does something weird that then breaks the build.

Workaround is to remove --pre.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions