pip和conda environment.yml:不支持使用+的操作数类型:'NoneType'和'list'。

3
我在conda环境下尝试使用pip安装一个包。 我有一个名为environment.yml的文件,内容如下:
name: test-env

dependencies:
    - pip:
        - "git+https://github.com/choldgraf/download"

但是当我运行conda env update --file environment.yml时,会得到以下结果:
Using Anaconda API: https://api.anaconda.org
Fetching package metadata .............
Solving package specifications: An unexpected error has occurred.
Please consider posting the following information to the
conda GitHub issue tracker at:

# Here some configuration that I omit    

Traceback (most recent call last):
  File "/home/mathurin/anaconda3/lib/python3.5/site-packages/conda/exceptions.py", line 634, in conda_exception_handler
    return_value = func(*args, **kwargs)
  File "/home/mathurin/anaconda3/lib/python3.5/site-packages/conda_env/cli/main_update.py", line 106, in execute
    installer.install(prefix, specs, args, env, prune=args.prune)
  File "/home/mathurin/anaconda3/lib/python3.5/site-packages/conda_env/installers/pip.py", line 8, in install
    pip_cmd = pip_args(prefix) + ['install', ] + specs
TypeError: unsupported operand type(s) for +: 'NoneType' and 'list'

然而,在我的bash控制台中只需键入pip install git+https://github.com/choldgraf/download就可以正常工作。我做错了什么吗?
编辑:我的第一个想法是更新conda。我现在的版本是4.3.23,尝试使用conda update conda无法更新。
# All requested packages already installed.
# packages in environment at ~/anaconda3:
#
conda                     4.3.23                   py35_0    conda-forge

你使用的 conda 版本是什么? - darthbith
如果您更新conda会怎样?我现在使用的版本是4.3.25。 - darthbith
1
啊,你是从conda-forge安装的。如果你想更新它,可以输入 conda install conda=4.3.25 看看是否解决问题,但可能不行... - darthbith
@darthbith 这样更新之后现在可以工作了。谢谢。 - P. Camilleri
1个回答

2

我曾经遇到过同样的问题,但是我找到了解决方案。您需要在配置文件中至少添加一个依赖项(我不确定它是否必须是pip)。在我的配置文件中,我添加了pip=9.0.1=py35_1

name: myenv
channels:
- defaults
dependencies:
- pip=9.0.1=py35_1
- pip:
  - tqdm==4.19.5

所以我认为在你的情况下,应该是这样的:
name: test-env
dependencies:
- pip=9.0.1=py35_1
- pip:
  - "git+https://github.com/choldgraf/download"

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接