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

RemoveError: 'requests' is a dependency of conda and cannot be removed from conda's operating environment #8149

Open
usgoose opened this issue Jan 27, 2019 · 139 comments
Labels
solver pertains to the solver source::community catch-all for issues filed by community members stale::recovered [bot] recovered after being marked as stale type::bug describes erroneous operation, use severity::* to classify the type

Comments

@usgoose
Copy link

usgoose commented Jan 27, 2019

Current Behavior

Having trouble installing a third party library called bottleneck and I have not seen this error before using Windows 10 with Anaconda installed:

conda install bottleneck

Environment

Operating System: (Windows 10 Pro)
Python Version: 3.6.5

https://pastebin.com/Qz5tp09J

Steps to Reproduce

(base) C:\WINDOWS\system32>conda install bottleneck
Collecting package metadata: done
Solving environment: done

## Package Plan ##

  environment location: C:\Users\XYZ\Anaconda3

  added / updated specs:
    - bottleneck


The following NEW packages will be INSTALLED:

  bottleneck         pkgs/main/win-64::bottleneck-1.2.1-py36h452e1ab_1
  certifi            pkgs/main/win-64::certifi-2018.11.29-py36_0
  numpy-base         pkgs/main/win-64::numpy-base-1.14.3-py36h555522e_1
  pip                pkgs/main/win-64::pip-18.1-py36_0
  setuptools         pkgs/main/win-64::setuptools-40.6.3-py36_0
  zstd               pkgs/main/win-64::zstd-1.3.7-h508b16e_0

The following packages will be UPDATED:

  ca-certificates                              2018.03.07-0 --> 2018.12.5-0
  libarchive                               3.3.2-h798a506_7 --> 3.3.3-h0643e63_5
  libpng                                  1.6.34-h79bbb47_0 --> 1.6.36-h2a8f88b_0
  openssl                                 1.0.2o-h8ea7d77_0 --> 1.1.1a-he774522_0
  python                                   3.6.5-h0c2934d_0 --> 3.6.8-h9f7ef89_0
  qt                                   5.9.5-vc14he4a7d60_0 --> 5.9.7-vc14h73c81de_0
  sqlite                                  3.23.1-h35aae40_0 --> 3.26.0-he774522_0
  vc                                          14-h0510ff6_3 --> 14.1-h0510ff6_4
  vs2015_runtime                               14.0.25123-3 --> 14.15.26706-h3a45250_0
  wheel                                       0.31.1-py36_0 --> 0.32.3-py36_0

The following packages will be DOWNGRADED:

  libssh2                                  1.8.0-hd619d38_4 --> 1.8.0-h7a1dbc1_4


Proceed ([y]/n)? y

Preparing transaction: done
Verifying transaction: failed

RemoveError: 'requests' is a dependency of conda and cannot be removed from
conda's operating environment.
RemoveError: 'setuptools' is a dependency of conda and cannot be removed from
conda's operating environment.
@vishwesh5
Copy link

Is there any update on this?

@usgoose usgoose closed this as completed Jan 30, 2019
@conda conda deleted a comment from usgoose Jan 31, 2019
@CooperNederhood
Copy link

I have the exact same problem when I try to upgrade PyTorch

@satrya-sabeni
Copy link

I have the same on MacOS Mojave, how can I fix this thing??

@satrya-sabeni
Copy link

Doing 'conda update conda' before it worked for me
conda version : 4.6.2

@usgoose
Copy link
Author

usgoose commented Jan 31, 2019

Not sure why conda deleted my comment, but re-opening this since many others have the same issue. I will let someone from the Conda team to close it when there is an appropriate solution.

@usgoose usgoose reopened this Jan 31, 2019
@surajkota
Copy link

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

Same problem on Linux too, creating a new environment is failing with latest version of conda

@CorentinJ
Copy link

I had it with setuptools instead, and updating conda fixed it.

@ejke
Copy link

ejke commented Feb 5, 2019

I had the requests dependency error on MacOS with conda v4.6.2, python 3.7.2. I had miniconda installed, not sure if trying to update it with anaconda commands might have caused the error.

Anyways, doing rm -r ~/miniconda3/, removing stuff that conda had installed into ~/.bash_profile and downloading and installing new conda from package worked for me

