Error when updating conda packages: RemoveError: 'setuptools' is a dependency of conda
Solution 1
I think this issue in github may be related. This response mentions doing an update of conda using the force
flag, which seemed to also work for users who reported that a normal update without the flag didn't work:
conda update --force conda
Solution 2
I'm not sure why the above answer had negative rating.
I had conda running for some time ... tonight I updated, and then resulted in every conda action resulting in:
RemoveError: 'setuptools' is a dependency of conda and cannot be removed from
conda's operating environment.
The only thing that actually worked was
conda install -c anaconda setuptools
After which sanity was restored. In between correction attempts I tried to create a new environment which always failed with the same error. After the fix above, I found that the desired environment did not exist in 'conda env list' but it refused to create it giving an error that it already existed. I needed to go into my ~/miniconda3/envs directory where I found the offending directory, deleted it, and was able to create a desired.
Solution 3
setuptools is not installed by conda but pip, so you need to uninstall setuptools by pip
pip uninstall setuptools
and reinstall it though conda:
conda install setuptools
Solution 4
Try to reinstall the dependency:
conda install -c anaconda setuptools
Related videos on Youtube
Amuoeba
Updated on September 18, 2022Comments
-
Amuoeba over 1 year
I needed to update the matplotlib when I encountered the following error:
conda update matplotlib Collecting package metadata: done Solving environment: done ## Package Plan ## environment location: /home/gpu-server/anaconda3 added / updated specs: - matplotlib The following NEW packages will be INSTALLED: libopenblas pkgs/main/linux-64::libopenblas-0.3.3-h5a2b251_3 setuptools pkgs/main/linux-64::setuptools-40.6.3-py37_0 The following packages will be UPDATED: matplotlib conda-forge::matplotlib-3.0.0-2 --> pkgs/main::matplotlib-3.0.2-py37h5429711_0 numpy conda-forge::numpy-1.15.1-py36_blas_o~ --> pkgs/main::numpy-1.15.4-py37h99e49ec_0 numpy-base 1.15.3-py36h81de0dd_0 --> 1.15.4-py37h2f8d375_0 pyparsing conda-forge/noarch::pyparsing-2.2.2-p~ --> pkgs/main/linux-64::pyparsing-2.3.1-py37_0 python 3.6.8-h0371630_0 --> 3.7.2-h0371630_0 pytz conda-forge/noarch::pytz-2018.6-py_0 --> pkgs/main/linux-64::pytz-2018.9-py37_0 six conda-forge::six-1.11.0-py36_1001 --> pkgs/main::six-1.12.0-py37_0 wheel conda-forge::wheel-0.32.2-py36_0 --> pkgs/main::wheel-0.32.3-py37_0 The following packages will be SUPERSEDED by a higher-priority channel: certifi conda-forge::certifi-2018.11.29-py36_~ --> pkgs/main::certifi-2018.11.29-py37_0 cycler conda-forge/noarch::cycler-0.10.0-py_1 --> pkgs/main/linux-64::cycler-0.10.0-py37_0 kiwisolver conda-forge::kiwisolver-1.0.1-py36h2d~ --> pkgs/main::kiwisolver-1.0.1-py37hf484d3e_0 pip conda-forge::pip-18.1-py36_1000 --> pkgs/main::pip-18.1-py37_0 python-dateutil conda-forge/noarch::python-dateutil-2~ --> pkgs/main/linux-64::python-dateutil-2.7.5-py37_0 sip conda-forge::sip-4.19.8-py36hfc679d8_0 --> pkgs/main::sip-4.19.8-py37hf484d3e_0 tornado conda-forge::tornado-5.1.1-py36h470a2~ --> pkgs/main::tornado-5.1.1-py37h7b6447c_0 The following packages will be DOWNGRADED: pyqt 5.9.2-py36h05f1152_2 --> 5.9.2-py37h05f1152_2 Proceed ([y]/n)? y Preparing transaction: done Verifying transaction: failed RemoveError: 'setuptools' is a dependency of conda and cannot be removed from conda's operating environment.
After that I tried updating all conda packages, uninstalling matplotlib, installing setuptools with conda and I always get the same error:
RemoveError: 'setuptools' is a dependency of conda and cannot be removed from conda's operating environment.
It seems like anything to do with conda's install/update/remove functionality leads to this error. Then I tried uninstalling and reinstalling the setuptools with pip. Re-installation worked but the
RemoveError
persisted. I have no more clue of what is going on below is myconda list
output andconda env list
.I have also tried switching from the base environment but the error was still there.conda list:
(base) gpu-server@gpuserver:~$ conda list # packages in environment at /home/gpu-server/anaconda3: # # Name Version Build Channel _ipyw_jlab_nb_ext_conf 0.1.0 py36_0 absl-py 0.6.0 py36_0 conda-forge alabaster 0.7.12 py_0 conda-forge algopy 0.5.7 pypi_0 pypi anaconda-client 1.7.1 py_0 conda-forge anaconda-navigator 1.9.2 py36_0 anaconda-project 0.8.2 py_1 conda-forge appdirs 1.4.3 py_1 conda-forge asn1crypto 0.24.0 py36_1003 conda-forge astor 0.7.1 py_0 conda-forge astroid 2.0.3 py36_0 conda-forge astropy 3.0.5 py36h470a237_0 conda-forge atomicwrites 1.2.1 py_0 conda-forge attrs 18.2.0 py_0 conda-forge automat 0.7.0 py_1 conda-forge babel 2.6.0 py_1 conda-forge backcall 0.1.0 py_0 conda-forge backports 1.0 py_2 conda-forge backports.os 0.1.1 py36_1000 conda-forge backports.shutil_get_terminal_size 1.0.0 py_3 conda-forge beautifulsoup4 4.6.3 py36_1000 conda-forge bitarray 0.8.3 py36h470a237_0 conda-forge bkcharts 0.2 py36_0 conda-forge blas 1.1 openblas conda-forge blaze 0.11.3 py36_0 conda-forge bleach 3.0.2 pypi_0 pypi blinker 1.4 py_1 conda-forge blosc 1.14.4 hdbcaa40_0 bokeh 1.0.0 py36_1000 conda-forge boto 2.49.0 py36_0 boto3 1.9.32 py_0 conda-forge botocore 1.12.33 py_0 conda-forge bottleneck 1.2.1 py36h7eb728f_1 conda-forge bz2file 0.98 py_0 conda-forge bzip2 1.0.6 h14c3975_5 c-ares 1.15.0 h470a237_0 conda-forge ca-certificates 2018.12.5 0 cairo 1.14.12 h8948797_3 certifi 2018.11.29 py36_1000 conda-forge cffi 1.11.5 py36h5e8e0c9_1 conda-forge chardet 3.0.4 py36_1003 conda-forge click 7.0 py_0 conda-forge cloudpickle 0.6.1 py_0 conda-forge clyent 1.2.2 py_1 conda-forge colorama 0.4.0 py_0 conda-forge conda 4.6.2 py36_0 conda-build 3.16.1 py36_0 conda-forge conda-env 2.6.0 1 constantly 15.1.0 py_0 conda-forge contextlib2 0.5.5 py_2 conda-forge cryptography 2.4.2 py36h1ba5d50_0 cryptography-vectors 2.3.1 py36_1000 conda-forge cuda92 1.0 0 pytorch cudatoolkit 9.0 h13b8566_0 cudnn 7.1.2 cuda9.0_0 curl 7.63.0 hbc83047_1000 cycler 0.10.0 pypi_0 pypi cython 0.29 py36hfc679d8_0 conda-forge cytoolz 0.9.0.1 py36h470a237_1 conda-forge dash 0.35.1 pypi_0 pypi dash-core-components 0.42.1 pypi_0 pypi dash-html-components 0.13.4 pypi_0 pypi dash-renderer 0.17.0 pypi_0 pypi dash-table 3.1.11 pypi_0 pypi dask 0.20.0 py_0 conda-forge dask-core 0.20.0 py_0 conda-forge datashape 0.5.4 py36_0 conda-forge dbus 1.13.2 h714fa37_1 decorator 4.3.0 py_0 conda-forge defusedxml 0.5.0 py_1 conda-forge distributed 1.24.0 py36_1000 conda-forge docutils 0.14 py36_1001 conda-forge entrypoints 0.2.3 py36_1002 conda-forge et_xmlfile 1.0.1 py36_0 conda-forge expat 2.2.6 he6710b0_0 fastcache 1.0.2 py36h470a237_1 conda-forge filelock 3.0.9 py_0 conda-forge flask 1.0.2 py_2 conda-forge flask-compress 1.4.0 pypi_0 pypi flask-cors 3.0.6 py_0 conda-forge fontconfig 2.13.0 h9420a91_0 freetype 2.9.1 h8a8886c_1 fribidi 1.0.5 h7b6447c_0 gast 0.2.0 py_0 conda-forge gensim 3.5.0 py36_0 conda-forge get_terminal_size 1.0.0 haa9412d_0 gevent 1.3.6 py36h470a237_0 conda-forge glib 2.56.2 hd408876_0 glob2 0.6 py_0 conda-forge gmp 6.1.2 h6c8ec71_1 gmpy2 2.0.8 py36hb705a9b_2 conda-forge graphite2 1.3.12 h23475e2_2 greenlet 0.4.13 py36_0 conda-forge grpcio 1.16.1 py36hf8bcb03_1 gst-plugins-base 1.14.0 hbbd80ab_1 gstreamer 1.14.0 hb453b48_1 h5py 2.8.0 py36h7eb728f_3 conda-forge harfbuzz 1.8.8 hffaf4a1_0 hdf5 1.10.2 hba1933b_1 heapdict 1.0.0 py36_1000 conda-forge html5lib 1.0.1 py_0 conda-forge hyperlink 17.3.1 py_0 conda-forge icu 58.2 h9c2bf20_1 idna 2.7 py36_1002 conda-forge imageio 2.3.0 py_1 conda-forge imagesize 1.1.0 py_0 conda-forge importlib_metadata 0.6 py36_0 conda-forge incremental 17.5.0 py_0 conda-forge intel-openmp 2019.0 118 ipykernel 5.1.0 pyh24bf2e0_0 conda-forge ipython 7.1.1 py36h24bf2e0_1000 conda-forge ipython_genutils 0.2.0 py_1 conda-forge ipywidgets 7.4.2 py_0 conda-forge isort 4.3.4 py36_1000 conda-forge itsdangerous 1.1.0 py_0 conda-forge jbig 2.1 hdba287a_0 jdcal 1.4 py_1 conda-forge jedi 0.13.1 py36_1000 conda-forge jeepney 0.4 py_0 conda-forge jinja2 2.10 py_1 conda-forge jmespath 0.9.3 py_1 conda-forge jpeg 9b h024ee3a_2 jsonschema 2.6.0 py36_1002 conda-forge jupyter 1.0.0 py_1 conda-forge jupyter_client 5.2.3 py_1 conda-forge jupyter_console 6.0.0 py_0 conda-forge jupyter_core 4.4.0 py_0 conda-forge jupyterlab 0.35.3 py36_0 conda-forge jupyterlab_launcher 0.13.1 py_2 conda-forge jupyterlab_server 0.2.0 py_0 conda-forge keras-applications 1.0.6 pypi_0 pypi keras-preprocessing 1.0.5 pypi_0 pypi keyring 16.0.0 py36_0 conda-forge kiwisolver 1.0.1 py36h2d50403_2 conda-forge krb5 1.16.1 h173b8e3_7 lazy-object-proxy 1.3.1 py36h470a237_0 conda-forge libarchive 3.3.3 h5d8350f_5 libcurl 7.63.0 h20c2e04_1000 libedit 3.1.20170329 h6b74fdf_2 libffi 3.2.1 hd88cf55_4 libgcc-ng 8.2.0 hdf63c60_1 libgfortran 3.0.0 1 conda-forge libgfortran-ng 7.3.0 hdf63c60_0 libiconv 1.15 h470a237_3 conda-forge libpng 1.6.36 hbc83047_0 libprotobuf 3.6.1 hd28b015_0 conda-forge libsodium 1.0.16 h1bed415_0 libssh2 1.8.0 h1ba5d50_4 libstdcxx-ng 8.2.0 hdf63c60_1 libtiff 4.0.9 he85c1e1_2 libtool 2.4.6 h544aabb_3 libuuid 1.0.3 h1bed415_2 libxcb 1.13 h1bed415_1 libxml2 2.9.8 h26e45fe_1 libxslt 1.1.32 h1312cb7_0 llvmlite 0.25.0 py36hd28b015_1 conda-forge locket 0.2.0 py_2 conda-forge lxml 4.2.5 py36hc9114bc_0 conda-forge lz4-c 1.8.1.2 h14c3975_0 lzo 2.10 h49e0be7_2 markdown 2.6.11 py_0 conda-forge markupsafe 1.0 py36h470a237_1 conda-forge matplotlib 3.0.0 2 conda-forge matplotlib-base 3.0.0 py36hc039c98_2 conda-forge mccabe 0.6.1 py_1 conda-forge mistune 0.8.4 py36h470a237_0 conda-forge mkl 2019.0 118 mkl-service 1.1.2 py36h90e4bf4_5 mkl_fft 1.0.6 py36_0 conda-forge mkl_random 1.0.1 py36_0 conda-forge more-itertools 4.3.0 py36_1000 conda-forge mpc 1.1.0 h10f8cd9_1 mpfr 4.0.1 hdf1c602_3 mpmath 1.0.0 py_1 conda-forge msgpack-python 0.5.6 py36h2d50403_3 conda-forge multipledispatch 0.6.0 py_0 conda-forge navigator-updater 0.2.1 py36_0 nbconvert 5.4.0 1 conda-forge nbformat 4.4.0 py_1 conda-forge nccl 1.3.5 cuda9.0_0 ncurses 6.1 hf484d3e_0 networkx 2.2 py_1 conda-forge ninja 1.8.2 h2d50403_1 conda-forge nltk 3.2.5 py_0 conda-forge nose 1.3.7 py36_1002 conda-forge notebook 5.7.0 py36_1000 conda-forge numba 0.40.0 py36hf8a1672_0 conda-forge numdifftools 0.9.20 pypi_0 pypi numexpr 2.6.8 py36hf8a1672_0 conda-forge numpy 1.15.1 py36_blas_openblashd3ea46f_0 conda-forge numpy-base 1.15.3 py36h81de0dd_0 numpydoc 0.8.0 py_1 conda-forge oauthlib 2.1.0 py_0 conda-forge odo 0.5.1 py_1 conda-forge olefile 0.46 py_0 conda-forge openblas 0.2.20 8 conda-forge openpyxl 2.5.9 py_0 conda-forge openssl 1.1.1a h7b6447c_0 packaging 18.0 py_0 conda-forge pandas 0.23.4 py36hf8a1672_0 conda-forge pandoc 1.19.2.1 hea2e7c5_1 pandocfilters 1.4.2 py_1 conda-forge pango 1.42.4 h049681c_0 parso 0.3.1 py_0 conda-forge partd 0.3.9 py_0 conda-forge patchelf 0.9 hf484d3e_2 path.py 11.5.0 py_0 conda-forge pathlib2 2.3.2 py36_1000 conda-forge patsy 0.5.1 py_0 conda-forge pcre 8.42 h439df22_0 pep8 1.7.1 py_0 conda-forge pexpect 4.6.0 py36_1000 conda-forge pickleshare 0.7.5 py36_1000 conda-forge pillow 5.3.0 py36h34e0f95_0 pip 18.1 py36_1000 conda-forge pixman 0.34.0 hceecf20_3 pkginfo 1.4.2 py_1 conda-forge plotly 3.6.0 py36_0 plotly pluggy 0.8.0 py_0 conda-forge ply 3.11 py_1 conda-forge prometheus_client 0.4.2 py_0 conda-forge prompt_toolkit 2.0.6 py_0 conda-forge protobuf 3.6.1 py36hfc679d8_1 conda-forge psutil 5.4.7 py36h470a237_1 conda-forge ptyprocess 0.6.0 py36_1000 conda-forge py 1.7.0 py_0 conda-forge pyasn1 0.4.4 py_1 conda-forge pyasn1-modules 0.2.1 py_0 conda-forge pycodestyle 2.4.0 py_1 conda-forge pycosat 0.6.3 py36h470a237_1 conda-forge pycparser 2.19 py_0 conda-forge pycrypto 2.6.1 py36h470a237_2 conda-forge pycurl 7.43.0.2 py36h1ba5d50_0 pyflakes 2.0.0 py_0 conda-forge pyflux 0.4.15 pypi_0 pypi pygments 2.2.0 py_1 conda-forge pyhamcrest 1.9.0 py_2 conda-forge pyjwt 1.6.4 py_0 conda-forge pylint 2.1.1 py36_0 conda-forge pyodbc 4.0.24 py36hfc679d8_0 conda-forge pyopenssl 18.0.0 py36_1000 conda-forge pyparsing 2.3.0 pypi_0 pypi pyqt 5.9.2 py36h05f1152_2 pysocks 1.6.8 py36_1002 conda-forge pytables 3.4.4 py36h4f72b40_1 conda-forge pytest 3.9.3 py36_1000 conda-forge pytest-arraydiff 0.2 py_0 conda-forge pytest-astropy 0.4.0 py_0 conda-forge pytest-doctestplus 0.1.3 py_0 conda-forge pytest-openfiles 0.3.0 py_0 conda-forge pytest-remotedata 0.3.0 py_0 conda-forge python 3.6.8 h0371630_0 python-crfsuite 0.9.6 py36h2d50403_0 conda-forge python-dateutil 2.7.5 py_0 conda-forge python-libarchive-c 2.8 py36_1004 conda-forge pytorch 0.4.1 py36ha74772b_0 pytz 2018.6 py_0 conda-forge pywavelets 1.0.1 py36h7eb728f_0 conda-forge pyyaml 3.13 py36h470a237_1 conda-forge pyzmq 17.1.2 py36hae99301_1 conda-forge qt 5.9.7 h5867ecd_1 qtawesome 0.5.2 pyh8a2030e_0 conda-forge qtconsole 4.4.2 py_1 conda-forge qtpy 1.5.2 pyh8a2030e_0 conda-forge readline 7.0 h7b6447c_5 requests 2.20.0 py36_1000 conda-forge requests-oauthlib 1.0.0 py_1 conda-forge retrying 1.3.3 py36_2 rope 0.10.7 py_1 conda-forge ruamel_yaml 0.15.71 py36h470a237_0 conda-forge s3transfer 0.1.13 py36_1001 conda-forge scikit-image 0.14.1 py36hfc679d8_0 conda-forge scikit-learn 0.20.0 py36h4989274_1 scipy 1.1.0 py36_blas_openblash7943236_201 conda-forge seaborn 0.9.0 pypi_0 pypi secretstorage 3.1.0 py36_1001 conda-forge send2trash 1.5.0 py_0 conda-forge service_identity 17.0.0 py_0 conda-forge setuptools 40.7.3 pypi_0 pypi simplegeneric 0.8.1 py_1 conda-forge singledispatch 3.4.0.3 py36_1000 conda-forge sip 4.19.8 py36hfc679d8_0 conda-forge six 1.11.0 pypi_0 pypi smart_open 1.7.1 py_0 conda-forge snappy 1.1.7 hbae5bb6_3 snowballstemmer 1.2.1 py_1 conda-forge sortedcollections 1.0.1 py_1 conda-forge sortedcontainers 2.0.5 py_0 conda-forge sphinx 1.8.1 py36_1000 conda-forge sphinxcontrib 1.0 py36_1 sphinxcontrib-websupport 1.1.0 py_1 conda-forge spyder 3.2.8 py36_0 conda-forge spyder-kernels 1.1.0 py_0 conda-forge sqlalchemy 1.2.12 py36h470a237_0 conda-forge sqlite 3.26.0 h7b6447c_0 statsmodels 0.9.0 py36h7eb728f_0 conda-forge sympy 1.3 py36_1000 conda-forge tblib 1.3.2 py_1 conda-forge tensorboard 1.11.0 pypi_0 pypi tensorflow 1.10.0 py36_0 conda-forge tensorflow-gpu 1.11.0 pypi_0 pypi termcolor 1.1.0 py_2 conda-forge terminado 0.8.1 py36_1001 conda-forge testpath 0.4.2 py36_1000 conda-forge tk 8.6.8 hbc83047_0 toolz 0.9.0 py_1 conda-forge torchfile 0.1.0 py_0 conda-forge torchvision 0.2.1 py36_1000 conda-forge tornado 5.1.1 py36h470a237_0 conda-forge tqdm 4.28.1 py_0 conda-forge traitlets 4.3.2 py36_1000 conda-forge twisted 18.9.0 py36h470a237_0 conda-forge twython 3.7.0 py_0 conda-forge typed-ast 1.1.0 py36_0 conda-forge unicodecsv 0.14.1 py_1 conda-forge unidecode 1.0.23 py36_0 unixodbc 2.3.7 h14c3975_0 urllib3 1.23 py36_1001 conda-forge visdom 0.1.8.5 0 conda-forge wcwidth 0.1.7 py_1 conda-forge webencodings 0.5.1 pypi_0 pypi websocket-client 0.54.0 py36_1000 conda-forge werkzeug 0.14.1 py_0 conda-forge wheel 0.32.2 py36_0 conda-forge widgetsnbextension 3.4.2 py36_1000 conda-forge wrapt 1.10.11 py36h470a237_1 conda-forge xlrd 1.1.0 py_2 conda-forge xlsxwriter 1.1.2 py_0 conda-forge xlwt 1.3.0 py_1 conda-forge xz 5.2.4 h14c3975_4 yaml 0.1.7 had09818_2 zeromq 4.2.5 hf484d3e_1 zict 0.1.3 py_0 conda-forge zlib 1.2.11 ha838bed_2 zope 1.0 py36_1 zope.interface 4.6.0 py36h470a237_0 conda-forge zstd 1.3.7 h0b5b093_0
conda env list:
(base) gpu-server@gpuserver:~$ conda env list # conda environments: # base * /home/gpu-server/anaconda3
Any help or insight about what could be wrong is appreciated.
-
Amuoeba about 5 yearsI got the same error when trying this. I ended up reinstalling everything and then the issues were gone. Thanks for the tip though, that issue seems really similar and the solution might work for someone else.
-
Hephaestus over 4 yearsNo joy for me. Still same error.
-
James Adams over 4 yearsThis worked for me as well. Thanks!
-
Max Ghenis over 4 yearsAlso note
--force
will be deprecated in the future;--force-reinstall
is the primary replacement: docs.conda.io/projects/conda/en/latest/commands/update.html -
Hagbard over 4 yearsUnfortunately, this made things worse for me as I'm now facing this issue: github.com/conda/conda/issues/7931