为什么 conda create 会尝试安装奇怪的包?

Why does conda create try to install weird packages?

我正在尝试安装一个新的 conda 环境,它将与我的其他环境完全分开,所以我 运行:

conda create --name foot35 python=3.5

Anaconda 然后请求我批准安装这些新软件包:

asn1crypto:      0.22.0-py35he3634b9_1
ca-certificates: 2017.08.26-h94faf87_0
cachecontrol:    0.12.3-py35h3f82863_0
certifi:         2017.7.27.1-py35hbab57cd_0
cffi:            1.10.0-py35h4132a7f_1
chardet:         3.0.4-py35h177e1b7_1
colorama:        0.3.9-py35h32a752f_0
cryptography:    2.0.3-py35h67a4558_1
distlib:         0.2.5-py35h12c42d7_0
html5lib:        0.999999999-py35h79d4e7f_0
idna:            2.6-py35h8dcb9ae_1
lockfile:        0.12.2-py35h667c6d9_0
msgpack-python:  0.4.8-py35hdef45cb_0
openssl:         1.0.2l-vc14hcac20b0_2      [vc14]
packaging:       16.8-py35h5fb721f_1
pip:             9.0.1-py35h69293b5_3
progress:        1.3-py35ha84af61_0
pycparser:       2.18-py35h15a15da_1
pyopenssl:       17.2.0-py35hea705d1_0
pyparsing:       2.2.0-py35hcabcaab_1
pysocks:         1.6.7-py35hb30ac0d_1
python:          3.5.4-hedc2606_15
requests:        2.18.4-py35h54a615f_1
setuptools:      36.5.0-py35h21a22e4_0
six:             1.10.0-py35h06cf344_1
urllib3:         1.22-py35h8cc84eb_0
vc:              14-h2379b0c_1
vs2015_runtime:  14.0.25123-hd4c4e62_1
webencodings:    0.5.1-py35h5d527fb_1
wheel:           0.29.0-py35hdbcb6e6_1
win_inet_pton:   1.0.1-py35hbef1270_1
wincertstore:    0.2-py35hfebbdb8_0

我不知道为什么它会建议这些特定的。我查了一下 lockfile,它的网站上写着:

Note: This package is deprecated.

Here 是我的命令提示符的屏幕截图,作为附加信息。

我正在尝试对根环境进行 unrelated/independent 的全新安装。

为什么 conda 试图安装这些东西,我该如何解决?

要避免 conda 安装所有默认包,您可以试试这个

 conda create --name foot35 --no-deps python=3.5

conda 创建将 "Create a new conda environment from a list of specified packages." ( https://conda.io/docs/commands/conda-create.html )

什么名单??!? .condarc 文件是 conda 配置文件。

https://conda.io/docs/user-guide/configuration/use-condarc.html#overview

The .condarc file can change many parameters, including:

Where conda looks for packages.
If and how conda uses a proxy server.
Where conda lists known environments.
Whether to update the bash prompt with the current activated environment name.
Whether user-built packages should be uploaded to Anaconda.org.
**Default packages or features to include in new environments.**

Additionally, if you ever typed conda config, even accidentally...

The .condarc file is not included by default, but it is automatically created in your home directory the first time you run the conda config command.

A .condarc file may also be located in the root environment, in which case it overrides any in the home directory.

如果您想要一个干净的环境,那么 Boshika 建议为一个实例使用 --no-default-packages 标志,您可以检查和修改所有其他环境的默认包。 ( https://conda.io/docs/user-guide/configuration/use-condarc.html#always-add-packages-by-default-create-default-packages )

Always add packages by default (create_default_packages)
When creating new environments, add the specified packages by default. The default packages are installed in every environment you create. You can override this option at the command prompt with the --no-default-packages flag. The default is to not include any packages.

EXAMPLE:

create_default_packages:
  - pip
  - ipython
  - scipy=0.15.0

由于所有操作系统的遗留要求,可能存在锁定文件。如果您愿意,希望您有删除它的工具。

请不要放弃希望这对我来说也很奇怪。 您只需按照以下步骤操作:-

1.Download 来自官方网站的 anaconda 系统并安装它:https://repo.continuum.io

  1. 安装过程后,您可以从那里select您自己的包,请不要从任何地方下载任何东西,它在 Internet 上有很多包。

3.If 你想从事 python 下载 Syder IDE 它对机器学习库非常有用。

  1. 默认情况下不要创建其他环境而不是 root,否则你必须再次复制所有文件,如果在 root 中安装时出现任何错误,请关闭 window 并再次 运行作为管理,之后它工作正常。
  2. 因为你的根环境中的所有文件所以你以后不用担心路径,你可以安装和卸载包:像-numpy,pandas,tensorflow和它的gpu,scikit-从那里轻松学习等。

谢谢

如果您想 pip install ... 任何东西,这些包通常很有用。没有他们中的许多人做 pip install requests 可能会导致诸如这些(以及更多)

之类的错误
  • No Module named Setuptools
  • pip: command not found
  • pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available

conda create ... 暴露的问题是它要拉下的包是可变的(基于您创建环境的时间)。如果您希望为您和可能与您合作的人维护相同的环境,则可能需要冻结或固定 conda create 的默认安装包。

一种方法是 creating your environment with conda env create using a conda environment YAML file 例如这个例子:

dependencies:
  - ca-certificates=2018.03.07
  - certifi=2018.4.16
  - libedit=3.1.20170329
  - libffi=3.2.1
  - ncurses=6.1
  - openssl=1.0.2o
  - pip=10.0.1
  - python=3.6.6
  - readline=7.0
  - setuptools=40.0.0
  - sqlite=3.24.0
  - tk=8.6.7
  - wheel=0.31.1
  - xz=5.2.4
  - zlib=1.2.11

conda env create -n <NAME_OF_ENVIRONMENT> -f <PATH_TO_CONDA_REQUIREMENTS_FILE>

(注意是conda env create不是conda create