【问题标题】:Python install packages: Couldn't install packages with pip install commandPython 安装包:无法使用 pip install 命令安装包
【发布时间】:2021-01-18 18:08:23
【问题描述】:

我一直在尝试在 anaconda 提示符下使用 pip install 命令在我的 conda 环境中安装顶点包,但我不断收到以下警告和错误:

pip install vertex

WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/vertex/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/vertex/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/vertex/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/vertex/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/vertex/
ERROR: Could not find a version that satisfies the requirement vertex
ERROR: No matching distribution found for vertex

anaconda 提示的屏幕截图:

我尝试延长 pip 命令的超时时间,得到以下警告和错误:

pip --default-timeout=1000 install vertex

WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))': /simple/vertex/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))': /simple/vertex/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))': /simple/vertex/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))': /simple/vertex/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))': /simple/vertex/
ERROR: Could not find a version that satisfies the requirement vertex
ERROR: No matching distribution found for vertex

anaconda 提示的屏幕截图:

大约一周前我在安装 scipy 时遇到了同样的问题,但我设法通过使用以下命令绕过它:

conda install -c conda-forge scipy

它成功了,然后我将 conda-fronge 频道添加到我的环境中。尝试使用 conda install 命令安装顶点包时,我收到一条消息,它无法在当前频道中找到顶点包,并且我没有设法为此找到合适的频道。命令行:

conda install vertex

Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.

PackagesNotFoundError: The following packages are not available from current channels:

  - vertex

Current channels:

  - https://conda.anaconda.org/bioconda/win-64
  - https://conda.anaconda.org/bioconda/noarch
  - https://conda.anaconda.org/anaconda/win-64
  - https://conda.anaconda.org/anaconda/noarch
  - https://conda.anaconda.org/conda-forge/win-64
  - https://conda.anaconda.org/conda-forge/noarch
  - https://repo.anaconda.com/pkgs/main/win-64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/free/win-64
  - https://repo.anaconda.com/pkgs/free/noarch
  - https://repo.anaconda.com/pkgs/r/win-64
  - https://repo.anaconda.com/pkgs/r/noarch
  - https://repo.anaconda.com/pkgs/msys2/win-64
  - https://repo.anaconda.com/pkgs/msys2/noarch

To search for alternate channels that may provide the conda package you're
looking for, navigate to

    https://anaconda.org

and use the search bar at the top of the page.

无论哪种方式,我都无法在我的 conda 环境中安装顶点包。

提前感谢所有帮助者:)

【问题讨论】:

    标签: python pip conda python-3.8 anaconda3


    【解决方案1】:

    这个包似乎在 Anaconda Cloud 上不可用,它的 PyPI 历史已有好几年了,没有更新。浏览项目的README,它看起来并不处于积极维护的状态,因此您可能无法通过包管理器安装它(如果有的话)。

    【讨论】:

    • 是的,你是对的,但我知道我班上的人成功地安装了这个包(我在课程项目中需要这个)。鉴于我在一周前使用 pip 命令安装 scipy 时也遇到了问题,我认为这不是安装失败的原因。还是谢谢。
    【解决方案2】:

    您可以尝试避免混合使用多个包源。这样做应该会降低依赖性问题的可能性。据我了解,在您的环境中,您现在有 3 个来源:

    • 康达
    • conda-forge

    对于干净的 conda 环境,pip 安装包时不会出错。

    conda create -n vertex-env python=3
    conda activate vertex-env
    pip install vertex
    pip list
    

    使用上面的命令序列,我成功安装了顶点包,虽然我没有验证运行时。

    $ pip list
    Package        Version
    -------------- -------------------
    attrs          20.3.0
    Automat        20.2.0
    certifi        2020.12.5
    cffi           1.14.4
    constantly     15.1.0
    cryptography   3.3.1
    hyperlink      21.0.0
    idna           3.1
    incremental    17.5.0
    pip            20.3.3
    pycparser      2.20
    PyHamcrest     2.0.2
    pyOpenSSL      20.0.1
    setuptools     49.6.0.post20210108
    six            1.15.0
    Twisted        20.3.0
    Vertex         0.3.1
    wheel          0.36.2
    zope.interface 5.2.0
    

    【讨论】:

    • 我试过你写的,还是不行。我也试过完全卸载anaconda并重新安装它,然后按照你写的做,但它仍然没有用。仍然感谢您的尝试。
    【解决方案3】:

    考虑到这个包的历史,几乎没有理由相信它可以与任何 Python 3 版本一起使用。事实上,searching for print commands in the repo code,我们发现一些缺少括号,这意味着 Python 3 不兼容。因此,改为尝试 Python 2.7 构建,让 Pip 解决除 Python 和 Pip 之外的所有问题:

    vertex.yaml

    name: vertex
    channels:
      - conda-forge
      - defaults
      - free
    dependencies:
      - python=2.7
      - pip
      - pip:
        - Vertex
        - service_identity
    

    然后从 shell(例如 bash):

    conda env create -n vertex -f vertex.yaml
    conda activate vertex
    

    这样可以安装 Vertex,并且在加载我在测试中找到的一些模块(例如,from vertex import q2q)时不会抛出错误,但我没有运行实际测试。

    【讨论】:

    • @Niv 听起来是正确的。确保您在文件中的间距与我提供的完全匹配(YAML 对空格敏感)。由于您使用的是 Windows,因此您可能需要启动 Anaconda Prompt 会话,而不是默认的命令提示符。
    • 是的,就是这样。它仍然会引发与帖子中相同的错误。对于我的课程项目要求,我需要有 python 3.7.x
    猜你喜欢
    • 2018-01-05
    • 2017-02-23
    • 2020-11-27
    • 2021-01-29
    • 1970-01-01
    • 1970-01-01
    • 2021-04-18
    • 2021-09-21
    • 1970-01-01
    相关资源
    最近更新 更多