Why such an error occurs when using pip install to install the package? - python

WARNING: Ignoring invalid distribution -ip (d:\python_3.9.7\lib\site-packages) is displayed during the installation process
why does this appear?

This occurs due to files names with the '~' prefix in site-packages. Please remove those files / folders. It will solve your problem.
You can list them (linux, mac) with
ls -a /xx/xx/xx/lib/pythonx.x/site-packages | grep "^~"
on windows I would strongly recommend the linux subsystem for windows for this kind of actions. But of course this can also be done via the explorer or the cmd
Then remove files/folders prefixed by '~'.

Related

I do not know why I get the notification that pip is not on my computer [duplicate]

I'm running into a weird error when trying to install Django on my computer.
This is the sequence that I typed into my command line:
C:\Python34> python get-pip.py
Requirement already up-to-date: pip in c:\python34\lib\site-packages
Cleaning up...
C:\Python34> pip install Django
'pip' is not recognized as an internal or external command,
operable program or batch file.
C:\Python34> lib\site-packages\pip install Django
'lib\site-packages\pip' is not recognized as an internal or external command,
operable program or batch file.
What could be causing this?
This is what I get when I type in echo %PATH%:
C:\Python34>echo %PATH%
C:\Program Files\ImageMagick-6.8.8-Q16;C:\Program Files (x86)\Intel\iCLS Client\
;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\S
ystem32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\
Windows Live\Shared;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Progr
am Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\Program Files\Intel\Intel(R) Mana
gement Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine C
omponents\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components
\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\P
rogram Files (x86)\nodejs\;C:\Program Files (x86)\Heroku\bin;C:\Program Files (x
86)\git\cmd;C:\RailsInstaller\Ruby2.0.0\bin;C:\RailsInstaller\Git\cmd;C:\RailsIn
staller\Ruby1.9.3\bin;C:\Users\Javi\AppData\Roaming\npm
You need to add the path of your pip installation to your PATH system variable. By default, pip is installed to C:\Python34\Scripts\pip (pip now comes bundled with new versions of python), so the path "C:\Python34\Scripts" needs to be added to your PATH variable.
To check if it is already in your PATH variable, type echo %PATH% at the CMD prompt
To add the path of your pip installation to your PATH variable, you can use the Control Panel or the setx command. For example:
setx PATH "%PATH%;C:\Python34\Scripts"
Note:
According to the official documentation, "[v]ariables set with setx variables are available in future command windows only, not in the current command window". In particular, you will need to start a new cmd.exe instance after entering the above command in order to utilize the new environment variable.
Thanks to Scott Bartell for pointing this out.
For Windows, when you install a package, you type:
python -m pip install [packagename]
As of now, version 3.7.3 I had a little bit of an issue with getting the right system variable.
Try this:
Type start %appdata% in cmd.
After that file explorer should pop up in ../AppData/Roaming.
Go back one directory and navigate to Local/Programs/Python/Python37-32/Scripts.
NOTE: The version number may be different so if you copy and paste the above file path it could not work.
After you do this you now have the correct location of your downloaded Python. Copy your file path by selecting the whole directory in the address bar.
Once you do that click the start icon and navigate to the Control Panel → System and Security → System. Then click "Advanced System Settings" on the left side of the panel.
Once there, click Environment Variables on the bottom right and there will be two boxes, an upper and a lower box. In the upper box: Click on the 'Path' Variable and click Edit located on the right. Click New and paste your directory Path. It should look something like this:
Click OK three times, open a new window of cmd and type: pip. See if it works.
For me the command:
set PATH=%PATH%;C:\Python34\Scripts
worked immediately (try after echo %PATH% and you will see that your path has the value C:\Python34\Scripts).
Thanks to: Adding a directory to the PATH environment variable in Windows
Alternate way.
If you don't want to add the PATH as the previous well written answers pointed out,
but you want to execute pip as your command then you can do that with py -m as prefix.
Given that you have to do it again and again.
eg.
py -m <command>
as in
py -m pip install --upgrade pip setuptools
Also make sure to have pip and py installed
The only way that worked on my Windows 10 machine was as follows:
py -3 -m pip install xxxxx
Also, the long method - it was a last resort after trying all previous answers:
C:\python27\scripts\pip.exe install [package].whl
This after cd in directory where the wheel is located.
As per Python 3.6 Documentation
It is possible that pip does not get installed by default. One
potential fix is:
python -m ensurepip --default-pip
Control Panel -> add/remove programs -> Python -> Modify -> optional Features (you can click everything) then press next -> Check "Add python to environment variables" -> Install
And that should solve your path issues, so jump to command prompt and you can use pip now.
Go to control Panel >> Uninstall or change Program and double click on Python XXX to modify install. Make sure PIP component is checked and install.
I was having the same problem just now.
After adding the proper folder (C:\Python33\Scripts) to the path, I still could not get pip to run. All it took was running
pip.exe install -package- instead of
pip install -package-.
Try going to Windows PowerShell or cmd prompt and typing:
python -m pip install openpyxl
In latest version Python 3.6.2 and above, is available in
C:\Program Files (x86)\Python36-32\Scripts
You can add the path to our environment variable path as below
Make sure you close your command prompt or Git after setting up your path. Also should you open your command prompt in administrator mode. This is example for Windows 10.
Use
set Path = `%PATH%;C:\Python34\;C:\Python27\Scripts`
Source
Or if you are using PyCharm (2017-03-03) like me, just change directory in terminal and install:
cd C:\Users\{user}\PycharmProjects\test\venv\Scripts
pip install ..
Most frequently it is:
in cmd.exe write
python -m pip install --user [name of your module here without brackets]
Even I'm new to this, but pip install django worked for me.
The path should be set as where the script folder of the Python installation is, i.e.C:\Python34\Scripts.
I suppose it's because Django is a framework which is based on Python, and that's why this directory structure has to be maintained while installing.
I have just installed Python 3.6.2.
I got the path as
C:\Users\USERNAME\AppData\Local\Programs\Python\Python36-32\Scripts
In Windows, open cmd and find the location of PYTHON_HOME using where python. Now add this location to your environment variable PATH using:
set PATH=%PATH%;<PYTHON_HOME>\Scripts
Or refer to this.
In Linux, open a terminal and find the location of PYTHON_HOME using which python. Now add the PYTHON_HOME/Scripts to the PATH variable using:
PATH=$PATH:<PYTHON_HOME>\Scripts
export PATH
You can try pip3. Something like:
pip3 install pandas
I was facing the same issue. Run Windows PowerShell as Administrator. It resolved my issue.
None of these actually worked for me, but running
python -m pip install -U pip
and then adding the specified directory to the PATH as suggested got it working
In your Python folder path in Terminal, just type
py -m pip
in order to check the current version of your pip.
You will also see a list of commands, you can use...
I think from Python 2.7.9 and higher pip comes pre installed and it will be in your scripts folder.
So you have to add the "scripts" folder to the path. Mine is installed in C:\Python27\Scripts. Check yours to see what your path is so that you can alter the below accordingly. Then go to PowerShell, paste the below code in PowerShell and hit Enter key. After that, reboot and your issue will be resolved.
[Environment]::SetEnvironmentVariable("Path", "$env:Path;C:\Python27\Scripts", "User")
In a Windows environment, just execute the below commands in a DOS shell.
path=%path%;D:\Program Files\python3.6.4\Scripts;
(new path=current path;path of the Python script folder)
I deleted the older version using the control panel and then installed the new version however the newer version was not reflecting pip even after adding the right paths in the environment variables. However, the thing that worked for me was deleting the folders of old python that were there in the local App folder even after uninstall. For me, the path was like below. Deleting this folder solved my issue
C:\Users\username\AppData\Local\Programs\Python38
'pip' is not recognized as an internal or external command
pip is a python module used to install packages. For your problem, there can be many reasons;
Restart CMD/Terminal
Environment variable is not set. pip is installed but environment variable is not set. Environment variable is a windows variable where pip path is saved, so it can be run at run time.
pip is not installed.
Restart CMD/Terminal
It is sometimes possible that you opened your command prompt or terminal before installing pip and now it just needs a restart to pick up the latest environment variables. It is worth trying just restarting your command prompt or terminal.
Environment Variable is Not Set
Open CMD and run this command to see the values set in the PATH environment variable.
echo %PATH%
This will echo the PATH environment variable like this;
You should check if your path exist in the echoed PATH list. For example, in my case, the path for pip.exe files is C:\Python310\Scripts. You can check this path yourself like this;
If you can find pip path and it does not exist the echoed PATH variable, then we need to add it. Copy the path like C:\Python310\Scripts.
Go to Start > This PC > Properties > Advance system settings >
Advanced > Environment Variables
As shown in the image above, Select Path, click Edit button and add the copied path. Restart the CMD and test pip command again.
pip is Not Installed
If pip is not installed, you can install it again by downloading latest python.exe setup from python.org website. Make sure you check mark the pip option as shown in the image below.
In the next step, check mark "Add Python to environment variables"
I had this same issue. You just need to go to your
C:\Python27\Scripts
and add it to environment variables. After path setting just run pip.exe file on C:\Python27\Scripts and then try pip in cmd. But if nothing happens try running all pip applications like pip2.7 and pip2.exe. And pip will work like a charm.
Small clarification: in "Windows 7 64 bit PC", after adding ...Python34\Scripts to the path variable, pip install pygame didn't work for me.
So I checked the "...Python34\Scripts" folder, it didn't have pip, but it had pip3 and pip3.4. So I ran pip3.4 install pygame .... .whl. It worked.
(Further open a command window in the same folder where you have the downloaded pygame...whl file.)
When installing SQL 2019 Python, there are known issues for PIP which require a fix (step 7)
https://learn.microsoft.com/en-us/sql/advanced-analytics/known-issues-for-sql-server-machine-learning-services?view=sql-server-ver15
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Workaround
Copy the following files:
libssl-1_1-x64.dll
libcrypto-1_1-x64.dll
from the folder
C:\Program Files\Microsoft SQL Server\MSSSQL15.MSSQLSERVER\PYTHON_SERVICES\Library\bin
to the folder
C:\Program Files\Microsoft SQL Server\MSSSQL15.MSSQLSERVER\PYTHON_SERVICES\DLLs
Then open a new DOS command shell prompt.

