I'm trying to upload my package to PyPi and came up with this error:
Traceback (most recent call last):
File "setup.py", line 11, in <module>
author_email= #my email,
File "C:\Programming\Python\Anaconda\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\Programming\Python\Anaconda\lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "C:\Programming\Python\Anaconda\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Programming\Python\Anaconda\lib\distutils\command\upload.py", line 63, in run
self.upload_file(command, pyversion, filename)
File "C:\Programming\Python\Anaconda\lib\distutils\command\upload.py", line 73, in upload_file
raise AssertionError("unsupported schema " + schema)
Since python setup.py register -r pypitest
is no longer needed to upload the package, I run this command: python setup.py sdist upload -r pypitest
, and the error comes in after I type in my password for pypitest
Here is how my setup.py
and .pypirc
files looks like.
setup.py
from setuptools import setup
setup(
name='instapi',
packages=['instapi'],
version='0.1',
description='Clean and simple Instagram API for Python 3.x',
url='https://github.com/SemptraStar/instapi',
download_url = 'https://github.com/SemptraStar/instapi/archive/v._0.1.tar.gz',
author= #me,
author_email= #also me,
)
.pypirc
[distutils]
index-servers =
pypi
pypitest
[pypi]
repository=https://pypi.python.org/pypi
username= # username
password= # password
[pypitest]
repository=https://testpypi.python.org/pypi
username= # username
password= # password
UPDATE 1
I changed repository URL's to https://upload.pypi.org/legacy/
for pypi and https://test.pypi.org/legacy/
for pypitest. Also updated setuptools for the latest version (36.3.0). Nothing changed.
在主目录C:\\Users\\<username>
添加.pypirc
文件,除了从项目的根目录,对我.pypirc
。
What you need to do is use twine. Make sure the version is 1.8+
pip install twine
python setup.py sdist
.twine upload --repository pypitest dist/*
for your test upload.twine upload --repository pypi dist/*
for your production upload.Had the same issue and solved it by specifying where the .pypirc file is located. Per default, it is expected in ~./, but you might want to have it stored in your project.
This issue helped me here: Custom location for .pypirc file
I was having some trouble with those before as well, though I can't recall if it's the same exactly issue you are describing. The old URLs should redirect to the new, but PyPi has moved so there's a chance these won't always work.
Try this for pypi server:
https://upload.pypi.org/legacy/
And this one for pypitest:
https://test.pypi.org/legacy/
The official documentation of setuptools says
Uploading your package to PyPI
After generating the distribution files, the next step would be to upload your distribution so others can use it. This functionality is provided by twine and is documented in the Python packaging tutorial.
So I suppose no point in trying to debug setuptools upload issues. Build using setuptools and upload using twine.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.