【问题标题】:RemoveError: 'requests' is a dependency of conda and cannot be removed from conda's operating environmentRemoveError: 'requests' 是 conda 的依赖,不能从 conda 的运行环境中移除
【发布时间】:2019-01-27 21:22:57
【问题描述】:

在安装第三方库时遇到问题,在使用安装了 Anaconda 的 Windows 10 之前我没有看到此错误:

C:\Users\XYZ>conda env create -f python3.6-environment-windows.yml
Collecting package metadata: done
Solving environment: done

Downloading and Extracting Packages
certifi-2018.1.18    | 144 KB    | ############################################################################ | 100%
mkl-2018.0.1         | 155.2 MB  | ############################################################################ | 100%
pytz-2018.9          | 229 KB    | ############################################################################ | 100%
icc_rt-2019.0.0      | 9.4 MB    | ############################################################################ | 100%
icu-58.2             | 21.8 MB   | ############################################################################ | 100%
pip-9.0.1            | 1.7 MB    | ############################################################################ | 100%
xz-5.2.3             | 348 KB    | ############################################################################ | 100%
sip-4.18.1           | 269 KB    | ############################################################################ | 100%
libpng-1.6.36        | 1.3 MB    | ############################################################################ | 100%
vc-14                | 985 B     | ############################################################################ | 100%
numpy-1.14.0         | 3.7 MB    | ############################################################################ | 100%
python-3.6.4         | 17.6 MB   | ############################################################################ | 100%
jpeg-9c              | 314 KB    | ############################################################################ | 100%
wheel-0.30.0         | 85 KB     | ############################################################################ | 100%
wincertstore-0.2     | 13 KB     | ############################################################################ | 100%
freetype-2.9.1       | 475 KB    | ############################################################################ | 100%
scipy-1.0.0          | 13.0 MB   | ############################################################################ | 100%
pyparsing-2.3.1      | 54 KB     | ############################################################################ | 100%
kiwisolver-1.0.1     | 60 KB     | ############################################################################ | 100%
qt-5.6.2             | 55.6 MB   | ############################################################################ | 100%
python-dateutil-2.7. | 218 KB    | ############################################################################ | 100%
vs2015_runtime-14.0. | 1.9 MB    | ############################################################################ | 100%
ca-certificates-2017 | 489 KB    | ############################################################################ | 100%
tk-8.6.7             | 3.5 MB    | ############################################################################ | 100%
setuptools-38.4.0    | 540 KB    | ############################################################################ | 100%
matplotlib-2.2.2     | 6.5 MB    | ############################################################################ | 100%
six-1.12.0           | 21 KB     | ############################################################################ | 100%
openssl-1.0.2n       | 5.4 MB    | ############################################################################ | 100%
pyqt-5.6.0           | 4.5 MB    | ############################################################################ | 100%
zlib-1.2.11          | 236 KB    | ############################################################################ | 100%
tornado-5.1.1        | 665 KB    | ############################################################################ | 100%
sqlite-3.22.0        | 907 KB    | ############################################################################ | 100%
cycler-0.10.0        | 8 KB      | ############################################################################ | 100%
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.

参考这里的说明 - https://enigma.co/catalyst/install.html#installing-with-conda

【问题讨论】:

标签: python windows conda


【解决方案1】:

我在 Mac Mojave 上遇到了同样的问题,就我而言,运行 conda update --force conda 首先为我工作。

【讨论】:

  • 这在尝试安装 textacy 时对我有用,谢谢。
  • 警告: --force 标志将在未来的 conda 版本中删除。 --force 不推荐。
  • 在我运行 Mojave 的 MBP 上,conda update --force conda 仍然存在同样的问题。
  • 我试过这个,现在我从conda update conda 和类似的地方得到ModuleNotFoundError: No module named 'libarchive'
  • @pjpj:正确。我使用conda update --force-reinstall conda -y 来执行更新。
【解决方案2】:

在为我解决问题之前运行conda update conda

【讨论】:

  • 当我尝试conda update conda 时,出现同样的错误。喜欢RemoveError: 'requests' is a dependency of conda and cannot be removed from conda's operating environment.
  • 这将强制你使用更新的次要版本的 python,因此并不总是一个好的解决方案
  • 为我工作,但使用 sudo
  • 我运行 conda update conda 然后运行 ​​conda update --all,这可以完成这项工作
  • conda update condasudo conda update condaconda update --all 在 Mac OS Mojave 上都对我产生了同样的错误。
【解决方案3】:
conda update --force conda

将解决:验证事务:失败删除错误:“请求”是 conda 的依赖项,无法从 conda 运行环境中删除。

