charlesdarwin
charlesdarwin

Reputation: 767

How can I remove my anaconda environment?

I am working in Mac OS X. I have created a conda environment called python2env. You can see it here:

conda info --envs
# conda environments:
#
python2env               /Users/user/anaconda/envs/python2env
..
root                  *  /Users/user/anaconda

I tried the following command to remove it:

conda env remove --name python2env

Remove all packages in environment /Users/user/anaconda/envs/python2env:

Proceed ([y]/n)? y

Then, I checked if it had been removed:

conda info --envs
# conda environments:
#
python2env               /Users/user/anaconda/envs/python2env
..
root                  *  /Users/user/anaconda

but it is still there!

I tried conda remove --name python2env --all but to no avail. The environment is still listed.

How can I remove my Anaconda environment?

Update, on jentjr's avdvice:

~ conda remove --name python2env --all --debug

DEBUG conda.gateways.disk.test:prefix_is_writable(65): testing write access for prefix '/Users/user/anaconda' using path '/Users/user/anaconda/conda-meta/history'
DEBUG conda.gateways.disk.test:prefix_is_writable(65): testing write access for prefix '/Users/user/anaconda' using path '/Users/user/anaconda/conda-meta/history'

Remove all packages in environment /Users/user/anaconda/envs/python2env:

Proceed ([y]/n)? y

DEBUG conda.gateways.disk.permissions:make_writable(36): tried make writable but failed: /Users/user/anaconda/envs/python2env/static/css/img/igv_logo_letters_paths.svg
PermissionError(1, 'Operation not permitted')

~ conda remove -p /Users/user/anaconda/envs/python2env --all --debug 
DEBUG conda.gateways.disk.test:prefix_is_writable(65): testing write access for prefix '/Users/user/anaconda' using path '/Users/user/anaconda/conda-meta/history'

Remove all packages in environment /Users/user/anaconda/envs/python2env:

Proceed ([y]/n)? y

DEBUG conda.gateways.disk.permissions:make_writable(36): tried make writable but failed: /Users/user/anaconda/envs/python2env/static/css/img/igv_logo_letters_paths.svg
PermissionError(1, 'Operation not permitted')
INFO conda.gateways.disk.delete:rm_rf(59): rm_rf failed for /Users/user/anaconda/envs/python2env

Neither using --debug nor specifying the full path to the environment were able to remove it. I will try to make the environment writable with chmod, try again and update my post.

Upvotes: 4

Views: 9314

Answers (2)

Trevor Moon
Trevor Moon

Reputation: 1

I typically use conda env remove -n [name] if I want to delete the entire environment.

Upvotes: 0

Justin Shenk
Justin Shenk

Reputation: 578

Had a similar issue with a conda-meta folder in the environment directory and solved it with rm -rf [full-path-to-conda-env].

Upvotes: 2

Related Questions