@egpbos
Copy link

egpbos commented Feb 13, 2019

I had the same issue (and additionally also the same problem for ruamel_yaml). I noticed that somehow in my case requests was installed with pip in my base environment. Is it possible that requests was only recently added as a Conda dependency and that Conda did not force reinstallation through Conda?

I updated the package with pip install --upgrade requests. This installed 2.21.0, which Conda apparently needs. However, it seems to still detect the conda-forge version as a higher version, because conda update conda still fails for me.

@egpbos
Copy link

egpbos commented Feb 13, 2019

I also tried removing the pip package (pip uninstall requests), after which Conda of course stopped working. I then tried to reinstall/update my Conda installation by simply running the miniconda installer on the same prefix as my existing installation. This unfortunately failed with message

reinstalling: python.app-2-py37_9 ...
cp: /Users/pbos/sw/miniconda3/pythonapp: No such file or directory
ln: ./lib: File exists
Error: post-link failed for: python.app-2-py37_9

After this I gave up and simply reinstalled miniconda.

@berkeleymalagon
Copy link

@satrya-sabeni's fix worked for me (updating conda with conda update conda)

@kunanit
Copy link

kunanit commented Feb 20, 2019

conda update conda worked for me, but only after deactivating (conda deactivate) out of any current conda environments (including the base conda env)

@rocknamx8
Copy link

conda update conda worked for me too.

@sourcecode369
Copy link

Having the same issue while upgrading to PyTorch. I'll try @rocknamx8 solution and see if it works.

@HamedAlemo
Copy link

I had the same problem today, and conda update conda resolved it.

@kliushenkov
Copy link

kliushenkov commented Mar 26, 2019

I hade the same problem, but conda update conda doesn't work

@matthiastns
Copy link

Same problem. "conda update conda" does not work on my machine either. See outcome:

Z:\>conda update conda
Collecting package metadata: done
Solving environment: done

## Package Plan ##

  environment location: C:\Users\hm113045\AppData\Local\Continuum\Anaconda3

  added / updated specs:
    - conda


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    requests-2.21.0            |        py36_1000          84 KB  conda-forge
    ------------------------------------------------------------
                                           Total:          84 KB

The following NEW packages will be INSTALLED:

  requests           conda-forge/win-64::requests-2.21.0-py36_1000


Proceed ([y]/n)? y


Downloading and Extracting Packages
requests-2.21.0      | 84 KB     | ############################################################################ | 100%
Preparing transaction: done
Verifying transaction: failed

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

@alekhka
Copy link

alekhka commented Mar 28, 2019

@matthiastns Doing 'conda update --force conda' worked for me

@matthiastns
Copy link

@alekhka You are my hero. That solved it for me. Thank you very much.

@bounlu
Copy link

bounlu commented Apr 2, 2019

@alekhka is my hero too. this is the only solution that worked for me as well.

@paviomuniz
Copy link

Doing 'conda update --force conda' worked for me

@ccwgolfer
Copy link

conda update in any form did not work for me and kept throwing similar error "conda create failure--RemoveError: 'setuptools' is a dependency of conda and cannot be removed from conda's operating environment.

Updating Anaconda Navigator fixed my issue.

@matanox
Copy link

matanox commented Apr 12, 2019

I find those conda update conda answers flawed in one fundamental way; this will force upon you a newer minor version of python, something that's not always responsible within a larger suite of dependencies and considerations.

@josh-friedlander-kando
Copy link

I wouldn't try to upgrade the Python version in an existing virtual env, especially not base. Easier to create a new one with conda create --name py38 python=3.8, no?

@SomePersonSomeWhereInTheWorld

Easier to create a new one with conda create --name py38 python=3.8, no?

OK like mentioned here,

What brought this up was trying to get ROS (robotics OS) to run on Fedora and having the colcon build command fail when running into the old libssh/OpenSSL libraries and getting a slew of undefined references..

So once I active Python 3.8, I'm hoping this should be fixed?

@josh-friedlander-kando
Copy link

