I get this error when uploading files:
[================================] 357045/357045 - 00:00:00
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
Did you read the URL in the error message that tells you how to point your twine to the new uploading endpoint and is that not working for you?
I did upload it successfully with python3 setup.py ... upload (without any changes)
It seems as though your configuration is mildly broken in hard-coding the old URL for PyPI uploads. Twine is not broken, although we could probably do something and detect (in newest version(s) only) if you're trying to use Legacy PyPI for uploads.
I flagged this on stackoverflow, but thought it might be helpful to share here as well...
I followed the official documentation for uploading packages to PyPI, as well as the information provided in PyPI readme, but I get a HTTP 400 error each time:$ twine upload dist/*
Uploading distributions to https://upload.pypi.org/legacy/
Enter your username: bradaallen
Enter your password:
Uploading brad_nlp_helpers-0.1.1-py3-none-any.whl
HTTPError: 400 Client Error: home_page: Invalid URI for url:
https://upload.pypi.org/legacy/
I am using a ~/.pypirc
[distutils]
index-servers =
pypi
pypitest
[pypi]
username=bradaallen
password=[password]
[pypitest]
username=bradaallen
password=[password]
For packages, I am using聽twine version 1.9.1 (pkginfo: 1.4.1, requests: 2.12.4, setuptools: 27.2.0, requests-toolbelt: 0.8.0, tqdm: 4.14.0)
When I use聽python setup.py sdist bdist_wheel upload聽I get the same issue:
Submitting dist\brad_nlp_helpers-0.1.1.tar.gz to
https://upload.pypi.org/legacy/ Upload failed (400): home_page: Invalid URI
error: Upload failed (400): home_page: Invalid URI
I have not specified the repository, as that is recommendation that is given by the API when uploading. I am seeing a聽404 error聽at the link that PyPI recommends and am not seeing an alternative site I should use!This is my first package, and I am not seeing this error elsewhere on the internet. Any thoughts re: what's going on?
HTTPError: 400 Client Error: home_page: Invalid URI for url:
This indicates that your package contains an incorrect URI value ("") for the home_page field. This (usually) comes from the url argument passed to setup in your setup.py.
Sorry, I think I take that back. I was looking at my checkout of the old webui.py code for pypi.python.org for this, but I forgot that doesn't handle this anymore. I'm not familiar with warehouse uploading yet.
i am seeing similar trying to update two packages i have had up for a while on pypi - sba and argus. when i did old python setup.py upload i got errors saying the site had moved to pypi.org; when i made the changes to .pypirc and switched to twine i get the same error messages as the original poster. i do't think it's the home page in the setup.py - on mine that is and has always been the bitbucket or github pages for the code rcs repository...
In both I get the sense that home_page is https://upload.pypi.org/legacy/ - which is the recommended URL at both PyPI and Twine documentation (and through the API).
There aren't any alternative URIs in the documentation, which is confusing for me. I thought it might just be new projects being registered, but @devangel77b makes it seem like it might be a more global issue?
both packages i am trying to update i had registered previously on the old pypi.python.org and they have been there for some time. i get similar problems for both packages and on a few different machines, and when i tried to clone the example package and then do my own testpypi one.
I think there's some confusion here, because there are two URLs at play. One is the URL you're uploading to, which from the error message appears that you've gotten correct (https://upload.pypi.org/legacy/). So that's good, you're uploading to Warehouse!
The flip side here is that Warehouse has gotten stricter about some things, and once is validating that if your metadata includes a home page URL, that it is, in fact, a valid home page URL and not something that doesn't make sense as an URL. I suspect if you look at your setup() kwargs, you'll locate in them a url="..." line kwarg that is passing something into it that isn't a valid URL (alternatively, the error could be that you're passing a valid URL and there is a bug in Warehouse's URL validation routine).
For an example of the metadata I'm talking about, take a look a pip's setup.py#L61. You can see our value there is "https://pip.pypa.io/", which is a valid URL and thus passes the new, stricter validation checks.
That was exactly it!! Thank you so much. By the way, the URL was for my _personal website_, but did not contain any code related to the package.
I just ran into the issue. I had the URL in setup.cfg instead of setup.py.
Is it an expected behaviour to ignore the URL when defined in setup.cfg?
Maybe related: https://github.com/pypa/setuptools/pull/862
@lrntct I'm sorry you had that trouble! I'm going to bring this up in pypa/packaging-problems#29 because I think this is a policy question first, then an implementation question. Thanks for the report.
Most helpful comment
I think there's some confusion here, because there are two URLs at play. One is the URL you're uploading to, which from the error message appears that you've gotten correct (
https://upload.pypi.org/legacy/). So that's good, you're uploading to Warehouse!The flip side here is that Warehouse has gotten stricter about some things, and once is validating that if your metadata includes a home page URL, that it is, in fact, a valid home page URL and not something that doesn't make sense as an URL. I suspect if you look at your
setup()kwargs, you'll locate in them aurl="..."line kwarg that is passing something into it that isn't a valid URL (alternatively, the error could be that you're passing a valid URL and there is a bug in Warehouse's URL validation routine).