Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

conda env remove does not run unlink transactions (pre_unlink, remove_menus, etc) #11092

Closed
4 tasks done
Tracked by #11321
jaimergp opened this issue Dec 8, 2021 · 4 comments
Closed
4 tasks done
Tracked by #11321
Labels
backlog issue has been triaged but has not been earmarked for any upcoming release plugins::env pertains to conda-env source::partner created by or for an Anaconda, Inc. partner company stale::recovered [bot] recovered after being marked as stale type::documentation request for improved documentation type::tech-debt identifies or resolves some technical debt

Comments

@jaimergp
Copy link
Contributor

jaimergp commented Dec 8, 2021

Checklist

  • I added a descriptive title
  • I searched for other issues and couldn't find a solution or duplication
  • I already searched in Google and didn't find any good information or help
  • I looked at the docs and didn't see anything to help

What happened?

One way to delete environments is through conda env remove -n name.

My expectation is that this will uninstall all packages in the environment and then remove the directory.

However, it doesn't do so unless a list of packages is passed (?), possibly to optimize some IO; it goes straight to a rm -rf prefix call, bypassing ALL unlink actions. This is because package_names is (perhaps deliberately) left out of the args list in the call from conda env remove to conda remove.

The easy fix would be to add package_names=None to the passed args, but this might have been an intentional decision. I am not aware if this is documented, though.

This results in some artifacts left in the system, like the shortcuts created by menuinst, which should be removed by the RemoveMenuAction objects created during the unlink transaction.

Conda info

conda info
conda info

     active environment : None
       user config file : /Users/jrodriguez-guerra/.condarc
 populated config files : /Users/jrodriguez-guerra/.condarc
          conda version : 4.10.3.post86+5b847665f
    conda-build version : not installed
         python version : 3.9.7.final.0
       virtual packages : __osx=11.6.1=0
                          __unix=0=0
                          __archspec=1=x86_64
       base environment : /Users/jrodriguez-guerra/.local/conda/envs/pydantic  (writable)
      conda av data dir : /Users/jrodriguez-guerra/.local/conda/envs/pydantic/etc/conda
  conda av metadata url : None
           channel URLs : https://conda.anaconda.org/conda-forge/osx-64
                          https://conda.anaconda.org/conda-forge/noarch
          package cache : /Users/jrodriguez-guerra/.local/conda/envs/pydantic/pkgs
                          /Users/jrodriguez-guerra/.conda/pkgs
       envs directories : /Users/jrodriguez-guerra/.local/conda/envs/pydantic/envs
                          /Users/jrodriguez-guerra/.conda/envs
               platform : osx-64
             user-agent : conda/4.10.3.post86+5b847665f requests/2.26.0 CPython/3.9.7 Darwin/20.6.0 OSX/11.6.1
                UID:GID : 503:20
             netrc file : None
           offline mode : False

Conda config

==> /Users/jrodriguez-guerra/.condarc <==
channels:
  - conda-forge

Conda list

