Search code examples
pythonpypipython-poetry

Package Publishing (Python) failing through Poetry


I am new to this, trying to publish a package to pypi.org using Poetry package. on my local the build is working, I am able to import the package test run it, it's all good.

but when I try to publish it to pypi.org, I get below error - as per the article I was following Link, it was supposed to prompt me for my pypi account ID and password, but it doesn't and then gives the error:


Publishing gsst (0.2.2) to PyPI
 - Uploading gsst-0.2.2-py3-none-any.whl 0%
 - Uploading gsst-0.2.2-py3-none-any.whl 100%

and then this error shows up --

HTTP Error 403: Invalid or non-existent authentication information. See https://pypi.org/help/#invalid-auth for more information. | b'<html>\n <head>\n  <title>403 Invalid or non-existent authentication information. See https://pypi.org/help/#invalid-auth for more information.\n \n <body>\n  <h1>403 Invalid or non-existent authentication information. See https://pypi.org/help/#invalid-auth for more information.\n  Access was denied to this resource.<br/><br/>\nInvalid or non-existent authentication information. See https://pypi.org/help/#invalid-auth for more information.\n\n\n \n'

after i run the -- poetry publish command, the CLI should prompt me for pypi, ID and password. why does it skip it and then fails on authentication.


Solution

  • I was able to resolve the problem finally - Took help from poetry documentation here

    Issued the below command to setup my pypi.org account for auto authentication

    poetry config http-basic.pypi <username> <password>
    

    After that I ran the "poetry publish" command and was able to publish my package on pypi.org.

    It's really the quickest and easiest way to post your package to pypi.org