我有一个 rhel 服务器,我将其用作其他服务器的 yum 存储库。现在我也需要它来提供 python 包。我找到了一个 anaconda 存储库来下载软件包:https://repo.continuum.io/pkgs/main/linux-64/我使用以下命令下载所有软件包:
wget -A bz2 https://repo.continuum.io/pkgs/main/linux-64/ -P /path_for_packages
我使用 -A bz2 因为所有包都是 tar.bz2 格式的。
我还有一台无法连接到互联网但可以与存储库服务器通信的客户端计算机。
目的是将软件包从服务器计算机安装/下载到客户端计算机。
我在两台服务器上都有 anaconda 4.5.11。我还在客户端计算机的“.condarc”文件中指定了通道(客户端查找包的路径)。
# This is a sample .condarc file.
# It adds the r Anaconda.org channel and enables
# the show_channel_urls option.
# channel locations. These override conda defaults, i.e., conda will
# search *only* the channels listed here, in the order given.
# Use "defaults" to automatically include all default channels.
# Non-url channels will be interpreted as Anaconda.org usernames
# (this can be changed by modifying the channel_alias key; see below).
# The default is just 'defaults'.
channels:
- http://<IP_ADDRESS>/Path/To/Packages
# Show channel URLs when displaying what is going to be downloaded
# and in 'conda list'. The default is False.
show_channel_urls: True
# For more information about this file see:
# https://conda.io/docs/user-guide/configuration/use-condarc.html
当我尝试使用上面的命令从客户端计算机安装软件包时:
conda install wget
Solving environment: failed
# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<
Traceback (most recent call last):
File "/root/anaconda3/lib/python3.7/site-packages/conda/core/subdir_data.py", line 227, in _load
mod_etag_headers.get('_mod'))
File "/root/anaconda3/lib/python3.7/site-packages/conda/core/subdir_data.py", line 574, in fetch_repodata_remote_request
raise Response304ContentUnchanged()
conda.core.subdir_data.Response304ContentUnchanged
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/root/anaconda3/lib/python3.7/site-packages/conda/exceptions.py", line 819, in __call__
return func(*args, **kwargs)
File "/root/anaconda3/lib/python3.7/site-packages/conda/cli/main.py", line 78, in _main
exit_code = do_call(args, p)
File "/root/anaconda3/lib/python3.7/site-packages/conda/cli/conda_argparse.py", line 77, in do_call
exit_code = getattr(module, func_name)(args, parser)
File "/root/anaconda3/lib/python3.7/site-packages/conda/cli/main_install.py", line 11, in execute
install(args, parser, 'install')
File "/root/anaconda3/lib/python3.7/site-packages/conda/cli/install.py", line 235, in install
force_reinstall=context.force,
File "/root/anaconda3/lib/python3.7/site-packages/conda/core/solve.py", line 518, in solve_for_transaction
force_remove, force_reinstall)
File "/root/anaconda3/lib/python3.7/site-packages/conda/core/solve.py", line 451, in solve_for_diff
final_precs = self.solve_final_state(deps_modifier, prune, ignore_pinned, force_remove)
File "/root/anaconda3/lib/python3.7/site-packages/conda/core/solve.py", line 180, in solve_final_state
index, r = self._prepare(prepared_specs)
File "/root/anaconda3/lib/python3.7/site-packages/conda/core/solve.py", line 592, in _prepare
self.subdirs, prepared_specs)
File "/root/anaconda3/lib/python3.7/site-packages/conda/core/index.py", line 215, in get_reduced_index
new_records = query_all(spec)
File "/root/anaconda3/lib/python3.7/site-packages/conda/core/index.py", line 184, in query_all
return tuple(concat(future.result() for future in as_completed(futures)))
File "/root/anaconda3/lib/python3.7/site-packages/conda/core/subdir_data.py", line 95, in query
self.load()
File "/root/anaconda3/lib/python3.7/site-packages/conda/core/subdir_data.py", line 149, in load
_internal_state = self._load()
File "/root/anaconda3/lib/python3.7/site-packages/conda/core/subdir_data.py", line 233, in _load
mod_etag_headers.get('_mod'))
File "/root/anaconda3/lib/python3.7/site-packages/conda/core/subdir_data.py", line 280, in _read_local_repdata
_internal_state = self._process_raw_repodata_str(raw_repodata_str)
File "/root/anaconda3/lib/python3.7/site-packages/conda/core/subdir_data.py", line 320, in _process_raw_repodata_str
assert subdir == self.channel.subdir
AssertionError
`$ /root/anaconda3/bin/conda install wget`
environment variables:
CIO_TEST=<not set>
CONDA_DEFAULT_ENV=base
CONDA_EXE=/root/anaconda3/bin/conda
CONDA_PREFIX=/root/anaconda3
CONDA_PROMPT_MODIFIER=
CONDA_PYTHON_EXE=/root/anaconda3/bin/python
CONDA_ROOT=/root/anaconda3
CONDA_SHLVL=1
PATH=/root/anaconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:
/root/bin
REQUESTS_CA_BUNDLE=<not set>
SSL_CERT_FILE=<not set>
active environment : base
active env location : /root/anaconda3
shell level : 1
user config file : /root/.condarc
populated config files : /root/.condarc
conda version : 4.5.11
conda-build version : 3.15.1
python version : 3.7.0.final.0
base environment : /root/anaconda3 (writable)
channel URLs : http://<IP_Address>/Path/To/Packages
http://<IP_Address>/Path/To/Packages
package cache : /root/anaconda3/pkgs
/root/.conda/pkgs
envs directories : /root/anaconda3/envs
/root/.conda/envs
platform : linux-64
user-agent : conda/4.5.11 requests/2.19.1 CPython/3.7.0 Linux/3.10.0-327.el7.x86_64 rhel/7.2 glibc/2.17
UID:GID : 0:0
netrc file : None
offline mode : False
An unexpected error has occurred. Conda has prepared the above report.
If submitted, this report will be used by core maintainers to improve
future releases of conda.
Would you like conda to send this report to the core maintainers?
[y/N]: n
No report sent. To permanently opt-out, use
$ conda config --set report_errors false
我尝试过的方法:
https://github.com/conda/conda/issues/7524
我还尝试将我的 anaconda 版本降级到“4.3.30”。这个版本给我带来了一个新的错误,它是:
conda install anaconda
Fetching package metadata .....
CondaEnvironmentNotFoundError: Could not find environment: /root/anaconda3/envs/base .
You can list all discoverable environments with `conda info --envs`.
从这个错误来看,它表明 repo 服务器没有这样的环境,即:
http://<IP_Address>/Path/To/Packages
我不知道是否可以将远程环境添加到这里。我尝试过,因为这是添加环境的方法:
conda --set custom_channels.my-conda-channel http://<IP_Address>/Path/To/Package
但正如我所假设的,它只能添加本地路径。
答案1
Anaconda 版本有问题。使用最新版本,Windows机器无法从远程存储库安装所需的数据包。您需要下载anaconda3-5.0.1安装程序exe才能解决此问题。