如何修复找不到满足需求的版本'对于install_requires列表,在自定义软件包中安装PIP时?

发布于 2025-01-30 13:13:34 字数 1050 浏览 1 评论 0原文

我正在尝试使用Twine软件包构建自己的Python软件包(可通过PIP安装)。一切都很好,直到我尝试安装实际包装(因此上传到PYPI之后)。

因此,我首先运行:

python3 setup.py sdist bdist_whreel

其中我的设置​​.py.py install_requires list看起来像这样:

install_requires=[
'jupyter_kernel_gateway==2.4.0',
'pandas==1.0.2',
'numpy==1.18.1',
'azure-storage-blob==2.0.1',
'azure-datalake-store==0.0.48',
'psycopg2-binary==2.8.4',
'xlsxwriter==1.2.6',
'SQLAlchemy==1.3.12',
'geoalchemy2==0.6.3',
'tabulate==0.8.2',
'pyproj==1.9.6',
'geopandas==0.4.0',
'contextily==0.99.0',
'matplotlib==3.0.2',
'humanize==0.5.1',
'ujson==1.35',
'singleton-decorator==1.0.0',
'dataclasses==0.6',
'xlrd==1.2.0'],

在我的理解中,这些install_requires将在pip安装时安装时我自己的包裹。

此后,我运行

Python3 -M Twine上传-repository testpypi dist/*

实际上将我的软件包上传到PYPI。但是,当PIP安装我的软件包时,我会遇到错误,说没有任何版本满足许多列出要求的要求。例如:错误:找不到满足需求psycopg2-binary == 2.8.4的版本

(例如,我手动安装这些软件包时/code>),它们确实安装了。

是否有任何方法可以使我的软件包的PIP安装实际上安装install_requires要求列表成功?

I am trying to build my own Python package (installable by pip) using the twine package. This is all going well right up until the point where I try to pip install my actual package (so after uploading to PyPi).

So I first run:

python3 setup.py sdist bdist_wheel

In which my setup.py install_requires list looks like this:

install_requires=[
'jupyter_kernel_gateway==2.4.0',
'pandas==1.0.2',
'numpy==1.18.1',
'azure-storage-blob==2.0.1',
'azure-datalake-store==0.0.48',
'psycopg2-binary==2.8.4',
'xlsxwriter==1.2.6',
'SQLAlchemy==1.3.12',
'geoalchemy2==0.6.3',
'tabulate==0.8.2',
'pyproj==1.9.6',
'geopandas==0.4.0',
'contextily==0.99.0',
'matplotlib==3.0.2',
'humanize==0.5.1',
'ujson==1.35',
'singleton-decorator==1.0.0',
'dataclasses==0.6',
'xlrd==1.2.0'],

In my understanding, these install_requires would be installed by pip when installing my own package.

After this I run

python3 -m twine upload --repository testpypi dist/*

To actually upload my package to PyPi. However, when pip installing my package, I get errors that say there are no versions that satisfy the requirements for a lot of the listed requirements. E.g.: ERROR: Could not find a version that satisfies the requirement psycopg2-binary==2.8.4

When I manually install these packages (e.g. pip install psycopg2-binary==2.8.4), they do get installed.

Is there any way to make the pip install of my package actually install the install_requires requirement list succesfully?

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

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

发布评论

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

评论(1

不奢求什么 2025-02-06 13:13:34

您没有说明pip install - ing your软件包,但我猜您正在使用类似的内容:

pip install your_project --index-url https://test.pypi.org/simple

问题是TestPypi不包含PYPI上存在的依赖项的副本。例如:

​/stable/reference/pip_install/#install-extra-index-url“ rel =“ noreferrer”> - 额外index-url 而不是:

pip install your_project --extra-index-url https://test.pypi.org/simple 

You didn't show how your pip install-ing your package, but I'm guessing you're using something like:

pip install your_project --index-url https://test.pypi.org/simple

The issue is that TestPyPI doesn't contain copies of your dependencies that exist on PyPI. For example:

You can configure pip to fall back on TestPyPI when a package is missing instead by specifying --extra-index-url instead:

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