Installing PIP Modules - python

I am having trouble installing any PIP module.
Steps/Precautions I have taken:
I uninstalled Python and downloaded the most recent Python 3.6.2.
PIP seems to be installed already C:\Users\Danc2>C:\Users\Danc2\AppData\Local\Programs\Python\Python36-32\scripts\pip3.6 (also included are files: pip, pip3).
pip install pyperclip returns
'pip' is not recognized as an internal or external command, operable program or batch file.
In using many different forums and typing commands into CMD I come up with results like: "'pip' is not recognized as an internal or external command,
operable program or batch file."
When trying to refer to my folder location: "C:\Users\Danc2>C:\Users\Danc2>C:\Users\Danc2\AppData\Local\Programs\Python\Python36-32\scripts
Access is denied."
Sorry for the common question, but I just cannot figure it out for my individual problem. I appreciate any kind effort to help.
Daniel.

I think you should restart your computer. If that doesn't work, go to Control Panel -> System -> Advanced Settings -> Environment Variables.
In the system variables you should go to Path and add the folder containing the pip.exe to your path.

If your Python installation works at all with the command line, then replacing pip with python -m pip in the command line is likely to fix the issue for you.

Thanks for all the help, guys. Between your answers and another post, I figured it out.
Apparently, my installation location (and program files) for Python was preventing me from installing pyperclip. I bypassed this issue by running CMD as an administrator (see Stack Article .I will still reinstall elsewhere.
Cheers,
Daniel.

Related

Everytime i try to install Django using "pip install django" on my command prompt why does this come up?

pip install Django
'pip' is not recognized as an internal or external command,
operable program or batch file.
Well, this is an error you'll have to face multiple times in the future. It's pretty self-explanatory. It means that 'pip' does not exist in your system. To fix this either: 1. Reinstall python (using the installer) and make sure that you've checked the 'pip' checkbox OR 2. Download 'pip.exe' manually and then add it to 'PATH'.
To expand on what Tony has said. you should either reinstall python but since you are trying to use pip already. I am going to guess you already have python and if you do then find the python location (default should be: C:\program files (x86)\Python3\bin) and then add to path.

Problem running auto py to exe from terminal [duplicate]

I have python 3.9 I used the command 'pip install auto-py-to-exe' and it downloaded but when I tried to using the command 'auto-py-to-exe' the program just said " 'auto-py-to-exe' is not recognized as an internal or external command, operable program or batch file.". I have the latest version of PIP and I also have PATH. What can I do to fix this?
This works on VSCode:
python -m auto_py_to_exe
If I install "auto-py-to-exe" using following command, as described in this link as well as from the comment from Justin Ezequiel (above):
python -m pip install auto-py-to-exe
I am able to run it (in Windows 10) using following command:
python -m auto_py_to_exe
This gave me quite a bit of trouble, as none of the above solutions worked for me. Spent lots of time trying to figure out what I should be adding to PATH with no success.
My issue stemmed from (I think) the fact that I have been using python downloaded from the windows store, which uses a different location to store python in.
With the manual install of python (https://www.python.org) you can specify where python is downloaded and automatically add that location to path.
Steps I took to solve the problem:
Uninstall all versions of python downloaded from the windows store via settings (settings > apps > python > uninstall)
Uninstall all version of python via the control panel (control panel > add or remove programs > python x.x.x > uninstall)
Uninstall auto-py-to-exe (pip uninstall auto-py-to-exe) in case it didnt do that automatically
Install python from python.org. (auto-py-to-exe is not supported in versions greater than 3.10 as of 1/23/2023). So I installed Python 3.10
The settings which were successful for me were:
Custom installation,
check install python for all users,
check add to path,
input 'C:\Python310' (with the respective version number) for install location,
install
Check new python version has been installed python --version
Check pip is installed pip --version
Install auto-py-to-exe pip install auto-py-to-exe
When auto-py-to-exe finishes installing, scroll up through the install info and make sure there are no warnings that state there is a location not found in PATH. If there are, you'll have to do some other research on adding those locations to PATH appropriately (since I don't think I was doing that right).
Assuming no PATH warnings,
9. Run auto-py-to-exe
First you need to type in the terminal (not Python):
auto-py-to-exe
If you are currently in python use exit() to exit then try the above code.
It Depends on in which environment you have installed
Make sure to replace {User} with your user
In Conda Enviournment go to below location Manually
C:\Users\{User}\anaconda3\Scripts\auto-py-to-exe.exe
In Pip, Environment go to the location below
C:\Users\{User}\AppData\Local\Programs\Python\Python37-32\Scripts\auto-py-to-exe.exe
or you can add this path to your environment variable as well for accessing these from anywhere
First check you installed it
pip install auto-py-to-exe
then restart your vscode and check another time.
If still an error, check it in CMD.
As suggested above use:
pip show --files auto-py-to-exe to find out in what directory pip has
installed the scripts. Double check the directory is in %PATH%
This will show you where the installer has placed the binary files. I then changed to that directory which circumvents any path issue. I tried to run the files and found :
OSError: [WinError 1920] The file cannot be accessed by the system: 'C:\\Users\\aaaa\\AppData\\Local\\Microsoft\\WindowsApps\\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\\python.exe'
PS C:\users\aaaa\appdata\local\packages\pythonsoftwarefoundation.python.3.7_qbz5n2kfra8p0\localcache\local-packages\python37\Scripts>
In my case, although I haven't worked out how to fix it yet... It would seem to be trying to refer to an incorrect Python executable, the files in that directory are all 0 length. Unfortunately the "python -m" suggestion didn't work for me, so it's back to the drawing board. Hope that helps you confirm if it's the right solution to chase down.
You need to make sure you have typed cd C:\Users\your_user_name\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\Scripts as a separate command, and then auto-py-to-exe with python 3. Check in file explorer to make sure your path is correct if the cd fails.

'pip' is not recognized after trying to upgrade it in pycharm

Pip was working fine. I used it through the terminal in pycharm to install various packages. Pycharm told me to upgrade pip using a pip command. After doing so an error was thrown out. And now I get the message "ModuleNotFoundError: No module named 'pip'" in pycharm and the message "'pip' is not recognized as an internal or external command,
operable program or batch file." in cmd. From what I have read it is because I used a different terminal and it wasn't located in the right place. The fix apprently, use get-pip.py. After trying this, it still doesn't work. I'm not very clued up on how this all works, any help is greatly appreciated!
Try adding pip to your path.
For Windows there is a simple step by step tutorial on YT:
https://www.youtube.com/watch?v=UTUlp6L2zkw
Or have a look here:
https://windowsreport.com/pip-not-recognized/

What does it mean to be "on path" while installing Python packages?

I was installing a pylint version for Django and the tutorial states:
Ensure pylint-django is installed and on your path and then execute:
pylint --load-plugins pylint_django [..other options..]
I initially installed pylint using $pip install pylint. But when I execute $pylint --load-plugins pylint_django it throws up an error saing that 'pylint' is not recognized as an internal or external command,
operable program or batch file.
Why is this happening?
There are two questions here. One is what is PATH and why is it needed, the other is why is pylint not working and although related they have different answers. I will explain both.
First you have to understand the concept of PATH. Whenever you type a command(let's say you typed command) in cmd in Windows or in a terminal in MacOS or Linux OS, what you are really saying is execute a program with the name command.
Now the OS cannot possibly look at all the secondary storage devices to find a program with the same name. That would take a long time and there might be multiple programs with the same name. So, it has a list of directories where it looks for that program. This list of directories are known as the PATH.
If you are executing the command pylint then you are telling Windows to run a program of the name pylint that exists in one of the directories in the PATH. Windows tries to do that but can't find anything that exists with that name in its list of PATH directories. So, it gives you that error. You can see your windows PATH like explained here.
All python modules are added in the same directory that should exist in the PATH already. So the reason pylint command is not working is probably something else.
The other problem is why pylint is not working. I think the reason for that is you should execute
pip install pylint-django
and not
pip install pylint

Pip Python Installation Issues

I'm pretty new to the community, and new to python. I know the basics. But now I'm trying to download third party modules via pip but everything I do regarding pip displays an error. I know that pip comes with python seeing as the pip file is there.
I am running python 3.6 and windows 10. I have downloaded pip off the internet also but when I try to run the program it says already downloaded. The first time I ran it it said that it was downloading and successfully downloaded so I'm kind of lost.
Thanks!
Sounds like it's already properly installed. pip is a program called from a system terminal, not from a Python prompt. Open up a command prompt and type pip -h see what happens. If this does not print out the help page on how to use pip, and instead you get an error to the effect of:
"pip" is not recognized as an internal or external command, operable program or batch file
You then need to point Windows where to find the program (pip.exe) by adding your Python scripts folder C:\...\Python36-32\Scripts\ to your environment PATH variable. To do this, open the Start menu and search for "environment variables". Open the dialogue and find one named PATH (case doesn't matter). If it doesn't exist, create it. Edit the value and add the file path to the scripts folder to the end using ; as a separator.
As per your comment, if you are getting an access denied windows error this answer from another question may help you.
You need need to be sure either your powershell is being run as administrator, or by creating a virtual environment.
The Installing Packages docs have a great overview, and instructions.
https://packaging.python.org/installing/#use-pip-for-installing

Categories