-
Notifications
You must be signed in to change notification settings - Fork 2k
Description
I'm submitting a...
- bug report
- feature request
Current Behavior
conda env update --prune does not remove packages no longer referenced in the environment.yml file.
Steps to Reproduce
Define an environment.yml file in a project directory as follows:
name: new-project-env
dependencies:
- python=3
- numpy
In the project directory run the following commands:
conda env create
conda activate new-project-env
python
import numpy
exit()
This succeeds as expected.
Update the environment.yml file as follows, removing numpy,
name: new-project-env
dependencies:
- python=3
Run the following commands in the project directory:
conda deactivate
conda env update --prune
conda activate new-project-env
python
import numpy
exit()
This numpy import succeeds and seems like a bug.
Expected Behavior
Per the docs (--prune means "remove installed packages not defined in environment.yml") I expect that after installing a package (numpy in the example above) and subsquently removing it from environment.yml the package should be removed from the relevant conda environment.
Current Workaround
I've found that we can use conda env create --force to overwrite the existing environment and thus ensure that the environment accurately reflects the environment.yml file. But this requires recreating the environment from scratch.
Environment Information
`conda info`
active environment : new-project-env
active env location : /home/mikhailgolubitsky/anaconda3/envs/new-project-env
shell level : 2
user config file : /home/mikhailgolubitsky/.condarc
populated config files : /home/mikhailgolubitsky/.condarc
conda version : 4.5.3
conda-build version : 3.0.27
python version : 3.6.3.final.0
base environment : /home/mikhailgolubitsky/anaconda3 (writable)
channel URLs : https://conda.anaconda.org/conda-forge/linux-64
https://conda.anaconda.org/conda-forge/noarch
https://repo.anaconda.com/pkgs/main/linux-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/free/linux-64
https://repo.anaconda.com/pkgs/free/noarch
https://repo.anaconda.com/pkgs/r/linux-64
https://repo.anaconda.com/pkgs/r/noarch
https://repo.anaconda.com/pkgs/pro/linux-64
https://repo.anaconda.com/pkgs/pro/noarch
package cache : /home/mikhailgolubitsky/anaconda3/pkgs
/home/mikhailgolubitsky/.conda/pkgs
envs directories : /home/mikhailgolubitsky/anaconda3/envs
/home/mikhailgolubitsky/.conda/envs
platform : linux-64
user-agent : conda/4.5.3 requests/2.18.4 CPython/3.6.3 Linux/4.13.0-39-generic ubuntu/17.10 glibc/2.26
UID:GID : 1000:1000
netrc file : None
offline mode : False
`conda config --show-sources`
==> /home/mikhailgolubitsky/.condarc <==
channels:
- conda-forge
- defaults
`conda list --show-channel-urls`
# packages in environment at /home/mikhailgolubitsky/anaconda3/envs/new-project-env:
#
# Name Version Build Channel
ca-certificates 2018.4.16 0 conda-forge
certifi 2018.4.16 py36_0 conda-forge
intel-openmp 2018.0.0 8 defaults
libgcc-ng 7.2.0 hdf63c60_3 defaults
libgfortran-ng 7.2.0 hdf63c60_3 defaults
mkl 2018.0.2 1 defaults
mkl_fft 1.0.2 py36_0 conda-forge
mkl_random 1.0.1 py36_0 conda-forge
ncurses 5.9 10 conda-forge
numpy 1.14.3 py36h14a74c5_0 defaults
numpy-base 1.14.3 py36hdbf6ddf_0 defaults
openssl 1.0.2o 0 conda-forge
pip 9.0.3 py36_0 conda-forge
python 3.6.5 1 conda-forge
readline 7.0 0 conda-forge
setuptools 39.1.0 py36_0 conda-forge
sqlite 3.20.1 2 conda-forge
tk 8.6.7 0 conda-forge
wheel 0.31.0 py36_0 conda-forge
xz 5.2.3 0 conda-forge
zlib 1.2.11 0 conda-forge