conda list
# packages in environment at /Users/jrodriguez-guerra/.local/conda/envs/pydantic:
#
# Name                    Version                   Build  Channel
anyio                     3.3.4            py39h6e9494a_0    conda-forge
appnope                   0.1.2            py39h6e9494a_2    conda-forge
argon2-cffi               21.1.0           py39h89e85a6_2    conda-forge
async_generator           1.10                       py_0    conda-forge
attrs                     21.2.0             pyhd8ed1ab_0    conda-forge
babel                     2.9.1              pyh44b312d_0    conda-forge
backcall                  0.2.0              pyh9f0ad1d_0    conda-forge
backports                 1.0                        py_2    conda-forge
backports.functools_lru_cache 1.6.4              pyhd8ed1ab_0    conda-forge
black                     21.10b0            pyhd8ed1ab_0    conda-forge
bleach                    4.1.0              pyhd8ed1ab_0    conda-forge
brotlipy                  0.7.0           py39h89e85a6_1003    conda-forge
ca-certificates           2021.10.8            h033912b_0    conda-forge
certifi                   2021.10.8        py39h6e9494a_1    conda-forge
cffi                      1.14.6           py39he338e87_2    conda-forge
chardet                   4.0.0            py39h6e9494a_2    conda-forge
charset-normalizer        2.0.0              pyhd8ed1ab_0    conda-forge
click                     8.0.3            py39h6e9494a_1    conda-forge
colorama                  0.4.4              pyh9f0ad1d_0    conda-forge
conda                     4.10.3.post86+5b847665f           dev_0    <develop>
conda-package-handling    1.7.3            py39h89e85a6_1    conda-forge
cryptography              35.0.0           py39h209aa08_2    conda-forge
dataclasses               0.8                pyhc8e2a94_3    conda-forge
debugpy                   1.5.1            py39h9fcab8e_0    conda-forge
decorator                 5.1.0              pyhd8ed1ab_0    conda-forge
defusedxml                0.7.1              pyhd8ed1ab_0    conda-forge
entrypoints               0.3             py39hde42818_1002    conda-forge
hypothesis                6.24.1             pyhd8ed1ab_0    conda-forge
hypothesis-jsonschema     0.21.0             pyhd8ed1ab_0    conda-forge
idna                      3.1                pyhd3deb0d_0    conda-forge
importlib-metadata        4.8.1            py39h6e9494a_1    conda-forge
iniconfig                 1.1.1              pyh9f0ad1d_0    conda-forge
ipykernel                 6.4.2            py39h71a6800_0    conda-forge
ipython                   7.29.0           py39h71a6800_1    conda-forge
ipython_genutils          0.2.0                      py_1    conda-forge
jedi                      0.18.0           py39h6e9494a_3    conda-forge
jinja2                    3.0.2              pyhd8ed1ab_0    conda-forge
json5                     0.9.5              pyh9f0ad1d_0    conda-forge
jsonschema                4.1.2              pyhd8ed1ab_0    conda-forge
jupyter_client            7.0.6              pyhd8ed1ab_0    conda-forge
jupyter_core              4.9.1            py39h6e9494a_0    conda-forge
jupyter_server            1.11.2             pyhd8ed1ab_0    conda-forge
jupyterlab                3.2.1              pyhd8ed1ab_0    conda-forge
jupyterlab_pygments       0.1.2              pyh9f0ad1d_0    conda-forge
jupyterlab_server         2.8.2              pyhd8ed1ab_0    conda-forge
libcxx                    12.0.1               habf9029_0    conda-forge
libffi                    3.4.2                he49afe7_4    conda-forge
libsodium                 1.0.18               hbcb3906_1    conda-forge
libzlib                   1.2.11            h9173be1_1013    conda-forge
markupsafe                2.0.1            py39h89e85a6_1    conda-forge
matplotlib-inline         0.1.3              pyhd8ed1ab_0    conda-forge
menuinst                  1.4.18+64.gf688ecf.dirty           dev_0    <develop>
mistune                   0.8.4           py39h89e85a6_1005    conda-forge
more-itertools            8.10.0             pyhd8ed1ab_0    conda-forge
mypy_extensions           0.4.3            py39h6e9494a_4    conda-forge
nbclassic                 0.3.4              pyhd8ed1ab_0    conda-forge
nbclient                  0.5.4              pyhd8ed1ab_0    conda-forge
nbconvert                 6.2.0            py39h6e9494a_0    conda-forge
nbformat                  5.1.3              pyhd8ed1ab_0    conda-forge
ncurses                   6.2                  h2e338ed_4    conda-forge
nest-asyncio              1.5.1              pyhd8ed1ab_0    conda-forge
notebook                  6.4.5              pyha770c72_0    conda-forge
openssl                   1.1.1l               h0d85af4_0    conda-forge
packaging                 21.2               pyhd8ed1ab_1    conda-forge
pandoc                    2.16.1               h0d85af4_0    conda-forge
pandocfilters             1.5.0              pyhd8ed1ab_0    conda-forge
parso                     0.8.2              pyhd8ed1ab_0    conda-forge
pathspec                  0.9.0              pyhd8ed1ab_0    conda-forge
pexpect                   4.8.0              pyh9f0ad1d_2    conda-forge
pickleshare               0.7.5           py39hde42818_1002    conda-forge
pip                       21.3.1             pyhd8ed1ab_0    conda-forge
platformdirs              2.3.0              pyhd8ed1ab_0    conda-forge
pluggy                    1.0.0            py39h6e9494a_2    conda-forge
prometheus_client         0.12.0             pyhd8ed1ab_0    conda-forge
prompt-toolkit            3.0.21             pyha770c72_0    conda-forge
ptyprocess                0.7.0              pyhd3deb0d_0    conda-forge
py                        1.10.0             pyhd3deb0d_0    conda-forge
pycosat                   0.6.3           py39h89e85a6_1009    conda-forge
pycparser                 2.20               pyh9f0ad1d_2    conda-forge
pydantic                  1.8.2            py39h89e85a6_0    conda-forge
pygments                  2.10.0             pyhd8ed1ab_0    conda-forge
pyopenssl                 21.0.0             pyhd8ed1ab_0    conda-forge
pyparsing                 2.4.7              pyhd8ed1ab_1    conda-forge
pyrsistent                0.17.3           py39h89e85a6_3    conda-forge
pysocks                   1.7.1            py39h6e9494a_4    conda-forge
pytest                    6.2.5            py39h6e9494a_1    conda-forge
python                    3.9.7           h1248fe1_3_cpython    conda-forge
python-dateutil           2.8.2              pyhd8ed1ab_0    conda-forge
python.app                1.3              py39h89e85a6_6    conda-forge
python_abi                3.9                      2_cp39    conda-forge
pytz                      2021.3             pyhd8ed1ab_0    conda-forge
pyzmq                     22.3.0           py39h7fec2f1_1    conda-forge
readline                  8.1                  h05e3726_0    conda-forge
regex                     2021.10.23       py39h89e85a6_1    conda-forge
requests                  2.26.0             pyhd8ed1ab_0    conda-forge
ruamel_yaml               0.15.80         py39h89e85a6_1006    conda-forge
send2trash                1.8.0              pyhd8ed1ab_0    conda-forge
setuptools                58.4.0           py39h6e9494a_1    conda-forge
six                       1.16.0             pyh6c4a22f_0    conda-forge
sniffio                   1.2.0            py39h6e9494a_2    conda-forge
sortedcontainers          2.4.0              pyhd8ed1ab_0    conda-forge
sqlite                    3.36.0               h23a322b_2    conda-forge
terminado                 0.12.1           py39h6e9494a_0    conda-forge
testpath                  0.5.0              pyhd8ed1ab_0    conda-forge
tk                        8.6.11               h5dbffcc_1    conda-forge
toml                      0.10.2             pyhd8ed1ab_0    conda-forge
tomli                     1.2.2              pyhd8ed1ab_0    conda-forge
tornado                   6.1              py39h89e85a6_2    conda-forge
tqdm                      4.62.3             pyhd8ed1ab_0    conda-forge
traitlets                 5.1.1              pyhd8ed1ab_0    conda-forge
typed-ast                 1.4.3            py39h89e85a6_1    conda-forge
typing-extensions         3.10.0.2             hd8ed1ab_0    conda-forge
typing_extensions         3.10.0.2           pyha770c72_0    conda-forge
tzdata                    2021e                he74cb21_0    conda-forge
urllib3                   1.26.7             pyhd8ed1ab_0    conda-forge
wcwidth                   0.2.5              pyh9f0ad1d_2    conda-forge
webencodings              0.5.1                      py_1    conda-forge
websocket-client          0.57.0           py39h6e9494a_6    conda-forge
wheel                     0.37.0             pyhd8ed1ab_1    conda-forge
xz                        5.2.5                haf1e3a3_1    conda-forge
yaml                      0.2.5                haf1e3a3_0    conda-forge
zeromq                    4.3.4                he49afe7_1    conda-forge
zipp                      3.6.0              pyhd8ed1ab_0    conda-forge
zlib                      1.2.11            h9173be1_1013    conda-forge

