问题描述
我正在尝试构建一个程序包并将其上传到pypi,我越过了这一点,上传成功了,让我向您介绍我在做什么:
setup.py
:
from setuptools import setup,find_packages
setup(
name='project_name',version='1.0',packages=find_packages(),url='url',license='license',author='author',author_email='email_here@some_mail.com',description='description',install_requires=[
'oauth2client','pyarrow','pandas','requests','gcloud'
],)
我愿意
% python3 setup.py sdist bdist_wheel
其次是
% python3 -m twine upload -u username -p password --repository-url https://test.pypi.org/legacy/ dist/*
两者运行都很好,没有错误/警告...
% pip install -i https://test.pypi.org/simple/ project_name==1.0
因此,我创建了一个virtualenv
环境并尝试安装:
% virtualenv test_env
% source test_env/bin/activate
% pip install -i https://test.pypi.org/simple/ project_name==1.0
出于某种原因,我首先得到了这个信息:
ERROR: Could not find a version that satisfies the requirement gcloud (from project_name==1.0) (from versions: none)
ERROR: No matching distribution found for gcloud (from project_name==1.0)
然后,在重试(未应用任何更改)以运行最后一个命令后,我得到了其他东西,我也得到了其他结果。那...怎么了?
simple/ project_name==1.0
Looking in indexes: https://test.pypi.org/simple/
Collecting project_name==1.0
Downloading https://test-files.pythonhosted.org/packages/08/38/b040820ceddc63a87596a5a29ce3a5d1b309555238d7ae063835e8c8ea8a/project_name-1.0-py3-none-any.whl (9.1 kB)
Collecting pyarrow
Downloading https://test-files.pythonhosted.org/packages/c1/82/04249512513b31d7cd9f6fa63cf0d1c64c4705da32e3c3ece9d676e235ff/pyarrow-1.0.1.tar.gz (1.3 MB)
|████████████████████████████████| 1.3 MB 594 kB/s
Installing build dependencies ... error
ERROR: Command errored out with exit status 1:
command: /Users/username/Desktop/testenv/bin/python /Users/username/Desktop/testenv/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /private/var/folders/rp/xxjnjsvn70g2ndh68l0g10bh0000gn/T/pip-build-env-cnc0ds0l/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://test.pypi.org/simple/ -- 'cython >= 0.29' 'numpy==1.14.5; python_version<'"'"'3.7'"'"'' 'numpy==1.16.0; python_version>='"'"'3.7'"'"'' setuptools setuptools_scm wheel
cwd: None
Complete output (4 lines):
Looking in indexes: https://test.pypi.org/simple/
Ignoring numpy: markers 'python_version < "3.7"' don't match your environment
ERROR: Could not find a version that satisfies the requirement cython>=0.29 (from versions: 0.23.4)
ERROR: No matching distribution found for cython>=0.29
----------------------------------------
ERROR: Command errored out with exit status 1: /Users/username/Desktop/testenv/bin/python /Users/username/Desktop/testenv/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /private/var/folders/rp/xxjnjsvn70g2ndh68l0g10bh0000gn/T/pip-build-env-cnc0ds0l/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://test.pypi.org/simple/ -- 'cython >= 0.29' 'numpy==1.14.5; python_version<'"'"'3.7'"'"'' 'numpy==1.16.0; python_version>='"'"'3.7'"'"'' setuptools setuptools_scm wheel Check the logs for full command output.
注意:该软件包很好,我可以将其安装在我的mbp的系统解释器(python3.8)上,但这是因为所有依赖项numpy
,{ {1}} ...已安装。
解决方法
我认为这是因为pip在https://test.pypi.org/simple/
中寻找不存在的程序包相关性。
尝试:
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple your-package
这将从test.pypi
中提取您的包裹,但是当pip无法在其中找到依赖项时,便退回常规pypi
。