github源的PIP安装无法安装在存储库中定义的依赖项.txt

发布于 2025-02-03 10:28:00 字数 1463 浏览 3 评论 0原文

我正在尝试完全安装 github存储库在我的包装中。该项目被正确添加到我的setup.cfg文件:

install_requires =
    requests>=2.27.0, <3.0.0
    rich>=12.3.0, <13.0.0
    pydantic>=1.9.0, <2.0.0
    openalexapi @ git+https://github.com/dpriskorn/OpenAlexAPI.git@master#egg=openalexapi

a pip install -e。 installs openalexapi,但它不会吸引依赖项列表在他们的要求中。因此,它无法安装向后并返回以下错误:

Python 3.10.0 (default, Oct  7 2021, 04:19:18) [Clang 10.0.0 ]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.4.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from openalexapi import works
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Input In [1], in <cell line: 1>()
----> 1 from openalexapi import works

File ~/codes/PPPL/promotion-analysis/venv/lib/python3.10/site-packages/openalexapi/__init__.py:7, in <module>
      4 import logging
      5 from typing import Optional, List
----> 7 import backoff  # type: ignore
      8 import requests
      9 from pydantic import BaseModel, EmailStr

我知道一个人可以做pip install -r https://path/to/requirements.txt但是想知道是否有一种方法可以自动触发依赖关系。

I'm trying to fully install a Github repository in my package. The item is added properly to my setup.cfg file:

install_requires =
    requests>=2.27.0, <3.0.0
    rich>=12.3.0, <13.0.0
    pydantic>=1.9.0, <2.0.0
    openalexapi @ git+https://github.com/dpriskorn/OpenAlexAPI.git@master#egg=openalexapi

A pip install -e . installs openalexapi but it does not pull the list of dependencies in their requirements.txt. As such, it fails to install backoff and returns the following error:

Python 3.10.0 (default, Oct  7 2021, 04:19:18) [Clang 10.0.0 ]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.4.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from openalexapi import works
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Input In [1], in <cell line: 1>()
----> 1 from openalexapi import works

File ~/codes/PPPL/promotion-analysis/venv/lib/python3.10/site-packages/openalexapi/__init__.py:7, in <module>
      4 import logging
      5 from typing import Optional, List
----> 7 import backoff  # type: ignore
      8 import requests
      9 from pydantic import BaseModel, EmailStr

I know that one can do pip install -r https://path/to/requirements.txt but was wondering if there is a way to trigger pulling the dependencies automatically.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

分开我的手 2025-02-10 10:28:00

当不明确时(pip install -r unignts.txt)问pip install永远不要隐式使用supports.txt

依赖项在setup.cfg/setup.py中列出在车轮的元数据或源分布中。顺便说一句说元数据是从setup.cfg/setup.py中生成的,必须明确读取supports.txt

openalexapi代码并非如此

pip install -r https://raw.githubusercontent.com/dpriskorn/OpenAlexAPI/master/requirements.txt

When not explicitly (pip install -r requirements.txt) asked pip install never implicitly uses requirements.txt.

Dependencies are listed in wheels' metadata or in source distributions in setup.cfg/setup.py. And BTW said metadata is generated from setup.cfg/setup.py which must explicitly read requirements.txt.

It's not the case with openalexapi code so the only way to use its requirements.txt is to do explicitly

pip install -r https://raw.githubusercontent.com/dpriskorn/OpenAlexAPI/master/requirements.txt
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文