I wanted to download the PIL library to crop images on python, but I just can't download the module. Here's what appears on the terminal
$ pip install PIL
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Defaulting to user installation because normal site-packages is not writeable
ERROR: Could not find a version that satisfies the requirement PIL (from versions: none)
ERROR: No matching distribution found for PIL
Then I tried this out. But another error shows up
$ python3 -m pip install PIL
Could not find a version that satisfies the requirement PIL (from versions: )
No matching distribution found for PIL
You are using pip version 10.0.1, however version 20.0.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
So I tried to upgrade my pip. But then this shows up
$ pip install --upgrade pip
Defaulting to user installation because normal site-packages is not writeable
Requirement already up-to-date: pip in /Library/Python/2.7/site-packages/pip-20.0.2-py2.7.egg (20.0.2)
When I check my pip version it shows this
$ pip --version
pip 20.0.2 from /Library/Python/2.7/site-packages/pip-20.0.2-py2.7.egg/pip (python 2.7)
When I check my python version it shows this
$ python --version
Python 2.7.10
$ python3 --version
Python 3.7.1
So I downloaded pip3 and then tried the command
$ pip3 install PIL
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
Defaulting to user installation because normal site-packages is not writeable
ERROR: Could not find a version that satisfies the requirement PIL (from versions: none)
ERROR: No matching distribution found for PIL
I also tried what they said.
$ python3 -m pip3 install PIL
/Library/Frameworks/Python.framework/Versions/3.7/bin/python3: No module named pip3
Here are some details about my pip and python
$ which pip3
/Library/Frameworks/Python.framework/Versions/3.7/bin/pip3
$ which python3
/Library/Frameworks/Python.framework/Versions/3.7/bin/python3
How do I solve this once and for all?
Because python 2 is no longer supported,
Pip2(invoked by either pip or python -m pip) is complaining that you should use python 3. The package manager for python 3 is called pip3(invoked by pip3 or python3 -m pip).
Your pip3 is currently the latest version and you dont need to take any action to upgrade pip3.
If you want to use PIL in python then i recommend you install pillow. Pillow is the PIL of python 3.
You should be able to install pillow with pip3 install Pillow. Pillow supercedes PIL. (unless you specifically want to use PIL with python 2)
Perhaps you want to configure your terminal to alias pip to pip3 so you wont call pip2 by mistake.
I am new to Python and terminal prompts/installs and I keep running into installation errors when trying to install modules like Pandas.
I have successfully installed "pip install pandas"
I am unable to install this with pip3 however.
Collecting pandas
Could not find a version that satisfies the requirement pandas (from versions: )
No matching distribution found for pandas
I have pip3 installed and python3(this comes with mac os).
I do not understand the conflict between the versions. If I install using pip, its only compatible with python2?
Why wouldnt I be able to install it using pip3 (see error above)?
Am I somehow installing in the wrong directories or not making the correct distinction for python3 and pip3 version compatibility? Thanks for any insight.
As already said in the comments, pip installs modules for python2. Also, you can't run pandas as a command on the shell.
pip3 install pandas works for me, on python3 (v3.7.4), which was installed directly from a Mac installer package on the python website. No 'environment configuration' was required.
>pip3 install pandas
Collecting pandas
Downloading https://files.pythonhosted.org/packages/ab/ba/f97030b7e8ec0a981abdca173de4e727b3a7b4ed5dba492f362ba87d59a2/pandas-1.0.1-cp37-cp37m-macosx_10_9_x86_64.whl (9.8MB)
100% |████████████████████████████████| 9.8MB 2.8MB/s
If you've installed python3 using some different method, then you may need to install packages differently or configure your python installation in some way.
I've been trying to install Peter Chervenski's MultiNEAT and ran into a problem while running setup.py (python setup.py build_ext):
File "c:/Users/1234/Documents/Alex/multineat/peter-ch-MultiNEAT-f631e2f/setup.py", line 7, in
from site-packages import psutil'
And I made sure this module is installed: used pip install a couple of times and it said:
Requirement already satisfied: psutil in
c:\users\1234\appdata\local\programs\python\python36-32\lib\site-packages
And I checked this directory myself and found psutil module there (I even deleted it and reinstalled one more time). And after that, I still got the same error with Python not seeing psutil. Is there any way I can solve this problem? (I am using Windows 10, latest version of Python)
Error I got in windows 10 while executing a python script ->
Traceback (most recent call last):
File "C:\Users\YOUR NAME\Desktop\Sample.py", line 2, in
import psutil
ImportError: No module named psutil
This is how I resolved the issue ->
C:\python -m pip install --upgrade pip
[Latest pip version got installed successfully]
C:\>python -m pip install psutil
Collecting psutil
Downloading https://files.pythonhosted.org/packages/50/6a/34525bc4e6e153bf6e849a4c4e936742b365f6819c0462cebfa4f082a3c4/psutil-5.4.7-cp27-none-win_amd64.whl (220kB)
100% |UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU| 225kB 696kB/s
Installing collected packages: psutil
Successfully installed psutil-5.4.7
Finally, Sample.py got executed successfully
This worked for me..
sudo pip install --upgrade psutil
Follow these steps on windows:
Open command prompt in administrator mode
Enter Command python -m pip install psutil
Upgrade pip if outdated python -m pip install --upgrade pip
Process Example
I solved a problem and if you had a similar problem you should try this:
upgrade pip to the latest version (python -m pip install --upgrade pip)
delete psutil (C:\Users\(your username)\AppData\Local\Programs\Python\Python36-32\Lib\site-packages) if
you have it installed already
reupload psutilnow using pip install psutil
. It helped me and if you have a permission error, try opening cmd as administrator.
I had that problem trust me this works 100%. I am using VS Code you just have to install it with pip normally but sometimes it doesn't add it to your working directories (venv\lib\site-packages\) folder your editor is using. So just copy and paste it there from here C:\Users\(your username)\AppData\Roaming\Python\Python39\site-packages
I resolved this issue as below:
It seems, every time i was trying to upgrade psutil using "pip install psutil" it just showing the requirement is satisfied and showing 5.7.2.
Go to the folder where Python is install and psutil is available e.g.
"C:\Python\Lib\site-packages"
find all psutil related filesand rename them to something else e.g.
Old__psutil
Old_psutil-5.7.2.dist-info
Run "pip install psutil" from bash or command line
It updated for me to 5.8.0
This resolved my issue.
Inconsistencies can happen if you have multiple versions of windows installed on your system. Check for the default python directory path and make sure 'psutils' is updated in that directory.
I got the same issue and solved it by specifying the exact (virtual environment / global) pip you are using. In my case (using a virtual environment), after executed pip by using the absolute path, I installed psutil successfully.
I was having same issue, but not quite exactly the same circumstances. I am writing this for any people that have the same problem as I did.
I was running sudo python script.py (sudo was needed since I wanted to alter cpu frequencies) but Error : No module named 'psutil' appeared. I checked my python version with
python --version
and it was 3.8, but when I checked my version with
sudo python --version
it was running version 2.7. Once I ran
sudo python3 script.py
it ran smoothly. Of course I had already verified I had the newest pip installed + psutil library installed on python3. Basically, make sure you are running the correct python version and you have all libraries/package managers up to date, hope this helped!
This worked for me. I had multiple version of python in my ubuntu system.
$ sudo apt install python3.6-dev
These two commands typed in the SSH shell worked for me. The apt install is what was showing me the error mentioned.
sudo apt install pip
python3 -m pip install psutil
Result:
python3 -m pip install psutil
Collecting psutil
Downloading psutil-5.9.1-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (284 kB)
|████████████████████████████████| 284 kB 2.0 MB/s
Installing collected packages: psutil
Successfully installed psutil-5.9.1
Hope this helps someone...
As a caveat, I have searched and tried every solution on could find on this topic here, on YouTube and anywhere google brought me to.
Running Windows 10 Home 64 bit and Python 3.6.4.
Pygame is displaying as an available module when I call a list of all modules via print (help('modules') ). But when I import it I get:
from pygame.base import *
ModuleNotFoundError: No module named 'pygame.base'
or
help('pygame')
problem in pygame - ModuleNotFoundError: No module named 'pygame.base'
I have have installed pygame:
PS C:\Users\mando\AppData\Local\Programs\Python\Python36-32\Scripts> py -m pip install pygame --user Requirement already satisfied: pygame in c:\users\mando\appdata\roaming\python\python36\site-packages
You are using pip version 9.0.1, however version 9.0.3 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command. PS C:\Users\mando\AppData\Local\Programs\Python\Python36-32\Scripts> m pip install --upgrade pip
I have updated pip as recommended:
PS C:\Users\mando\AppData\Local\Programs\Python\Python36-32\Scripts> python -m pip install --upgrade pip Requirement already up-to-date: pip in c:\users\mando\appdata\local\programs\python\python36-32\lib\site-packages
PS C:\Users\mando\AppData\Local\Programs\Python\Python36-32\Scripts>
I have installed both 32 and 64 bit whl for kicks, but none work:
pygame-1.9.3-cp36-cp36m-win_amd64.whl
When I install this I get:
pygame-1.9.3-cp36-cp36m-win_amd64.whl is not a supported wheel on this platform.
I installed this via cmd running as an administrator.
I can actually run: py -m pygame.examples.aliens
The application opens and runs fine. I just cannot import pygame into IDLE.
Can anyone please point me to a solution?
Found the issue. The book I am using said to use: py -m pip install pygame --user. That installed it in the wrong path. The correct command is: pip install pygame. I deleted the pygame files and reinstalled them with pip install pygame and all is well now. Thanks #NekoTony. We'll chalk this one up to user error. –
I know many questions speak about this problem, but i tried a lot and didn't fin any solution to my "very classical" issue : Python import fails altough package installed:
MacBook-Pro-de-Stephanie:scripts user$ sudo -H pip install openpyxl
Collecting openpyxl
Requirement already satisfied (use --upgrade to upgrade): jdcal in /usr/local/lib/python2.7/site-packages (from openpyxl)
Requirement already satisfied (use --upgrade to upgrade): et-xmlfile in /usr/local/lib/python2.7/site-packages (from openpyxl)
Installing collected packages: openpyxl
Successfully installed openpyxl-2.3.5
Package installed right ?
MacBook-Pro-de-Stephanie:scripts user$ python interactionsXLSX2CSV.py
Traceback (most recent call last):
File "interactionsXLSX2CSV.py", line 5, in <module>
from openpyxl import load_workbook
ImportError: No module named openpyxl
Fails right ?
MacBook-Pro-de-Stephanie:scripts user$ echo $PYTHONPATH
/usr/local/lib/python2.7/:
Path seems ok, no ?
I set permissions with:
sudo chmod -R ugo+rX ./lib/python2.7/site-packages/
What can i try else ?
Thank you very much
Here was the solution for me (linked to Mac OS clearly) : Can't load Python modules installed via pip from site-packages directory
/usr/bin/python is the executable for the python that comes with OS
X. /usr/local/lib is a location for user-installed programs only,
possibly from Python.org or Homebrew. So you're mixing different
Python installs, and changing the python path is only a partial
workaround for different packages being installed for different
installations.
In order to make sure you use the pip associated with a particular
python, you can run python -m pip install <pkg>, or go look at what
the pip on your path is, or is symlinked to.
I am not getting that error. Just now i installed. All i am getting is
" /usr/local/lib/python2.7/dist-packages/openpyxl/xml/init.py:15: UserWarning: The installed version of lxml is too old to be used with openpyxl
warnings.warn("The installed version of lxml is too old to be used with openpyxl")"
Once try by using below command.
sudo apt-get install python-openpyxl