Yikes. Probably not! I don't know much about any of that stuff but I doubt which conda virtualenv you're in affects it. You could try to conda remove libuuid but I'd guess it happens higher up, with your shell's environment variables. Also we're pretty far off topic here so I'd suggest continuing this discussion on a more relevant thread...

@FortesFortunaAdiuvat
Copy link

Tried conda update --force conda and did not work... furthermore was unable to try any other proposed fixes and am now having to reinstall anaconda.

@leitc
Copy link

leitc commented Aug 25, 2020

conda deactivate
conda update --force conda

This worked for me.

@xsqian
Copy link

xsqian commented Sep 1, 2020

Tried conda deactivate and conda update --force conda and did not work... furthermore was unable to try any other proposed fixes and am now having to reinstall anaconda. And also note, every try took a couple of hours

@ptcane
Copy link

ptcane commented Sep 22, 2020

I had this when trying to conda install nltk

conda update conda ran but did not solve the issue

I 'solved' it by using pip install nltk

I've been using miniconda.

@eabase
Copy link

eabase commented Sep 25, 2020

I was trying to update my (8 mo. old) miniconda3 installation, and ended up tried just about everything, except hacking/editing code (already a bad idea), and nothing worked, except for the following.

3 hours later:

# Remove index cache, lock files, unused cache packages, and tarballs.
conda clean -a -vv
conda deactivate

#--------------------------------------------------------
# Fixing the conda update problem
#--------------------------------------------------------
# -c CHANNEL
#	Additional channel to search for packages. These are
#	URLs searched in the order they are given (including
#	file:// for local directories). Then, the defaults or
#	channels from .condarc are searched (unless
#	--override-channels is given). You can use 'defaults'
#	to get the default packages for conda. You can also
#	use any name and the .condarc channel_alias value will
#	be prepended. The default channel_alias is
#	http://conda.anaconda.org/.
# 
# -n ENVIRONMENT
#--------------------------------------------------------
conda update -y -n base -c defaults conda --force
conda activate
conda update -y --force conda

pip list -o

# This will still show these as outdated but OK..
#------------------------------------------------
# Package     Version             Latest  Type
# ----------- ------------------- ------- -----
# ruamel-yaml 0.15.87             0.16.12 wheel
# setuptools  49.6.0.post20200814 50.3.0  wheel
#------------------------------------------------

pip install -U setuptools
conda deactivate

# Remove any files related to "ruamel-yaml":
# WARNING: Recursive removal, so don't fuck this up!
cd $env:_CONDA_ROOT
gci -r -fi "ruamel*" | ForEach-Object { rm -Recurse -Force $_ }

#---------------------------------------------------------------------
# IMPORTANT! 
# Now when conda doesn't work, it does something to the environment 
# variables, or perhaps simply kicks you out of the (base).
# In my case it ended up switching the python/pip interpreter, because 
# I have 2 installed. Make sure you're on your original one. 
# In my case it was 3.7, so I had to check it is using the right pip
# version and it's on the right path.
#---------------------------------------------------------------------
pip3.7 -V
# Correct output should be:
# pip 20.2.3 from c:\users\<username>\miniconda3\lib\site-packages\pip (python 3.7)

pip3.7.exe install ruamel-yaml
conda activate
# ok

ALL GOOD!
🍾 ❤️

@bounlu
Copy link

bounlu commented Nov 17, 2020

conda update --force-reinstall conda worked for me

@naveensk23
Copy link

conda update --force-reinstall conda

Thank You, I was struggling for days. . . . . . jus your line made it easy, now everything got updated and working fine . . . : )

@eabase
Copy link

eabase commented Nov 22, 2020

@bounlu
@naveensk23

Perhaps you can tell us why this is better or how it's different from just removing conda and re-installing it?

@naveensk23
Copy link

I was afraid of losing all the environments which I have been worked for the last year, So I really tried my best not to uninstall the anaconda and I wanted to retain all the Env. I tried various options to remove the dependency error.. . Nothing actually worked. At last conda update --force-reinstall conda did work and I was able to retain all my previous conda Env s. now everything working absolutely fine . . . . .

@xu-kai-xu
Copy link

@matthiastns Doing 'conda update --force conda' worked for me

works well for me, too. Thanks.

@eabase
Copy link

eabase commented Dec 13, 2020