'pip' is not recognized as an internal or external command (i tried adding pip to my path) [duplicate]

I'm running into a weird error when trying to install Django on my computer.
This is the sequence that I typed into my command line:
C:\Python34> python get-pip.py
Requirement already up-to-date: pip in c:\python34\lib\site-packages
Cleaning up...
C:\Python34> pip install Django
'pip' is not recognized as an internal or external command,
operable program or batch file.
C:\Python34> lib\site-packages\pip install Django
'lib\site-packages\pip' is not recognized as an internal or external command,
operable program or batch file.
What could be causing this?
This is what I get when I type in echo %PATH%:
C:\Python34>echo %PATH%
C:\Program Files\ImageMagick-6.8.8-Q16;C:\Program Files (x86)\Intel\iCLS Client\
;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\S
ystem32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\
Windows Live\Shared;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Progr
am Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\Program Files\Intel\Intel(R) Mana
gement Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine C
omponents\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components
\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\P
rogram Files (x86)\nodejs\;C:\Program Files (x86)\Heroku\bin;C:\Program Files (x
86)\git\cmd;C:\RailsInstaller\Ruby2.0.0\bin;C:\RailsInstaller\Git\cmd;C:\RailsIn
staller\Ruby1.9.3\bin;C:\Users\Javi\AppData\Roaming\npm
You need to add the path of your pip installation to your PATH system variable. By default, pip is installed to C:\Python34\Scripts\pip (pip now comes bundled with new versions of python), so the path "C:\Python34\Scripts" needs to be added to your PATH variable.
To check if it is already in your PATH variable, type echo %PATH% at the CMD prompt
To add the path of your pip installation to your PATH variable, you can use the Control Panel or the setx command. For example:
setx PATH "%PATH%;C:\Python34\Scripts"
Note:
According to the official documentation, "[v]ariables set with setx variables are available in future command windows only, not in the current command window". In particular, you will need to start a new cmd.exe instance after entering the above command in order to utilize the new environment variable.
Thanks to Scott Bartell for pointing this out.
For Windows, when you install a package, you type:
python -m pip install [packagename]
As of now, version 3.7.3 I had a little bit of an issue with getting the right system variable.
Try this:
Type start %appdata% in cmd.
After that file explorer should pop up in ../AppData/Roaming.
Go back one directory and navigate to Local/Programs/Python/Python37-32/Scripts.
NOTE: The version number may be different so if you copy and paste the above file path it could not work.
After you do this you now have the correct location of your downloaded Python. Copy your file path by selecting the whole directory in the address bar.
Once you do that click the start icon and navigate to the Control Panel → System and Security → System. Then click "Advanced System Settings" on the left side of the panel.
Once there, click Environment Variables on the bottom right and there will be two boxes, an upper and a lower box. In the upper box: Click on the 'Path' Variable and click Edit located on the right. Click New and paste your directory Path. It should look something like this:
Click OK three times, open a new window of cmd and type: pip. See if it works.
For me the command:
set PATH=%PATH%;C:\Python34\Scripts
worked immediately (try after echo %PATH% and you will see that your path has the value C:\Python34\Scripts).
Thanks to: Adding a directory to the PATH environment variable in Windows
Alternate way.
If you don't want to add the PATH as the previous well written answers pointed out,
but you want to execute pip as your command then you can do that with py -m as prefix.
Given that you have to do it again and again.
eg.
py -m <command>
as in
py -m pip install --upgrade pip setuptools
Also make sure to have pip and py installed
The only way that worked on my Windows 10 machine was as follows:
py -3 -m pip install xxxxx
Also, the long method - it was a last resort after trying all previous answers:
C:\python27\scripts\pip.exe install [package].whl
This after cd in directory where the wheel is located.
As per Python 3.6 Documentation
It is possible that pip does not get installed by default. One
potential fix is:
python -m ensurepip --default-pip
Control Panel -> add/remove programs -> Python -> Modify -> optional Features (you can click everything) then press next -> Check "Add python to environment variables" -> Install
And that should solve your path issues, so jump to command prompt and you can use pip now.
Go to control Panel >> Uninstall or change Program and double click on Python XXX to modify install. Make sure PIP component is checked and install.
I was having the same problem just now.
After adding the proper folder (C:\Python33\Scripts) to the path, I still could not get pip to run. All it took was running
pip.exe install -package- instead of
pip install -package-.
Try going to Windows PowerShell or cmd prompt and typing:
python -m pip install openpyxl
In latest version Python 3.6.2 and above, is available in
C:\Program Files (x86)\Python36-32\Scripts
You can add the path to our environment variable path as below
Make sure you close your command prompt or Git after setting up your path. Also should you open your command prompt in administrator mode. This is example for Windows 10.
Use
set Path = `%PATH%;C:\Python34\;C:\Python27\Scripts`
Source
Or if you are using PyCharm (2017-03-03) like me, just change directory in terminal and install:
cd C:\Users\{user}\PycharmProjects\test\venv\Scripts
pip install ..
Most frequently it is:
in cmd.exe write
python -m pip install --user [name of your module here without brackets]
Even I'm new to this, but pip install django worked for me.
The path should be set as where the script folder of the Python installation is, i.e.C:\Python34\Scripts.
I suppose it's because Django is a framework which is based on Python, and that's why this directory structure has to be maintained while installing.
I have just installed Python 3.6.2.
I got the path as
C:\Users\USERNAME\AppData\Local\Programs\Python\Python36-32\Scripts
In Windows, open cmd and find the location of PYTHON_HOME using where python. Now add this location to your environment variable PATH using:
set PATH=%PATH%;<PYTHON_HOME>\Scripts
Or refer to this.
In Linux, open a terminal and find the location of PYTHON_HOME using which python. Now add the PYTHON_HOME/Scripts to the PATH variable using:
PATH=$PATH:<PYTHON_HOME>\Scripts
export PATH
You can try pip3. Something like:
pip3 install pandas
I was facing the same issue. Run Windows PowerShell as Administrator. It resolved my issue.
None of these actually worked for me, but running
python -m pip install -U pip
and then adding the specified directory to the PATH as suggested got it working
In your Python folder path in Terminal, just type
py -m pip
in order to check the current version of your pip.
You will also see a list of commands, you can use...
I think from Python 2.7.9 and higher pip comes pre installed and it will be in your scripts folder.
So you have to add the "scripts" folder to the path. Mine is installed in C:\Python27\Scripts. Check yours to see what your path is so that you can alter the below accordingly. Then go to PowerShell, paste the below code in PowerShell and hit Enter key. After that, reboot and your issue will be resolved.
[Environment]::SetEnvironmentVariable("Path", "$env:Path;C:\Python27\Scripts", "User")
In a Windows environment, just execute the below commands in a DOS shell.
path=%path%;D:\Program Files\python3.6.4\Scripts;
(new path=current path;path of the Python script folder)
I deleted the older version using the control panel and then installed the new version however the newer version was not reflecting pip even after adding the right paths in the environment variables. However, the thing that worked for me was deleting the folders of old python that were there in the local App folder even after uninstall. For me, the path was like below. Deleting this folder solved my issue
C:\Users\username\AppData\Local\Programs\Python38
'pip' is not recognized as an internal or external command
pip is a python module used to install packages. For your problem, there can be many reasons;
Restart CMD/Terminal
Environment variable is not set. pip is installed but environment variable is not set. Environment variable is a windows variable where pip path is saved, so it can be run at run time.
pip is not installed.
Restart CMD/Terminal
It is sometimes possible that you opened your command prompt or terminal before installing pip and now it just needs a restart to pick up the latest environment variables. It is worth trying just restarting your command prompt or terminal.
Environment Variable is Not Set
Open CMD and run this command to see the values set in the PATH environment variable.
echo %PATH%
This will echo the PATH environment variable like this;
You should check if your path exist in the echoed PATH list. For example, in my case, the path for pip.exe files is C:\Python310\Scripts. You can check this path yourself like this;
If you can find pip path and it does not exist the echoed PATH variable, then we need to add it. Copy the path like C:\Python310\Scripts.
Go to Start > This PC > Properties > Advance system settings >
Advanced > Environment Variables
As shown in the image above, Select Path, click Edit button and add the copied path. Restart the CMD and test pip command again.
pip is Not Installed
If pip is not installed, you can install it again by downloading latest python.exe setup from python.org website. Make sure you check mark the pip option as shown in the image below.
In the next step, check mark "Add Python to environment variables"
I had this same issue. You just need to go to your
C:\Python27\Scripts
and add it to environment variables. After path setting just run pip.exe file on C:\Python27\Scripts and then try pip in cmd. But if nothing happens try running all pip applications like pip2.7 and pip2.exe. And pip will work like a charm.
Small clarification: in "Windows 7 64 bit PC", after adding ...Python34\Scripts to the path variable, pip install pygame didn't work for me.
So I checked the "...Python34\Scripts" folder, it didn't have pip, but it had pip3 and pip3.4. So I ran pip3.4 install pygame .... .whl. It worked.
(Further open a command window in the same folder where you have the downloaded pygame...whl file.)
When installing SQL 2019 Python, there are known issues for PIP which require a fix (step 7)
https://learn.microsoft.com/en-us/sql/advanced-analytics/known-issues-for-sql-server-machine-learning-services?view=sql-server-ver15
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Workaround
Copy the following files:
libssl-1_1-x64.dll
libcrypto-1_1-x64.dll
from the folder
C:\Program Files\Microsoft SQL Server\MSSSQL15.MSSQLSERVER\PYTHON_SERVICES\Library\bin
to the folder
C:\Program Files\Microsoft SQL Server\MSSSQL15.MSSQLSERVER\PYTHON_SERVICES\DLLs
Then open a new DOS command shell prompt.

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!

