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

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

Related

Unable to update PATH variable for pip on Windows 10

I know there are thousands of similar topics but my pip command has suddenly stopped to work and, despite all my researchs, I can't figure out why. It has been a while since I last used pip and surprisingly my computer doesn't recognize the command anymore. I reinstalled pip and the prompt tells me that the PATH variable is not correctly updated. So I update it but that doesn't solve the problem, the prompt still tells me the PATH variable is not updated. I've tried uninstalling and reinstalling python and pip and nothing works.
In my environment variables, I have a user variable named PATH and a system variable named PATH, both of them have the value :
C:\Users\mertz\AppData\Local\Programs\Python\Python38\Scripts\
The user variable was already written by itself and I had to write the system variable myself.
When I'm installing pip I get this warning :
WARNING: The scripts pip.exe, pip3.6.exe and pip3.exe are installed in 'C:\Users\mertz\AppData\Local\Programs\Python\Python36-32\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
And when I type pip in the command prompt, it tells me that pip is not recognized.
What did I do wrong ?
Thanks in advance
I had a similar problem, at one time: I could only use administrative privileges to use python cmd or pip easy_install.
PLEASE follow these procedures:
Get to your environmental variables by pressing window + r and type-in, sysdm.cpl and click ok.
Copy the pip link directory to the script folder in python,
but first check for pip, pip3, easy_easy, etc.
If it doesn't contain pip, you have to uninstall python and delete the folder, and then reinstall python.
i.e
C:\Users\mickeymouse\AppData\Local\Programs\Python\Python38-32\Scripts.
You will see user variables and system variables.
(user variables are applied for only that user's account; system variable are applied to all accounts on the pc).
Create a path for both, then restart cmd.
I'm not a specialist in Pip or Python, but I faced a similar problem and used a different procedure.
I believe Pip cached directories depend on user permissions during installation and update.
At first, the Pip installer defaults to the Python home directory for caching files. If such a directory is unreachable, the installer creates a cached directory inside the current user's home directory.
Since Python includes Pip by default, the issue reported should not happen at the first install, yet it is due to trying to run the update without administrative privileges.
If that is the case, you could try the following steps:
Assert the system PATH has proper Python directories assigned, e.g.:
C:\Program Files\Python310\ for Python executable files;
C:\Program Files\Python310\Scripts\ for Python scripts and extensions.
Remove Pip's registered cached directories using the command py -m pip cache purge.
Search for and remove any Pip content outside the Python subdirectory. For example, you could check for contents such as [user home directory]\.pip and [user home directory]\pip.
Remove Pip references from the system and the user PATH variables.
Open Windows Terminal with administrator privileges and rerun the Pip installer command. You should not use the --no-warn-script-location option, or else you will not be able to see if there is any unexpected behavior.
Finally, to my knowledge, Pip's documentation lacks a consistent reference for directory options. Anyway, the following links provided me with some clarity:
Pip general reference:
https://pip.pypa.io/en/stable/
On Pip caching strategies:
https://pip.pypa.io/en/stable/topics/caching/
On Pip caching problems, including older versions:
https://www.techiediaries.com/python-pip-local-cache/
All the best!

Installing PIP Modules

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.

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

How do I install PySpeech for Python 3?

So far I've downloaded and installed distribute and pywin32, however I don't understand how to install PySpeech itself. The directions say to " browse to the folder that you extracted pyspeech-0.5.2.zip to and run the following in the command prompt:
'/python32/python speech.py install' or 'python speech.py install'".
I extracted pyspeech to the desktop and tried both of the above commands in the command prompt. This did not work as I got the following error: "'python' is not recognized as an internal or external command, operable program or batch file." Obviously I'm missing something. Can someone please tell me what I'm doing wrong and how to remedy the situation?
I suspect the issue lies in the "browse to the folder that you extracted..." portion of the directions, as I don't know how that ties into the process. Moreover, forgive my naivete because I've never installed something via command prompt.
You need to add python to your PATH environment variable. See here for instructions, and then you will need to run python.exe setup.py install or whatever (note the .exe).

Cannot install xlrd 0.7.8 for python 2.7.3

I can't find anything around for current versions around, but my issue is exactly as the title says. Python is installed and working, but when I tried using the instructions listed on to install xlrd (open cmd at the setup directory, then enter "python setup.py install"), but this gives me an error saying that the command python doesn't exist. Double clicking the setup file doesn't work, the black cmd box flashes on the screen rapidly, without time to read what it says and without installing any files in the directories they should be in.
Also, as it may be relevant, I don't have permissions on this computer to install programs (the IT dept had to install python and N++ for me...). I don't know if this counts as a software installation that requres elevation, as far as Windows 7 is concerned.
Any help would be great.
If your command interpreter tells you the "command python doesn't exist" whereas it is installed it means it is not in your PATH environment variable.
Here is a little tutorial on how to do this on windows 7: http://www.windows7hacker.com/index.php/2010/05/how-to-addedit-environment-variables-in-windows-7/
Add the path where your python.exe is. Usually something like C:\Python27

Categories