如何从没有环境名称的文本文件创建新环境?

时间:2018-02-12 22:15:23

标签: python anaconda conda

我正在尝试使用Udacity here提供的给定文件在Anaconda中创建一个新环境。但是,我一直收到这个错误:

  

SpecNotFound:无法处理名称

我认为这是因为在给定的文件中,环境没有名称。我注意到这一点是因为在我当前环境的导出的yaml文件中,我的格式与上面给出的requirements.txt文件格式不同。

所以问题是,如何使用the given file创建新环境?谢谢!

name: base
channels:
  - anaconda
  - conda-forge
  - anaconda-fusion
  - defaults
dependencies:
  - graphviz=2.38.0=4
  - vs2017_runtime=15.5.2=1
  - backports.functools_lru_cache=1.4=py36_1
  - blinker=1.4=py_0
  - ca-certificates=2017.11.5=0
  - certifi=2017.11.5=py36_0
  - oauthlib=2.0.6=py_0
  - openssl=1.0.2n=vc14_0
  - pyjwt=1.5.3=py_0
  - python-json-logger=0.1.7=py36_0
  - requests-oauthlib=0.8.0=py36_1
  - tweepy=3.5.0=py36_0
  - vc=14=0
  - yaml=0.1.7=vc14_0
  - _license=1.1=py36_1
  - alabaster=0.7.10=py36hcd07829_0
  - anaconda-client=1.6.6=py36ha174c20_0
  - anaconda=custom=py36h363777c_0
  - anaconda-navigator=1.6.10=py36h51c3d4f_0
  - anaconda-project=0.8.2=py36hfad2e28_0
  - asn1crypto=0.24.0=py36_0
  - astroid=1.5.3=py36h9d85297_0
  - astropy=2.0.3=py36hfa6e2cd_0
  - attrs=17.3.0=py36hc87868e_0
  - babel=2.5.0=py36h35444c1_0
  - backports=1.0=py36h81696a8_1
  - backports.shutil_get_terminal_size=1.0.0=py36h79ab834_2
  - beautifulsoup4=4.6.0=py36hd4cc5e8_1
  - bitarray=0.8.1=py36h6af124b_0
  - bkcharts=0.2=py36h7e685f7_0
  - blaze=0.11.3=py36h8a29ca5_0
  - bleach=2.1.1=py36h834942a_0
  - bokeh=0.12.13=py36h047fa9f_0
  - boto=2.48.0=py36h1a776d2_1
  - bottleneck=1.2.1=py36hd119dfa_0
  - bzip2=1.0.6=haa5b126_2
  - cachecontrol=0.12.3=py36hfe50d7b_0
  - cffi=1.11.2=py36h829d1a5_0
  - chardet=3.0.4=py36h420ce6e_1
  - chest=0.2.3=py36_0
  - click=6.7=py36hec8c647_0
  - cloudpickle=0.5.2=py36h6b1d831_0
  - clyent=1.2.2=py36hb10d595_1
  - colorama=0.3.9=py36h029ae33_0
  - comtypes=1.1.2=py36heb9b3d1_0
  - conda=4.4.10=py36_0
  - conda-env=2.6.0=h36134e3_1
  - configobj=5.0.6=py36_0
  - console_shortcut=0.1.1=h6bb2dd7_3
  - contextlib2=0.5.5=py36he5d52c0_0
  - coverage=4.4.2=py36hd32d05b_0
  - cryptography=2.1.4=py36he1d7878_0
  - curl=7.55.1=h3b839b5_4
  - cycler=0.10.0=py36h009560c_0
  - cython=0.27.3=py36h22f4c84_0
  - cytoolz=0.9.0=py36hfa6e2cd_0
  - dask=0.16.0=py36hea4f2f0_0
  - dask-core=0.16.0=py36h5683b08_0
  - datashape=0.5.4=py36h5770b85_0
  - decorator=4.1.2=py36he63a57b_0
  - dill=0.2.7.1=py36hf552773_0
  - distlib=0.2.5=py36h51371be_0
  - distributed=1.20.2=py36_0
  - docutils=0.14=py36h6012d8f_0
  - entrypoints=0.2.3=py36hfd66bb0_2
  - et_xmlfile=1.0.1=py36h3d2d736_0
  - fastcache=1.0.2=py36hffdae1b_0
  - filelock=2.0.13=py36h20000bf_0
  - flask=0.12.2=py36h98b5e8f_0
  - flask-cors=3.0.3=py36h8a3855d_0
  - freetype=2.8=h51f8f2c_1
  - get_terminal_size=1.0.0=h38e98db_0
  - gevent=1.2.2=py36h342a76c_0
  - glob2=0.6=py36hdf76b57_0
  - greenlet=0.4.12=py36ha00ad21_0
  - h5py=2.7.1=py36he54a1c3_0
  - hdf5=1.10.1=h98b8871_1
  - heapdict=1.0.0=py36h21fa5f4_0
  - html5lib=1.0.1=py36h047fa9f_0
  - hypothesis=3.38.5=py36h987501d_0
  - icc_rt=2017.0.4=h97af966_0
  - icu=58.2=ha66f8fd_1
  - idna=2.6=py36h148d497_1
  - imageio=2.2.0=py36had6c2d2_0
  - imagesize=0.7.1=py36he29f638_0
  - intel-openmp=2018.0.0=hd92c6cd_8
  - ipykernel=4.7.0=py36h2f9c1c0_0
  - ipython=6.2.1=py36h9cf0123_1
  - ipython_genutils=0.2.0=py36h3c5d0ee_0
  - ipywidgets=7.0.5=py36h6314756_0
  - isort=4.2.15=py36h6198cc5_0
  - itsdangerous=0.24=py36hb6c5a24_1
  - jdcal=1.3=py36h64a5255_0
  - jedi=0.11.0=py36_2
  - jinja2=2.10=py36h292fed1_0
  - jpeg=9b=hb83a4c4_2
  - jsonschema=2.6.0=py36h7636477_0
  - jupyter=1.0.0=py36h422fd7e_2
  - jupyter_client=5.1.0=py36h9902a9a_0
  - jupyter_console=5.2.0=py36h6d89b47_1
  - jupyter_core=4.4.0=py36h56e9d50_0
  - jupyterlab=0.30.6=py36h047fa9f_0
  - jupyterlab_launcher=0.6.0=py36_0
  - krb5=1.14.2=h63dfc2a_6
  - lazy-object-proxy=1.3.1=py36hd1c21d2_0
  - libiconv=1.15=h1df5818_7
  - libpng=1.6.32=h140d38e_4
  - libssh2=1.8.0=h75d9407_3
  - libtiff=4.0.9=h0f13578_0
  - libxml2=2.9.4=h41ea7b2_6
  - libxslt=1.1.29=h0037b19_6
  - llvmlite=0.21.0=py36he0b0552_0
  - locket=0.2.0=py36hfed976d_1
  - lockfile=0.12.2=py36h0468280_0
  - lxml=4.1.1=py36he0adb16_0
  - lzo=2.10=h6df0209_2
  - markupsafe=1.0=py36h0e26971_1
  - matplotlib=2.1.1=py36h2062329_0
  - mccabe=0.6.1=py36hb41005a_1
  - menuinst=1.4.10=py36h42196fb_0
  - mistune=0.8.1=py36h007b88b_0
  - mkl=2018.0.1=h2108138_4
  - mkl-service=1.1.2=py36h57e144c_4
  - mpmath=1.0.0=py36hacc8adf_2
  - msgpack-python=0.5.1=py36he980bc4_0
  - multipledispatch=0.4.9=py36he44c36e_0
  - navigator-updater=0.1.0=py36h8a7b86b_0
  - nbconvert=5.3.1=py36h8dc0fde_0
  - nbformat=4.4.0=py36h3a5bc1b_0
  - networkx=2.0=py36hff991e3_0
  - nltk=3.2.5=py36h76d52bb_0
  - nose=1.3.7=py36h1c3779e_2
  - notebook=5.2.2=py36hc48260a_0
  - numba=0.36.2=np113py36h0128aa7_0
  - numexpr=2.6.4=py36h30784b8_0
  - numpy=1.13.3=py36ha320f96_0
  - numpydoc=0.7.0=py36ha25429e_0
  - odo=0.5.1=py36h7560279_0
  - olefile=0.44=py36h0a7bdd2_0
  - openpyxl=2.4.9=py36h6c6577a_0
  - packaging=16.8=py36ha0986f6_1
  - pandas=0.22.0=py36h6538335_0
  - pandoc=1.19.2.1=hb2460c7_1
  - pandocfilters=1.4.2=py36h3ef6317_1
  - parso=0.1.1=py36hae3edee_0
  - partd=0.3.8=py36hc8e763b_0
  - path.py=10.5=py36h2b94a8f_0
  - pathlib2=2.3.0=py36h7bfb78b_0
  - patsy=0.4.1=py36h42cefec_0
  - pep8=1.7.0=py36h0f3d67a_0
  - pickleshare=0.7.4=py36h9de030f_0
  - pillow=4.3.0=py36ha40f157_1
  - pip=9.0.1=py36h226ae91_4
  - pkginfo=1.4.1=py36hb0f9cfa_1
  - pluggy=0.6.0=py36hc7daf1e_0
  - ply=3.10=py36h1211beb_0
  - progress=1.3=py36hbeca8d3_0
  - prompt_toolkit=1.0.15=py36h60b8f86_0
  - psutil=5.4.3=py36hfa6e2cd_0
  - py=1.5.2=py36hbcfbabc_0
  - py4j=0.10.6=py36_0
  - pyasn1=0.4.2=py36h22e697c_0
  - pycodestyle=2.3.1=py36h7cc55cd_0
  - pycosat=0.6.3=py36h413d8a4_0
  - pycparser=2.18=py36hd053e01_1
  - pycrypto=2.6.1=py36he68e6e2_1
  - pycurl=7.43.0=py36h086bf4c_3
  - pyflakes=1.6.0=py36h0b975d6_0
  - pygments=2.2.0=py36hb010967_0
  - pylint=1.7.4=py36ha4e6ded_0
  - pympler=0.5=py36h863af32_0
  - pyodbc=4.0.21=py36h82c9817_0
  - pyopenssl=17.5.0=py36h5b7d817_0
  - pyparsing=2.2.0=py36h785a196_1
  - pyqt=5.6.0=py36hb5ed885_5
  - pyreadline=2.1=py36h094d952_1
  - pysocks=1.6.7=py36h698d350_1
  - pyspark=2.2.0=py36_0
  - pytables=3.4.2=py36h71138e3_2
  - pytest=3.3.0=py36hf3522a2_0
  - python=3.6.3=h3b118a2_4
  - python-dateutil=2.6.1=py36h509ddcb_1
  - pytz=2017.3=py36h1d3fa6b_0
  - pywavelets=0.5.2=py36hc649158_0
  - pywin32=221=py36h9c10281_0
  - pyyaml=3.12=py36h1d1928f_1
  - pyzmq=16.0.3=py36he714bf5_0
  - qt=5.6.2=vc14h6f8c307_12
  - qtawesome=0.4.4=py36h5aa48f6_0
  - qtconsole=4.3.1=py36h99a29a9_0
  - qtpy=1.3.1=py36hb8717c5_0
  - requests=2.18.4=py36h4371aae_1
  - rope=0.10.7=py36had63a69_0
  - ruamel_yaml=0.11.14=py36h9b16331_2
  - scikit-image=0.13.0=py36h6dffa3f_1
  - scikit-learn=0.19.1=py36h53aea1b_0
  - scipy=1.0.0=py36h1260518_0
  - seaborn=0.8.1=py36h9b69545_0
  - setuptools=38.4.0=py36_0
  - simplegeneric=0.8.1=py36heab741f_0
  - singledispatch=3.4.0.3=py36h17d0c80_0
  - sip=4.18.1=py36h9c25514_2
  - six=1.11.0=py36h4db2310_1
  - snowballstemmer=1.2.1=py36h763602f_0
  - sockjs-tornado=1.0.3=py36_0
  - sortedcollections=0.5.3=py36hbefa0ab_0
  - sortedcontainers=1.5.7=py36ha90ac20_0
  - sphinx=1.6.3=py36h9bb690b_0
  - sphinxcontrib=1.0=py36hbbac3d2_1
  - sphinxcontrib-websupport=1.0.1=py36hb5e5916_1
  - spyder=3.2.4=py36h8845eaa_0
  - sqlalchemy=1.1.13=py36h5948d12_0
  - sqlite=3.20.1=h9eeafa9_2
  - statsmodels=0.8.0=py36h6189b4c_0
  - sympy=1.1.1=py36h96708e0_0
  - tblib=1.3.2=py36h30f5020_0
  - testpath=0.3.1=py36h2698cfe_0
  - tk=8.6.7=hcb92d03_3
  - toolz=0.9.0=py36_0
  - tornado=4.5.2=py36h57f6048_0
  - traitlets=4.3.2=py36h096827d_0
  - typing=3.6.2=py36hb035bda_0
  - unicodecsv=0.14.1=py36h6450c06_0
  - urllib3=1.22=py36h276f60a_0
  - vs2015_runtime=14.0.25123=hd4c4e62_2
  - wcwidth=0.1.7=py36h3d5aa90_0
  - webencodings=0.5.1=py36h67c50ae_1
  - werkzeug=0.12.2=py36h866a736_0
  - wheel=0.30.0=py36h6c3ec14_1
  - widgetsnbextension=3.0.8=py36h933dd4f_0
  - win_inet_pton=1.0.1=py36he67d7fd_1
  - win_unicode_console=0.5=py36hcdbd4b5_0
  - wincertstore=0.2=py36h7fe50ca_0
  - wrapt=1.10.11=py36he5f5981_0
  - xlrd=1.1.0=py36h1cb58dc_1
  - xlsxwriter=1.0.2=py36hf723b7d_0
  - xlwings=0.11.4=py36hd3cf94d_0
  - xlwt=1.3.0=py36h1a4751e_0
  - zict=0.1.3=py36h2d8e73e_0
  - zlib=1.2.11=h8395fce_2
  - zope=1.0=py36_0
  - zope.interface=4.4.3=py36h56cab3c_0
  - pip:
    - args==0.1.0
    - clint==0.5.1
    - floyd-cli==0.10.2
    - marshmallow==2.13.5
    - requests-toolbelt==0.8.0
    - shortuuid==0.5.0
    - tables==3.4.2
    - tabulate==0.7.7
    - xgboost==0.6
prefix: C:\Users\georg\Anaconda3

3 个答案:

答案 0 :(得分:4)

我遇到了同样的错误。我的文件也具有txt扩展名。 我将其更改为yml,并且按预期工作!

(在Ubuntu 18.10上测试)

答案 1 :(得分:3)

这似乎是一个pip需求文件而不是conda environment.yaml文件。

您可以使用

在您的环境中通过pip安装所有这些(首先激活它)
pip install -r requirements.txt

或者,如果您需要(我怀疑),要使用conda包管理器进行安装,您可以使用此处引用的任一方法 - Install only available packages using "conda install --yes --file requirements.txt" without error

conda install --yes --file requirements.txt

但请注意,如果在默认频道中找不到要求,则可能会失败。

您可以通过链接问题中的命令编写脚本安装脚本;

while read requirement; do conda install --yes $requirement; done < requirements.txt

或者确实如此,尽可能使用conda,但如果没有,则回退到pip;

$ while read requirement; do conda install --yes $requirement || pip install $requirement; done < requirements.txt

答案 2 :(得分:0)

将文件扩展名更改为.yml,然后在anaconda命令提示符下运行以下命令。

C:\Directory\conda env create -f file.yml

这将自动安装所有库。