Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Upload failed (403): Invalid or non-existent authentication information: Python

Tags:

python

I am trying to distribute a sample package. I am following the below mentioned steps:

1) python.exe setup.py register

Here I decide to use the existing login and provide my username and pssaword. I get this message:

enter image description here

2) python.exe setup.py sdist upload

But when I fire this I get the above mentioned error in the summary. enter image description here

This is my directory structure enter image description here

I am following the steps as mentioned in Head First Python book. Can some one please guide me? Am I missing some step?

I am also uploading my contents of my setup file. enter image description here

NOTE: I am a beginner in python and have just started learning it.

like image 684
user2796905 Avatar asked Jan 31 '26 23:01

user2796905


1 Answers

python setup.py register and python setup.py upload are deprecated. Do not use them.

Follow the instructions in the Python Packaging Guide:

  1. Create an account on PyPI if you haven't yet.
  2. Create the source distribution and wheels for your package: python setup.py sdist bdist_wheel
  3. Install twine (or make sure you have version 2.0 or newer): pip install twine
  4. Check your distribution files for errors: twine check dist/*
  5. (Optional) Upload to the PyPI test server first (note: separate user registration required): twine upload --repository-url https://test.pypi.org/legacy/ dist/*
  6. Upload to PyPI: twine upload dist/*

To save typing your PyPI credentials, create $HOME/.pypirc with the following contents:

[pypi]
username = <username>
password = <password>

Note: your password will be stored in plain text!

like image 79
kynan Avatar answered Feb 03 '26 12:02

kynan