Having trouple with Pip [duplicate]

I'm running into a weird error when trying to install Django on my computer.
This is the sequence that I typed into my command line:
C:\Python34> python get-pip.py
Requirement already up-to-date: pip in c:\python34\lib\site-packages
Cleaning up...
C:\Python34> pip install Django
'pip' is not recognized as an internal or external command,
operable program or batch file.
C:\Python34> lib\site-packages\pip install Django
'lib\site-packages\pip' is not recognized as an internal or external command,
operable program or batch file.
What could be causing this?
This is what I get when I type in echo %PATH%:
C:\Python34>echo %PATH%
C:\Program Files\ImageMagick-6.8.8-Q16;C:\Program Files (x86)\Intel\iCLS Client\
;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\S
ystem32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\
Windows Live\Shared;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Progr
am Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\Program Files\Intel\Intel(R) Mana
gement Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine C
omponents\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components
\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\P
rogram Files (x86)\nodejs\;C:\Program Files (x86)\Heroku\bin;C:\Program Files (x
86)\git\cmd;C:\RailsInstaller\Ruby2.0.0\bin;C:\RailsInstaller\Git\cmd;C:\RailsIn
staller\Ruby1.9.3\bin;C:\Users\Javi\AppData\Roaming\npm
You need to add the path of your pip installation to your PATH system variable. By default, pip is installed to C:\Python34\Scripts\pip (pip now comes bundled with new versions of python), so the path "C:\Python34\Scripts" needs to be added to your PATH variable.
To check if it is already in your PATH variable, type echo %PATH% at the CMD prompt
To add the path of your pip installation to your PATH variable, you can use the Control Panel or the setx command. For example:
setx PATH "%PATH%;C:\Python34\Scripts"
Note:
According to the official documentation, "[v]ariables set with setx variables are available in future command windows only, not in the current command window". In particular, you will need to start a new cmd.exe instance after entering the above command in order to utilize the new environment variable.
Thanks to Scott Bartell for pointing this out.
For Windows, when you install a package, you type:
python -m pip install [packagename]
As of now, version 3.7.3 I had a little bit of an issue with getting the right system variable.
Try this:
Type start %appdata% in cmd.
After that file explorer should pop up in ../AppData/Roaming.
Go back one directory and navigate to Local/Programs/Python/Python37-32/Scripts.
NOTE: The version number may be different so if you copy and paste the above file path it could not work.
After you do this you now have the correct location of your downloaded Python. Copy your file path by selecting the whole directory in the address bar.
Once you do that click the start icon and navigate to the Control Panel → System and Security → System. Then click "Advanced System Settings" on the left side of the panel.
Once there, click Environment Variables on the bottom right and there will be two boxes, an upper and a lower box. In the upper box: Click on the 'Path' Variable and click Edit located on the right. Click New and paste your directory Path. It should look something like this:
Click OK three times, open a new window of cmd and type: pip. See if it works.
For me the command:
set PATH=%PATH%;C:\Python34\Scripts
worked immediately (try after echo %PATH% and you will see that your path has the value C:\Python34\Scripts).
Thanks to: Adding a directory to the PATH environment variable in Windows
Alternate way.
If you don't want to add the PATH as the previous well written answers pointed out,
but you want to execute pip as your command then you can do that with py -m as prefix.
Given that you have to do it again and again.
eg.
py -m <command>
as in
py -m pip install --upgrade pip setuptools
Also make sure to have pip and py installed
The only way that worked on my Windows 10 machine was as follows:
py -3 -m pip install xxxxx
Also, the long method - it was a last resort after trying all previous answers:
C:\python27\scripts\pip.exe install [package].whl
This after cd in directory where the wheel is located.
As per Python 3.6 Documentation
It is possible that pip does not get installed by default. One
potential fix is:
python -m ensurepip --default-pip
Control Panel -> add/remove programs -> Python -> Modify -> optional Features (you can click everything) then press next -> Check "Add python to environment variables" -> Install
And that should solve your path issues, so jump to command prompt and you can use pip now.
Go to control Panel >> Uninstall or change Program and double click on Python XXX to modify install. Make sure PIP component is checked and install.
I was having the same problem just now.
After adding the proper folder (C:\Python33\Scripts) to the path, I still could not get pip to run. All it took was running
pip.exe install -package- instead of
pip install -package-.
Try going to Windows PowerShell or cmd prompt and typing:
python -m pip install openpyxl
In latest version Python 3.6.2 and above, is available in
C:\Program Files (x86)\Python36-32\Scripts
You can add the path to our environment variable path as below
Make sure you close your command prompt or Git after setting up your path. Also should you open your command prompt in administrator mode. This is example for Windows 10.
Use
set Path = `%PATH%;C:\Python34\;C:\Python27\Scripts`
Source
Or if you are using PyCharm (2017-03-03) like me, just change directory in terminal and install:
cd C:\Users\{user}\PycharmProjects\test\venv\Scripts
pip install ..
Most frequently it is:
in cmd.exe write
python -m pip install --user [name of your module here without brackets]
Even I'm new to this, but pip install django worked for me.
The path should be set as where the script folder of the Python installation is, i.e.C:\Python34\Scripts.
I suppose it's because Django is a framework which is based on Python, and that's why this directory structure has to be maintained while installing.
I have just installed Python 3.6.2.
I got the path as
C:\Users\USERNAME\AppData\Local\Programs\Python\Python36-32\Scripts
In Windows, open cmd and find the location of PYTHON_HOME using where python. Now add this location to your environment variable PATH using:
set PATH=%PATH%;<PYTHON_HOME>\Scripts
Or refer to this.
In Linux, open a terminal and find the location of PYTHON_HOME using which python. Now add the PYTHON_HOME/Scripts to the PATH variable using:
PATH=$PATH:<PYTHON_HOME>\Scripts
export PATH
You can try pip3. Something like:
pip3 install pandas
I was facing the same issue. Run Windows PowerShell as Administrator. It resolved my issue.
None of these actually worked for me, but running
python -m pip install -U pip
and then adding the specified directory to the PATH as suggested got it working
In your Python folder path in Terminal, just type
py -m pip
in order to check the current version of your pip.
You will also see a list of commands, you can use...
I think from Python 2.7.9 and higher pip comes pre installed and it will be in your scripts folder.
So you have to add the "scripts" folder to the path. Mine is installed in C:\Python27\Scripts. Check yours to see what your path is so that you can alter the below accordingly. Then go to PowerShell, paste the below code in PowerShell and hit Enter key. After that, reboot and your issue will be resolved.
[Environment]::SetEnvironmentVariable("Path", "$env:Path;C:\Python27\Scripts", "User")
In a Windows environment, just execute the below commands in a DOS shell.
path=%path%;D:\Program Files\python3.6.4\Scripts;
(new path=current path;path of the Python script folder)
I deleted the older version using the control panel and then installed the new version however the newer version was not reflecting pip even after adding the right paths in the environment variables. However, the thing that worked for me was deleting the folders of old python that were there in the local App folder even after uninstall. For me, the path was like below. Deleting this folder solved my issue
C:\Users\username\AppData\Local\Programs\Python38
'pip' is not recognized as an internal or external command
pip is a python module used to install packages. For your problem, there can be many reasons;
Restart CMD/Terminal
Environment variable is not set. pip is installed but environment variable is not set. Environment variable is a windows variable where pip path is saved, so it can be run at run time.
pip is not installed.
Restart CMD/Terminal
It is sometimes possible that you opened your command prompt or terminal before installing pip and now it just needs a restart to pick up the latest environment variables. It is worth trying just restarting your command prompt or terminal.
Environment Variable is Not Set
Open CMD and run this command to see the values set in the PATH environment variable.
echo %PATH%
This will echo the PATH environment variable like this;
You should check if your path exist in the echoed PATH list. For example, in my case, the path for pip.exe files is C:\Python310\Scripts. You can check this path yourself like this;
If you can find pip path and it does not exist the echoed PATH variable, then we need to add it. Copy the path like C:\Python310\Scripts.
Go to Start > This PC > Properties > Advance system settings >
Advanced > Environment Variables
As shown in the image above, Select Path, click Edit button and add the copied path. Restart the CMD and test pip command again.
pip is Not Installed
If pip is not installed, you can install it again by downloading latest python.exe setup from python.org website. Make sure you check mark the pip option as shown in the image below.
In the next step, check mark "Add Python to environment variables"
I had this same issue. You just need to go to your
C:\Python27\Scripts
and add it to environment variables. After path setting just run pip.exe file on C:\Python27\Scripts and then try pip in cmd. But if nothing happens try running all pip applications like pip2.7 and pip2.exe. And pip will work like a charm.
Small clarification: in "Windows 7 64 bit PC", after adding ...Python34\Scripts to the path variable, pip install pygame didn't work for me.
So I checked the "...Python34\Scripts" folder, it didn't have pip, but it had pip3 and pip3.4. So I ran pip3.4 install pygame .... .whl. It worked.
(Further open a command window in the same folder where you have the downloaded pygame...whl file.)
When installing SQL 2019 Python, there are known issues for PIP which require a fix (step 7)
https://learn.microsoft.com/en-us/sql/advanced-analytics/known-issues-for-sql-server-machine-learning-services?view=sql-server-ver15
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Workaround
Copy the following files:
libssl-1_1-x64.dll
libcrypto-1_1-x64.dll
from the folder
C:\Program Files\Microsoft SQL Server\MSSSQL15.MSSQLSERVER\PYTHON_SERVICES\Library\bin
to the folder
C:\Program Files\Microsoft SQL Server\MSSSQL15.MSSQLSERVER\PYTHON_SERVICES\DLLs
Then open a new DOS command shell prompt.

