Reputation: 505
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?
Upvotes: 4
Views: 5949
Reputation: 1104
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.
Upvotes: 4
Reputation: 31
You may Try this instead:
python -m twine upload -r pypitest dist/packagename-0.1.2.tar.gz
Upvotes: 2
Reputation: 160
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
Upvotes: 4
Reputation: 867
You have to include your python scripts path as an environment variable in your user variables, besides the variable named "Path". This will make the things work perfectly for you as the twine gets installed within the scripts and so it must be passed to the environment variables, to access twine from any directory.
Upvotes: 0