I have a Python package that I am trying to register on PyPI. I am trying to do this with the latest version of twine (1.9.1) and following the instructions on the twine webpage.
I have my package correctly configured locally. (setup.py
is complete and all that.) The name has not been claimed on PyPI. I have an account on PyPI. I don't have a ~/.pypirc
file on my machine. I have built a source distribution and a wheel.
> ll dist
total 64
-rw-r--r-- 1 billmcn staff 14184 Aug 1 13:35 mycroft-1.1.0.tar.gz
-rw-r--r-- 1 billmcn staff 15996 Aug 1 13:36 mycroft-1.1.0-py3-none-any.whl
When I try to register either of these packages I get the following error message.
> twine register dist/mycroft-1.1.0.tar.gz
Registering package to https://upload.pypi.org/legacy/
Enter your username: billmcn
Enter your password:
Registering mycroft-1.1.0.tar.gz
HTTPError: 410 Client Error: Project pre-registration is no longer required or supported, so continue directly to uploading files. for url: https://upload.pypi.org/legacy/
I get the same error message when I try to register the wheel file. This makes me think this registration step is unnecessary. However, when I try to upload my packages I see this.
> twine upload dist/*
Uploading distributions to https://upload.pypi.org/legacy/
Enter your username: billmcn
Enter your password:
Uploading mycroft-1.1.0-py3-none-any.whl
[================================] 23132/23132 - 00:00:00
HTTPError: 403 Client Error: You are not allowed to upload to 'mycroft'. for url: https://upload.pypi.org/legacy/
Which looks like the error you get if you have failed to register your packages before trying to upload them. I don't see my package when I browse for it on the PyPI site. So I'm stuck.
That https://upload.pypi.org/legacy/ looks a little suspicious to me. Am I supposed to be specifying some other URL?
How do I register my package?
This looks similar to Uploading package to pypi using twine: Invalid URI. The issue there was that the person had an invalid url
keyword argument in their setup.py:setup
function. However, my URL is the project's github page, https://github.com/wpm/mycroft, and is correct.
I see the same problem if I have the following ~/.pypirc
file:
[distutils]
index-servers =
pypi
pypitest
[pypi]
username=billmcn
password=********
[pypitest]
username=billmcn
password=********
Various attempts to manually specify the upload URL.
twine upload dist/* -r https://pypi.python.org/pypi
KeyError: Missing 'https://pypi.python.org/pypi' section from the configuration file
or not a complete URL in --repository.
Maybe you have a out-dated '~/.pypirc' format?
more info: https://docs.python.org/distutils/packageindex.html#pypirc
The --help
text says twine should be able to figure out whether I'm specifying a repository name or URL, but let's be explicit.
> twine upload dist/* --repository-url https://pypi.python.org/pypi
Uploading distributions to https://pypi.python.org/pypi
Note: you are uploading to the old upload URL. It's recommended to use the new URL "https://upload.pypi.org/legacy/" or to leave the URL unspecified and allow twine to choose.
Enter your username: billmcn
Enter your password:
Uploading mycroft-1.1.0-py3-none-any.whl
HTTPError: 410 Client Error: Gone (This API has been deprecated and removed from legacy PyPI in favor of using the APIs available in the new PyPI.org implementation of PyPI (located at https://pypi.org/). For more information about migrating your use of this API to PyPI.org, please see https://packaging.python.org/guides/migrating-to-pypi-org/#uploading. For more information about the sunsetting of this API, please see https://mail.python.org/pipermail/distutils-sig/2017-June/030766.html) for url: https://pypi.python.org/pypi
So I should be using the "new" URL https://upload.pypi.org/legacy/?
> twine upload dist/* --repository-url https://upload.pypi.org/legacy/
Uploading distributions to https://upload.pypi.org/legacy/
Enter your username: billmcn
Enter your password:
Uploading mycroft-1.1.0-py3-none-any.whl
HTTPError: 403 Client Error: You are not allowed to upload to 'mycroft'. for url: https://upload.pypi.org/legacy/
I'm stumped. And I can't find any official source for the current correct URL.
And I'd like to get twine working because the Python documentation recommends against using python setup.py register
and python setup.py upload
.
I tried this anyway and ran into what looks like the same problem.
> python setup.py register
running register
running egg_info
writing mycroft.egg-info/PKG-INFO
writing dependency_links to mycroft.egg-info/dependency_links.txt
writing entry points to mycroft.egg-info/entry_points.txt
writing requirements to mycroft.egg-info/requires.txt
writing top-level names to mycroft.egg-info/top_level.txt
reading manifest file 'mycroft.egg-info/SOURCES.txt'
writing manifest file 'mycroft.egg-info/SOURCES.txt'
running check
We need to know who you are, so please choose either:
1. use your existing login,
2. register as a new user,
3. have the server generate a new password for you (and email it to you), or
4. quit
Your selection [default 1]:
Username: billmcn
Password:
Registering mycroft to https://upload.pypi.org/legacy/
Server response (410): Project pre-registration is no longer required or supported, so continue directly to uploading files.
and
> python setup.py sdist bdist_wheel upload
...builds the packages...
running upload
Password:
Submitting dist/mycroft-1.1.0.tar.gz to https://upload.pypi.org/legacy/
Upload failed (403): You are not allowed to upload to 'mycroft'.
error: Upload failed (403): You are not allowed to upload to 'mycroft'.
Opened PyPI issue #677.
twine upload dist/* -r https://pypi.python.org/pypi
– Mike Driscoll