Locate MacPorts package?

I just installed the py27-numpy package via MacPorts and python will not find the module when I use this command: import scipy
I used the help('modules') command and the scipy port did not come up.
Clearly the path is not configured correctly or MacPorts is not installing in the correct place, but either way, it would solve my problem to know where this package is being installed.
Where can I find the path to MacPorts-installed package, py27-scipy?
Output of echo $PATH command:
/Library/Frameworks/Python.framework/Versions/2.7/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:directory/bin
I cannot find the package in any of those locations.
Thanks for the help.
To find the location of installed components, use the contents subcommand:
port contents py27-numpy
As for getting python to find the package, see #fardjad's response.
Your PATH is incorrect. It appears to be picking up another Python 2.7, likely one installed using a binary installer from python.org or elsewhere, and not the MacPorts installed one. Try removing the the /Library/Frameworks/Python.framework/Versions/2.7/bin from PATH or just invoke the MacPorts Python directly:
/opt/local/bin/python2.7
MacPorts should install Python packages in /opt/local/Library/Frameworks/Python.framework/2.7/site-packages by default. So make sure to set $PYTHONPATH environment variable in your .profile file:
export PYTHONPATH="/opt/local/Library/Frameworks/Python.framework/Versions/2.7/site-packages"
sudo port select --set python python27
is the best answer to install port's python system-wide
With Homebrew only using the latest, the Mac system version, and MacPorts for the others in-between, I was confused until I found python locations differ depending on the installer.
Here's an opinionated tip: Use virtualenvs for your projects and don't change your default version with the MacPorts. I won't and don't want to remember to updoot my python in the middle of something so I rely on virtualenvs. Choose and find the python version on the computer, then mkvirtualenv --python=/found/u/python3.X getawesome.
Based on Jeremy W. Sherman's answer
I checked my python version
python --version
Python 3.8.5
and location:
which python
/opt/local/bin/python
and then tried:
sudo port contents python38
which lists 7285 lines:
Port python38 contains:
/Applications/MacPorts/Python 3.8/IDLE.app/Contents/Info.plist
/Applications/MacPorts/Python 3.8/IDLE.app/Contents/MacOS/IDLE
/Applications/MacPorts/Python 3.8/IDLE.app/Contents/MacOS/Python
/Applications/MacPorts/Python 3.8/IDLE.app/Contents/PkgInfo
...
/opt/local/share/man/man1/python3.8.1
combining that with fardjad's answer leads to:
sudo port contents python38 | grep site-packages
with the output:
/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/README.txt
since we need the directory modifying the command to:
dirname $(sudo port contents python38 | grep site-packages)
gives the desired directory:
/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages
so it's possible to end up with the one-liner:
One-Line PYTHONPATH setting in macports:
export PYTHONPATH=$(dirname $(sudo port contents python38 | grep site-packages))
and we can check the result:
echo $PYTHONPATH
/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages
For reference see how the Eclipse Liclipse python IDE dialog for setting the PATH looks - there are some more directories you might want to include for a fully specified PYTHONPATH.

Categories