58

I have Win 10

When running:

conda update conda

I encountered this error:

RemoveError: 'setuptools' is a dependency of conda and cannot be removed from
conda's operating environment.

Nothing seems to help

I tried to uninstall anaconda and got a successful message but it seems there are some traces of older version that still persist

How can I completely erase all traces of Anaconda installation?

2

9 Answers 9

101

While I still did not find how to cleanly uninstall anaconda, I was able to resolve the error by using the following:

conda update --force conda
conda update anaconda

and again

conda update conda

As a result, I got a stable environment with no dependency conflicts. Seems like something within latest conda is too restrictive and update must be forced.

7
  • I didn't need the --force. It worked by just doing conda update conda and then conda update anaconda. Upvote cause it helped me figure it out though.
    – Glrs
    Commented Feb 20, 2020 at 16:55
  • 8
    The Anaconda docs say updating the anaconda package is not advised, so try conda update -all instead.
    – s2t2
    Commented Jul 9, 2020 at 0:50
  • I am having a ERROR conda.core.link:_execute(700):
    – BND
    Commented Dec 5, 2020 at 8:48
  • 12
    Why does conda break every 2 months? Commented May 17, 2021 at 10:37
  • 3
    The modern way is to use --force-reinstall
    – Henk Poley
    Commented Aug 23, 2022 at 16:34
8

I am on a Mac rather than Windows but I was getting the same message. I was able to update by running conda update setuptools. It brought conda up-to-date in the process.

0
5

I'm on Linux Ubuntu 16.04, and it works for me by:

conda uninstall setuptools
# This is a must to make it work
conda install setuptools
conda update --force conda
4

I am not 100% sure this is the correct way but it seems I managed to solve it by doing:

conda update --force -n base -c defaults conda

then again the same command without --force:

conda update -n base -c defaults conda
1
  • It looks that the --force made it work
    – caot
    Commented May 3, 2023 at 18:56
2

I was having trouble installing scrapy with anaconda using ' conda install -c conda-forge scrapy'

I kept getting the

'Verifying transaction: failed' ' RemoveError: 'setuptools' is a dependency of conda and cannot be removed from conda's operating environment.'

error so I tried the mentioned above force install of setup "conda update --force conda" and once that was successful I was able to reapply the scrapy install successfully.

1

I ran into this issue in a Dockerfile using continuumio/miniconda3:latest in which I had the line:

RUN conda update -n base -c defaults conda

To fix it, I simply appended the setuptools requirement:

RUN conda update -n base -c defaults conda setuptools

There was no need for any other heroics.

3
  • I am dealing apparently with similar circumstances, you would add this line just before activate the env, right?
    – ReinholdN
    Commented May 13, 2020 at 19:41
  • '''FROM continuumio/miniconda:latest WORKDIR /home/reinhold/Documents/webapps/house_market_app/ihm_condaenv COPY environment.yml ./ COPY app.py ./ COPY boot.sh ./ RUN chmod +x boot.sh RUN conda update -n base -c defaults RUN conda env create -f environment.yml RUN echo "source activate ihm_condaenv" > ~/.bashrc ENV PATH /home/reinhold/anaconda3/envs/ihm_condaenv/bin:$PATH EXPOSE 8080 CMD ["./boot.sh"]'''
    – ReinholdN
    Commented May 13, 2020 at 19:50
  • @ReinholdN Yes. This is how I activate the environment prior to defining an ENTRYPOINT which runs python.
    – Asclepius
    Commented May 13, 2020 at 23:21
1

for macOS for me- I did

  1. conda update --force conda
  2. conda update anaconda-navigator
0

Solution

The following should, in most cases fix such problems.

conda update conda -n base
conda update --all

conda version: 4.13 (check with: conda --version)

Disclaimer: I maintain over 60 conda-forge packages. This snippet has mostly gotten me out of the error so far.

A recommended fail-safe

As a fail safe, please always prefer creating conda environments from environment-specification files: environment.yml.

# update a global environment from a file
conda env update -f ./environment.yml  --prune

If you don't already have an environment definition/scpecification file, you can create one as follows. (source)

## Export a platform independent copy of an environment
#  - This will only include packages you installed explicitly.
conda env export --from-history > path/to/environment.yml

Tips

The conda solver may be slow and you don't have to endure such pain of helplessly waiting when the environment solver finishes and installs the packages.

An easier alternative is to use mamba as a drop-in replacement of conda. Here's how:

conda install -n base mamba -c conda-forge
mamba install -n some_env -c some_channel package1 "package2>=2.1.0"

To update with mamba:

# Global env + Use file
mamba env update -f ./environment.yml  --prune
0

I fixed my problem after updating conda using conda update --force conda.

Solution to problem

I required to uninstall setuptools to install TA-Lib that had a dependency on setuptools which needed to be fixed.

enter image description here

After updating conda, you can safely remove setuptools or install the required library.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.