To update from 4.8.5 I had to do both:

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

@mohammad-brdrn
Copy link

'conda update --force conda' worked for me

@hashPhoeNiX
Copy link

@matthiastns Doing 'conda update --force conda' worked for me

This worked for me as well.

@fangrh
Copy link

fangrh commented Mar 31, 2021

'conda update conda -f' work for me

@DrNickBailey
Copy link

DrNickBailey commented Jun 18, 2021

How can updating conda cause it to try and remove it's own dependency? I'm now trying to solve this error on SageMaker with the conda update --force conda and getting this warning:

WARNING: The --force flag will be removed in a future conda release.
         See 'conda update --help' for details about the --force-reinstall
         and --clobber flags.

And after completion conda info still shows the same version number 4.8.4.
However, when I then ran conda update -y -n base -c defaults conda it did update to the latest version 4.10.1

@markowusu
Copy link

@matthiastns Doing 'conda update --force conda' worked for me

This worked for and after that, I reinstalled the library that was throwing the error- xgboost using sudo conda install -c conda-forge py-xgboost

@hfl112
Copy link

hfl112 commented May 4, 2022

Same problem. "conda update conda" does not work on my machine either. See outcome:

Z:\>conda update conda
Collecting package metadata: done
Solving environment: done

## Package Plan ##

  environment location: C:\Users\hm113045\AppData\Local\Continuum\Anaconda3

  added / updated specs:
    - conda


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    requests-2.21.0            |        py36_1000          84 KB  conda-forge
    ------------------------------------------------------------
                                           Total:          84 KB

The following NEW packages will be INSTALLED:

  requests           conda-forge/win-64::requests-2.21.0-py36_1000


Proceed ([y]/n)? y


Downloading and Extracting Packages
requests-2.21.0      | 84 KB     | ############################################################################ | 100%
Preparing transaction: done
Verifying transaction: failed

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

Thank you, this actually solves the incompatible problems of conda packages.

@mikofski
Copy link

mikofski commented Aug 25, 2022

I was not able to resolve this in Linux either by reinstalling setuptools or updating conda with force flag, I just kept getting RemoveError or Killed. I didn't want to nuke my conda environment (even tho I probably should've) because it is a in TLJH server.

My solution, may not be popular to some was to install micromamba, set the $MAMBA_ROOT_PREFIX to match the existing base environment where tljh packages were installed (/opt/tljh/user), and bootstrap a new setuptools from conda-forge. After this I just installed mamba and finally no RemoveError. Finally I used mamba to update conda, and now I just use mamba. (I suppose I could remove micromamba now.)

@SteveKe
Copy link

SteveKe commented Nov 4, 2022

'conda update --force conda' did not work for me until closed anaconda client ,then it worked

@statsconchris
Copy link

statsconchris commented Nov 7, 2022

I managed to solve this:
First I removed anaconda3 folder in home with:
rm -r anaconda3
Eventually you are asked if you want to remove each file in the folder... most of the files are protected so even if you say "yes," they won't be removed... however some will; therefore, in the end this folder is partially destroyed (I'm sure that in the process I targeted and removed the specific file that was causing the error)

Then I downloaded the .sh file from anaconda website (https://www.anaconda.com/) and installed it with
bash file_name.sh -u
And all errors were gone...

Previously I was just doing the second step bash file_name.sh -u thinking that anaconda by itself in the reinstallation process was going to fix any error but it did not. I had to " partially destroy" the anaconda3 folder... previously I was always getting python 3.8, but thanks to partially destroying the anaconda3 folder, i.e., rm -r anaconda3, the installation was succesful as I got now python 3.9.

Copy link

github-actions bot commented Nov 8, 2023

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 Nov 8, 2023
@wookayin
Copy link

wookayin commented Nov 8, 2023

Please do not kill the issue, dear stalebot.

@github-actions github-actions bot added stale::recovered [bot] recovered after being marked as stale and removed stale [bot] marked as stale due to inactivity labels Nov 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
solver pertains to the solver source::community catch-all for issues filed by community members stale::recovered [bot] recovered after being marked as stale type::bug describes erroneous operation, use severity::* to classify the type
Projects
Status: 🆕 New
Development

No branches or pull requests