2

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

singmotor
  • 3,930
  • 12
  • 45
  • 79

1 Answers1

2

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.

Ed Harrod
  • 3,423
  • 4
  • 32
  • 53
  • I don't think so, but I'll take a look! – singmotor Mar 15 '18 at 20:41
  • @singmotor you can try moving twine to the start of your $PATH to see if this fixes it – Ed Harrod Mar 16 '18 at 11:07
  • Ahhh looks like the twine I'm getting is this https://github.com/scelis/twine how can I overwrite that one with the pipit twine? – singmotor Mar 16 '18 at 23:13
  • 1
    @singmotor you have to either reorder your $PATH so that the folder containing the PyPi Twine is above the "scelis" Twine, or you can remove the "scelis" folder from your $PATH altogether – Ed Harrod Mar 19 '18 at 10:33
  • @singmotor If you managed to get it working with my suggestion, please can you mark the answer as accepted? – Ed Harrod Mar 21 '18 at 16:24
  • 1
    ECH will do, sorry for the delay, but I haven't actually had time to try implementing this yet. I won't forget the question and will mark it as accepted once I've tried this! – singmotor Mar 21 '18 at 21:20
  • I still haven't had luck. You've answered the first part of my question, but the second part "install the correct PyPi Twine" still eludes me. 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` – singmotor Mar 29 '18 at 00:36
  • 1
    I figured out the above. I needed to upload the python3 twine. So had to upgrade pip3 with `pip3 install --upgrade pip` and then twine with pip3 install twine. Then all worked! – singmotor Apr 15 '18 at 20:11
  • 1
    @singmotor Glad you got it sorted! – Ed Harrod Apr 16 '18 at 10:56