【讨论】:

    【解决方案4】:

    这在 Linux 上对我有用:

    1. 通过 pip 卸载包:

      pip uninstall setuptools
      
    2. 使用以下命令重新安装:

      conda install -c anaconda setuptools
      

    还要考虑可能需要删除系统包(python3-setuptoolspython-setuptools 在 Ubuntu 中)。

    【讨论】:

    • conda install -c anaconda setuptools 解决了我的 MBP + Mojave 上的问题。谢谢!
    • pip uninstall setuptools 工作时,conda install -c anaconda setuptools 只是导致了同样的错误。现在我没有安装工具。
    • 为什么要设置工具?问题在requests 包上。
    【解决方案5】:
    conda update --force conda
    

    当我在 win64 中工作时,这对我有用

    conda install -c https://conda.anaconda.org/sdvillal openslide-python
    

    【讨论】:

      【解决方案6】:

      在这里提出一个愚蠢的观点,但我之前已经被这个抓住了:你可能不在你认为的环境中。就在杀死任何包之前运行快速检查以查看:

      conda env list
      

      在基础环境上执行操作可能会导致问题,因此您可以want to create or change environment

      【讨论】:

        【解决方案7】:

        我遇到了同样的问题,这是由于软件包安装错误(在我的例子中是 OpenEXR)。 尝试使用conda list yourPackage 验证您的包裹。 如果您发现它是哪一个,最好在此处使用预构建的软件包安装它:https://www.lfd.uci.edu/~gohlke/pythonlibs/

        帮助我的堆栈溢出线程:Python 2.7, PIP: "Failed building wheel for ..."

        编辑: 两个朋友有同样的错误,一个通过管理员权限安装/执行解决了它。 另一个成功地为python创建了一个新的虚拟环境。

        【讨论】:

        • 谢谢,使用 Github 上某人提供的预构建包手动构建轮子。
        【解决方案8】:

        在删除了 anaconda 安装的所有 R 包后,我在 macos 上遇到了同样的问题。不幸的是,我找到的唯一解决方案是重新安装 anaconda。或者,您可以下载 miniconda shell 脚本安装程序,使用 -U 选项运行它并将安装程序指向您的 conda 目录。这为我解决了这个问题,同时保持了频道优先级等设置。但是,许多以前安装的包无法导入(Python 找不到它们),我最终重新安装了所有包。

        【讨论】:

          【解决方案9】:

          我遇到了同样的问题。如果遇到类似这样的错误(如图所示),请尝试使用命令提示符安装 wheel 文件,然后您必须安装该 wheel 文件:

          额外(如何从命令提示符安装wheel文件):

          • 根据系统规范下载wheel文件:-在此处搜索所需文件https://www.lfd.uci.edu/~gohlke/pythonlibs/ -e.g. bsddb3 - 点击 bsddb3 并搜索所需文件
          • 在您的系统上打开命令提示符
          • 将命令提示符上的位置更改为:您下载 wheel 文件的位置,例如 C:\Users\Name\Downloads
          • 转到安装python的位置>>转到脚本>>复制路径(例如C:\Program Files (x86)\Python36-32\Scripts)
          • 编写命令,使用 pip install 安装 wheel 文件(例如 C:\Program Files (x86)\Python36-32\Scripts\pip install copy_name_of_the_wheel_file)
          • 运行命令

          【讨论】:

            【解决方案10】:

            尝试 conda env create --force -f python3.6-environment-windows.yml 我不确定将它放在哪里,但是每当我遇到诸如 conda update --force conda 或 conda install --force 之类的问题时,我都会使用 --force ... 将其用作最后的解决方案,因为它会强制 conda 执行命令,您以后可能会遇到一些问题

            【讨论】:

              【解决方案11】:

              我已经解决了这个问题 RemoveError:'setuptools' 是 conda 的依赖项,不能从中删除 conda 的运行环境。

              如下方式:

              • pip 卸载安装工具
              • conda 更新 conda
              • conda 更新设置工具

              然后检查工具

              我还没有遇到任何错误,但请帮助我纠正我的方式,如果有问题,请

              【讨论】:

              • 欢迎来到SO,请在链接前加上感叹号以显示图片(如![在此处输入图片描述]())
              【解决方案12】:

              对我来说,停用当前的 conda 环境可以解决问题,即在升级之前运行 conda deactivate

              【讨论】:

                猜你喜欢
                • 2019-12-24
                • 1970-01-01
                • 1970-01-01
                • 2021-12-08
                • 1970-01-01
                • 1970-01-01
                • 2020-08-04
                • 2019-09-10
                • 1970-01-01
                相关资源
                最近更新 更多