Search code examples
pythonpython-3.xpackagepypitwine

Can't upload to PyPI with twine ("invalid command")


I'm trying to upload my package to PyPI using twine. I've followed the official documentation and I'm getting stopped at this step: twine upload dist/* I don't have errors on any previous steps, and I've been using python3 instead of python (so all previous steps have used python3 or pip3)

$ twine upload dist/*
Invalid command: upload

$ which twine
/usr/local/bin/twine

$ twine --version
Twine version 1.0.1

$ which python3
/usr/local/bin/python3

Turns out I have a different twine installed, this one, causing the error. How can I remove the currently installed twine and install the correct PyPi Twine?

Update 1 I've removed the other version of twine. I ran pip3 install twine and it gave a lot of lines of Requirement already satisfied: twine in /Users/..... but if I run twine --version I get -bash: twine: command not found


Solution

  • Do you have something else in your $PATH which matches twine, and so it might be using this instead of the PyPi Twine?

    $PATH is searched from beginning to end, with the first matching executable being run. So directories at the beginning of $PATH take precedence over those that come later.