繁体   English   中英

ResolvePackageNotFound:在 mac OSX 上使用 conda 和 yml 文件创建环境

[英]ResolvePackageNotFound: Create env using conda and yml file on mac OSX

首先,我是一个新手,请忍受我的白痴:)

我运行这个:

conda env create -f env.yml 

这是 yml 文件:

name: DAND
channels: !!python/tuple
- defaults
dependencies:
- _nb_ext_conf=0.3.0=py27_0
- anaconda-client=1.6.0=py27_0
- appnope=0.1.0=py27_0
- backports=1.0=py27_0
- backports_abc=0.5=py27_0
- beautifulsoup4=4.5.1=py27_0
- clyent=1.2.2=py27_0
- configparser=3.5.0=py27_0
- cycler=0.10.0=py27_0
- decorator=4.0.10=py27_1
- entrypoints=0.2.2=py27_0
- enum34=1.1.6=py27_0
- freetype=2.5.5=1
- functools32=3.2.3.2=py27_0
- get_terminal_size=1.0.0=py27_0
- icu=54.1=0
- ipykernel=4.5.2=py27_0
- ipython=5.1.0=py27_1
- ipython_genutils=0.1.0=py27_0
- ipywidgets=5.2.2=py27_0
- jinja2=2.8=py27_1
- jsonschema=2.5.1=py27_0
- jupyter=1.0.0=py27_3
- jupyter_client=4.4.0=py27_0
- jupyter_console=5.0.0=py27_0
- jupyter_core=4.2.1=py27_0
- libpng=1.6.22=0
- markupsafe=0.23=py27_2
- matplotlib=1.5.3=np111py27_1
- mistune=0.7.3=py27_1
- mkl=11.3.3=0
- nb_anacondacloud=1.2.0=py27_0
- nb_conda=2.0.0=py27_0
- nb_conda_kernels=2.0.0=py27_0
- nbconvert=4.2.0=py27_0
- nbformat=4.2.0=py27_0
- nbpresent=3.0.2=py27_0
- nltk=3.2.1=py27_0
- notebook=4.3.0=py27_0
- numpy=1.11.2=py27_0
- openssl=1.0.2j=0
- pandas=0.19.1=np111py27_0
- path.py=8.2.1=py27_0
- pathlib2=2.1.0=py27_0
- pexpect=4.0.1=py27_0
- pickleshare=0.7.4=py27_0
- pip=9.0.1=py27_1
- prompt_toolkit=1.0.9=py27_0
- ptyprocess=0.5.1=py27_0
- pygments=2.1.3=py27_0
- pymongo=3.3.0=py27_0
- pyparsing=2.1.4=py27_0
- pyqt=5.6.0=py27_1
- python=2.7.12=1
- python-dateutil=2.6.0=py27_0
- python.app=1.2=py27_4
- pytz=2016.10=py27_0
- pyyaml=3.12=py27_0
- pyzmq=16.0.2=py27_0
- qt=5.6.2=0
- qtconsole=4.2.1=py27_1
- readline=6.2=2
- requests=2.12.3=py27_0
- scikit-learn=0.17.1=np111py27_2
- scipy=0.18.1=np111py27_0
- seaborn=0.7.1=py27_0
- setuptools=27.2.0=py27_0
- simplegeneric=0.8.1=py27_1
- singledispatch=3.4.0.3=py27_0
- sip=4.18=py27_0
- six=1.10.0=py27_0
- sqlite=3.13.0=0
- ssl_match_hostname=3.4.0.2=py27_1
- terminado=0.6=py27_0
- tk=8.5.18=0
- tornado=4.4.2=py27_0
- traitlets=4.3.1=py27_0
- unicodecsv=0.14.1=py27_0
- wcwidth=0.1.7=py27_0
- wheel=0.29.0=py27_0
- widgetsnbextension=1.2.6=py27_0
- xlrd=1.0.0=py27_0
- yaml=0.1.6=0
- zlib=1.2.8=3
- pip:
  - backports-abc==0.5
  - backports.shutil-get-terminal-size==1.0.0
  - backports.ssl-match-hostname==3.4.0.2
  - ipython-genutils==0.1.0
  - jupyter-client==4.4.0
  - jupyter-console==5.0.0
  - jupyter-core==4.2.1
  - nb-anacondacloud==1.2.0
  - nb-conda==2.0.0
  - nb-conda-kernels==2.0.0
  - prompt-toolkit==1.0.9
prefix: /Users/mat/anaconda/envs/DAND

我遇到的错误:

Collecting package metadata (repodata.json): done
Solving environment: failed

ResolvePackageNotFound: 
  - jupyter_console==5.0.0=py27_0
  - freetype==2.5.5=1
  - pyzmq==16.0.2=py27_0
  - configparser==3.5.0=py27_0
  - scipy==0.18.1=np111py27_0
  - libpng==1.6.22=0
  - ...then the list goes on and list all of the dependencies in the yml file, except the ones under pip 

我尝试过的事情:

  1. 我从 Udacity 在线 class 获得了这个 yaml 文件,我从网站下载,所以我不认为conda env export --no-builds > env.yml方法适用于我。

  2. 我在这里尝试了解决方案,我只是将所有内容移到了 pip 块下,然后遇到了一个新错误。 也许我误解了解决方案。

我遇到的新错误:

Warning: you have pip-installed dependencies in your environment file, but you do not list pip itself as one of your conda dependencies.  Conda may not use the correct pip to install your packages, and they may end up in the wrong place.  Please add an explicit pip dependency.  I'm adding one for you, but still nagging you.
Collecting package metadata (repodata.json): done
Solving environment: done
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
Ran pip subprocess with arguments:
['/Users/yulia/anaconda3/envs/DAND/bin/python', '-m', 'pip', 'install', '-U', '-r', '/Users/yulia/data analysis -uda/condaenv.mo_ctuap.requirements.txt']
Pip subprocess output:

Pip subprocess error:
ERROR: Double requirement given: backports_abc==0.5=py27_0 (from -r /Users/yulia/data analysis -uda/condaenv.mo_ctuap.requirements.txt (line 12)) (already in backports-abc==0.5 (from -r /Users/yulia/data analysis -uda/condaenv.mo_ctuap.requirements.txt (line 1)), name='backports-abc')

CondaEnvException: Pip failed

我阅读了一些其他建议使用 pip 安装 requirements.txt 文件的帖子,以及一些关于“CondaEnvException:Pip failed”情况的帖子。 但是他们没有写明确的解决方案,大多数时候我对这些解决方案感到很困惑。

请让我知道我在这里缺少什么,这令人沮丧,因为我无法设置适当的环境来继续 class。 非常感谢您!

更新

当您跳过使用 env 文件时,似乎最终情况可能会更好。 相反,手动创建一个具有所需依赖项的环境,这样库是最新的,并且笔记本看起来可以正常工作。

$ conda create -n DAND python=2 numpy pandas matplotlib seaborn

在课程的“设置系统”(或类似)部分中查找所需的库。 我的示例中的内容基于 Udacity 的“数据分析简介”课程。


较旧的答案

我遇到了类似的问题,最终对我有用的是在这个 YAML 文件的通道部分中添加了两个通道。

前:

channels: !!python/tuple
  - defaults

后:

channels: !!python/tuple
  - defaults
  - conda-forge
  - anaconda

然后找到所有带有版本限制的包。


如果您遇到有关版本冲突的错误,请确保将conda config channel_priority设置为false

$ conda config --set channel_priority false

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM