Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Issue uploading a Python package to Pypi using Windoes 10 - twine is not recognized as an internal or external commend

I have been trying to upload a Python package to Pypi. I have been following a couple of different guides. I have install twine using

 pip install twine

And it doesn't show any problem:

Requirement already satisfied: twine in 
c:\users\amirh\appdata\roaming\python\python36\site-packages (1.11.0)
Requirement already satisfied: setuptools>=0.7.0 in 
c:\users\amirh\appdata\roaming\python\python36\site-packages (from twine) 
(40.0.0)
Requirement already satisfied: tqdm>=4.14 in 
c:\users\amirh\appdata\roaming\python\python36\site-packages (from twine) 
(4.23.4)
Requirement already satisfied: pkginfo>=1.4.2 in c 
:\users\amirh\appdata\roaming\python\python36\site-packages (from twine) ( 
1.4.2)
Requirement already satisfied: requests!=2.15,!=2.16,>=2.5.0 in 
c:\users\amirh\appdata\roaming\python\python36\site-packages (from twine) 
(2.19.1)
Requirement already satisfied: requests-toolbelt>=0.8.0 in 
c:\users\amirh\appdata\roaming\python\python36\site-packages (from twine) 
(0.8.0)
Requirement already satisfied: urllib3<1.24,>=1.21.1 in 
c:\users\amirh\appdata\roaming\python\python36\site-packages (from 
requests!=2.15,!=2.16,>=2.5.0->twine) (1.23)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in 
c:\users\amirh\appdata\roaming\python\python36\site-packages (from 
requests!=2.15,!=2.16,>=2.5.0->twine) (3.0.4)
Requirement already satisfied: idna<2.8,>=2.5 in 
c:\users\amirh\appdata\roaming\python\python36\site-packages (from 
requests!=2.15,!=2.16,>=2.5.0->twine) (2.7)
Requirement already satisfied: certifi>=2017.4.17 in 
c:\users\amirh\appdata\roaming\python\python36\site-packages (from 
requests!=2.15,!=2.16,>=2.5.0->twine) (2018.4.16)   

When using any kind of twine functionality like

twine upload -r pypitest dist/packagename-0.1.2.tar.gz

I am getting "'twine' is not recognized as an internal or external command, operable program or batch file."" comment from the cmd.

I am using Windows 10. Should I create some sort of environment variable myself for twine?

like image 532
Randomizer Avatar asked Nov 15 '25 19:11

Randomizer


2 Answers

I got the same problem. And I am using Anaconda on windows 10, i.e., using Anaconda Prompt. After some searching, it is found that the twine.exe is located in the folder:

C:\Users\myname\AppData\Roaming\Python\Python36\Scripts

From the output provided by you, I guess the twine.exe is located in your folder:

c:\users\amirh\appdata\roaming\python\python36\Scripts

Hence, you can add this folder path to your environment variable PATH: System Properties -> Environment Variables -> System variables -> PATH (Edit)

Then, reopen your Anaconda Prompt (or Command Prompt) and type

twine upload -r pypitest dist/packagename-0.1.2.tar.gz
like image 188
Ian Avatar answered Nov 18 '25 10:11

Ian


I had the same problem, but the problem was not solved by updating the environment variable PATH.

I am on Windows 10, Anaconda3 and Python 3.9. This tutorial helped me a lot with packaging up and updating the package:

Here is the command instead of twine upload -r pypitest dist/packagename-0.1.2.tar.gz.

First upgrade the twine

py -m pip install --user --upgrade twine

Then, run twine to upload all of the archives under dist, using the following command:

py -m twine upload --repository testpypi dist/*

See more in the tutorial I've referenced above.

like image 44
Maryam Bahrami Avatar answered Nov 18 '25 10:11

Maryam Bahrami



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!