Conda无法在pypi.org/simple找到包裹

时间:2018-01-07 15:50:40

标签: python anaconda conda

我遇到通过conda安装软件包的问题。它无法在通道https://pypi.org中找到任何包。

conda install logbook

返回:

PS C:\WINDOWS\system32> conda config --add channels 
https://pypi.org/simple
Warning: 'https://pypi.org/simple' already in 'channels' list, moving to the top
PS C:\WINDOWS\system32> conda install Logbook
Fetching package metadata ....
WARNING: The remote server could not find the noarch directory for the
requested channel with url: https://pypi.org/simple

It is possible you have given conda an invalid channel. Please double-check
your conda configuration using `conda config --show`.

If the requested url is in fact a valid conda channel, please request that the
channel administrator create `noarch/repodata.json` and associated
`noarch/repodata.json.bz2` files, even if `noarch/repodata.json` is empty.
$ mkdir noarch
$ echo '{}' > noarch/repodata.json
$ bzip2 -k noarch/repodata.json
...........

PackageNotFoundError: Packages missing in current channels:

  - logbook

We have searched for the packages in the following channels:

  - https://pypi.org/simple/win-64
  - https://pypi.org/simple/noarch
  - https://repo.continuum.io/pkgs/main/win-64
  - https://repo.continuum.io/pkgs/main/noarch
  - https://repo.continuum.io/pkgs/free/win-64
  - https://repo.continuum.io/pkgs/free/noarch
  - https://repo.continuum.io/pkgs/r/win-64
  - https://repo.continuum.io/pkgs/r/noarch
  - https://repo.continuum.io/pkgs/pro/win-64
  - https://repo.continuum.io/pkgs/pro/noarch
  - https://repo.continuum.io/pkgs/msys2/win-64
  - https://repo.continuum.io/pkgs/msys2/noarch

我已在浏览器中手动检查,日志模块位于第https://pypi.org/simple页的列表中。 好吧,似乎conda在https://pypi.org/simple/win-64中寻找包,但win-64目录在那里不存在。

conda config --show说,配置的频道是https://pypi.org/simple

add_anaconda_token: True
add_pip_as_python_dependency: True
allow_non_channel_urls: True
allow_softlinks: False
always_copy: False
always_softlink: False
always_yes: False
anaconda_upload: None
auto_update_conda: True
changeps1: True
channel_alias: https://conda.anaconda.org
channel_priority: True
channels:
  - https://pypi.org/simple
  - https://pypi.org/simple/
  - defaults
client_ssl_cert: None
client_ssl_cert_key: None
clobber: False
create_default_packages: []
custom_channels:
  pkgs/main: https://repo.continuum.io/
  pkgs/free: https://repo.continuum.io/
  pkgs/r: https://repo.continuum.io/
  pkgs/pro: https://repo.continuum.io/
  pkgs/msys2: https://repo.continuum.io/
  C:/Program%20Files/Anaconda3/conda-bld: file:///

有什么建议吗?

2 个答案:

答案 0 :(得分:4)

conda频道必须具有特定的布局(win-64,win-32,...),并且必须以conda特定的方式构建包(请参阅Building conda packages with conda skeleton)。这些包通常是针对特定的Python版本(尽管也应该有noarch包)和/或numpy版本以及不同的平台(windows,linux,mac 32bit或64bit)构建的。

您不能使用conda直接从PyPI安装软件包,因为PyPI不符合conda-channel的条件,即使它是软件包,也不像conda-packages那样构建。但您可以使用pip(在conda中)安装它们。

但是:您可以检查您想要的软件包是否在符合条件的频道中分发(一个非常受欢迎的频道目前是conda-forge)。乍一看,几个通道在anaconda云中包含一个名为logbook的包(search results for logbook)。

如果您找到一个分发所需软件包版本的渠道(以及所需的Python版本和平台),那么只需使用:

conda install -c channel_name logbook

答案 1 :(得分:1)

Gohlke页面上有许多适用于Windows的Python产品。

假设你在自己的环境中安装了64位Py3.6,称为Py36,你可以这样做。

Gohlke下载Logbook-1.1.0-cp36-cp36m-win_amd64.whl(或者您需要的任何版本)。

然后在命令提示符下:

  • activate您要安装Logbook的conda环境。
  • 使用pip安装您在该环境中下载的whl
  • 如果您愿意,请验证是否成功。
C:\scratch>activate Py36

(Py36) C:\scratch>pip install Logbook-1.1.0-cp36-cp36m-win_amd64.whl
Processing c:\scratch\logbook-1.1.0-cp36-cp36m-win_amd64.whl
Installing collected packages: Logbook
Successfully installed Logbook-1.1.0

(Py36) C:\scratch>conda list
# packages in environment at C:\ProgramData\Miniconda3\envs\Py36:
#
beautifulsoup4            4.6.0                     <pip>
certifi                   2017.11.5        py36hb8ac631_0
chardet                   3.0.4                     <pip>
idna                      2.6                       <pip>
Logbook                   1.1.0                     <pip>
opencv-python             3.4.0+contrib             <pip>
pip                       9.0.1            py36h226ae91_4
python                    3.6.3                h3b118a2_4
requests                  2.18.4                    <pip>
setuptools                36.5.0           py36h65f9e6e_0
urllib3                   1.22                      <pip>
vc                        14                   h2379b0c_2
vs2015_runtime            14.0.25123           hd4c4e62_2
wheel                     0.30.0           py36h6c3ec14_1
wikipedia                 1.4.0                     <pip>
wincertstore              0.2              py36h7fe50ca_0

修改:在评论中回答查询。

我输入了这个:

conda env export -n Py36 -f Py36.yml

yaml文件的内容。

name: Py36
channels:
- defaults
dependencies:
- certifi=2017.11.5=py36hb8ac631_0
- pip=9.0.1=py36h226ae91_4
- python=3.6.3=h3b118a2_4
- setuptools=36.5.0=py36h65f9e6e_0
- vc=14=h2379b0c_2
- vs2015_runtime=14.0.25123=hd4c4e62_2
- wheel=0.30.0=py36h6c3ec14_1
- wincertstore=0.2=py36h7fe50ca_0
- pip:
  - beautifulsoup4==4.6.0
  - chardet==3.0.4
  - idna==2.6
  - logbook==1.1.0
  - opencv-python==3.4.0+contrib
  - requests==2.18.4
  - urllib3==1.22
  - wikipedia==1.4.0
prefix: C:\ProgramData\Miniconda3\envs\Py36