Additional Context

conda remove --all -n name does work as expected.

@jaimergp jaimergp added the type::bug describes erroneous operation, use severity::* to classify the type label Dec 8, 2021
@kenodegard kenodegard added plugins::env pertains to conda-env source::partner created by or for an Anaconda, Inc. partner company type::documentation request for improved documentation and removed type::bug describes erroneous operation, use severity::* to classify the type labels Jan 12, 2022
@kenodegard
Copy link
Contributor

@jaimergp @jezdez ok so as a minimum this needs to be documented but ultimately this is yet another indication that we need to consolidate and standardize conda create|remove and conda env create|remove

@kenodegard kenodegard added the backlog issue has been triaged but has not been earmarked for any upcoming release label Jan 20, 2022
@beeankha beeankha added the type::tech-debt identifies or resolves some technical debt label Feb 24, 2022
@github-actions
Copy link

Hi there, thank you for your contribution!

This issue has been automatically marked as stale because it has not had recent activity. It will be closed automatically if no further activity occurs.

If you would like this issue to remain open please:

  1. Verify that you can still reproduce the issue at hand
  2. Comment that the issue is still reproducible and include:
    - What OS and version you reproduced the issue on
    - What steps you followed to reproduce the issue

NOTE: If this issue was closed prematurely, please leave a comment.

Thanks!

@github-actions github-actions bot added the stale [bot] marked as stale due to inactivity label Jun 17, 2023
@jaimergp
Copy link
Contributor Author

Not stale. Still pending.

@beeankha
Copy link
Member

Closing since #13977 has been merged and addresses this issue.

@github-project-automation github-project-automation bot moved this to 🏁 Done in 🧭 Planning Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog issue has been triaged but has not been earmarked for any upcoming release plugins::env pertains to conda-env source::partner created by or for an Anaconda, Inc. partner company stale::recovered [bot] recovered after being marked as stale type::documentation request for improved documentation type::tech-debt identifies or resolves some technical debt
Projects
Archived in project
Development

No branches or pull requests

3 participants