I've looked at a number of posts on this and nothing seems to fix it. I initally started out on Python 3.5, heard that there were several unresolved issues with pip and so I uninstalled and reinstalled Python 3.4.4 -
I want to use pyautogui for a work task, but when I try to install pyautogui directly after Python3.4.4 installation it tells me the PIL Module can't be found. I read in another article to install 3.4.4 and update pip, then install pyautogui. Cool, so I installed 3.4.4, I needed to upgrade pip. So I entered in
Scripts\pip.exe install --upgrade pip
from the command line in the root folder. Every time I get this
Exception:
Traceback (most recent call last):
File "h:\python34\lib\shutil.py", line 527, in move
os.rename(src, real_dst)
PermissionError: [WinError 32] The process cannot access the file because it is
being used by another process: 'h:\\python34\\scripts\\pip.exe' -> 'C:\\Users\\z
jf\\AppData\\Local\\Temp\\pip-qo75adq9-uninstall\\python34\\scripts\\pip.exe'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "h:\python34\lib\site-packages\pip\basecommand.py", line 211, in main
File "h:\python34\lib\site-packages\pip\commands\install.py", line 311, in run
File "h:\python34\lib\site-packages\pip\req\req_set.py", line 640, in install
File "h:\python34\lib\site-packages\pip\req\req_install.py", line 716, in unin
stall
File "h:\python34\lib\site-packages\pip\req\req_uninstall.py", line 125, in re
move
File "h:\python34\lib\site-packages\pip\utils\__init__.py", line 315, in renam
es
File "h:\python34\lib\shutil.py", line 540, in move
os.unlink(src)
PermissionError: [WinError 32] The process cannot access the file because it is
being used by another process: 'h:\\python34\\scripts\\pip.exe'
Thing is, nothing is running in that folder. I don't have windows explorer open to it, I don't have anything accessing any files in there, and I'm obviously running it from an upper level directory using the command line. So I have no idea why it's saying that pip.exe is being used by another process. The only process it's being run by is itself and if that's the issue, then how in the world are you supposed to upgrade it?
**EDIT: ** Per the accepted answer, in order to get PIP to update I used the command
python -m pip install -U pip
Once that worked I tried to install pyautogui yet again. It still said that PIL module could not be found. PIL is the Python Image Library. I installed it using
python -m pip install image
And once that worked I then installed pyautogui like so
python -m pip install pyautogui
To upgrade pip on windows google "upgrade pip on windows" or alternately run this in a command prompt:
python -m pip install -U pip
This is a known issue on windows where an executable can't be overwritten while it's running. Sorry no links handy but it should be easy to find more details.
Problem: You are using pip version 18.1, however version 19.0.1 is available. You should consider upgrading via the ‘python -m pip install –upgrade pip’ command.
Solution: In order to upgrade PIP in Windows, you’ll need to open the Windows Command Prompt, and then type/copy the command below. Note that the following method would only work if you already added Python to Windows path. Don’t worry if you don’t know what it means, as I’ll show the full steps to upgrade pip in windows in the next section.
python -m pip install --upgrade pip
Related
A program I am trying to install requires the installation of PyQt5 5.15.0 , which gives me this error. The odd thing is that the installation works fine for the latest version of PyQt5 (5.15.2), but this program requires 5.15.0 specifically.
Command Output:
Collecting PyQt5==5.15.0
Using cached PyQt5-5.15.0.tar.gz (3.3 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\mshal\appdata\local\programs\python\python39\python.exe' 'C:\Users\mshal\AppData\Roaming\Python\Python39\site-packages\pip\_vendor\pep517\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\mshal\AppData\Local\Temp\tmp41s11ev6'
cwd: C:\Users\mshal\AppData\Local\Temp\pip-install-sfw90hvc\pyqt5_e2cc46859b554da7b84798abae5378ba
Complete output (31 lines):
Traceback (most recent call last):
File "C:\Users\mshal\AppData\Roaming\Python\Python39\site-packages\pip\_vendor\pep517\_in_process.py", line 126, in prepare_metadata_for_build_wheel
hook = backend.prepare_metadata_for_build_wheel
AttributeError: module 'sipbuild.api' has no attribute 'prepare_metadata_for_build_wheel'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\mshal\AppData\Roaming\Python\Python39\site-packages\pip\_vendor\pep517\_in_process.py", line 280, in <module>
main()
File "C:\Users\mshal\AppData\Roaming\Python\Python39\site-packages\pip\_vendor\pep517\_in_process.py", line 263, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "C:\Users\mshal\AppData\Roaming\Python\Python39\site-packages\pip\_vendor\pep517\_in_process.py", line 130, in prepare_metadata_for_build_wheel
return _get_wheel_metadata_from_wheel(backend, metadata_directory,
File "C:\Users\mshal\AppData\Roaming\Python\Python39\site-packages\pip\_vendor\pep517\_in_process.py", line 159, in _get_wheel_metadata_from_wheel
whl_basename = backend.build_wheel(metadata_directory, config_settings)
File "C:\Users\mshal\AppData\Local\Temp\pip-build-env-nnx_yu09\overlay\Lib\site-packages\sipbuild\api.py", line 51, in build_wheel
project = AbstractProject.bootstrap('pep517')
File "C:\Users\mshal\AppData\Local\Temp\pip-build-env-nnx_yu09\overlay\Lib\site-packages\sipbuild\abstract_project.py", line 83, in bootstrap
project.setup(pyproject, tool, tool_description)
File "C:\Users\mshal\AppData\Local\Temp\pip-build-env-nnx_yu09\overlay\Lib\site-packages\sipbuild\project.py", line 479, in setup
self.apply_user_defaults(tool)
File "project.py", line 62, in apply_user_defaults
super().apply_user_defaults(tool)
File "C:\Users\mshal\AppData\Local\Temp\pip-build-env-nnx_yu09\overlay\Lib\site-packages\pyqtbuild\project.py", line 79, in apply_user_defaults
super().apply_user_defaults(tool)
File "C:\Users\mshal\AppData\Local\Temp\pip-build-env-nnx_yu09\overlay\Lib\site-packages\sipbuild\project.py", line 225, in apply_user_defaults
self.builder.apply_user_defaults(tool)
File "C:\Users\mshal\AppData\Local\Temp\pip-build-env-nnx_yu09\overlay\Lib\site-packages\pyqtbuild\builder.py", line 66, in apply_user_defaults
raise PyProjectOptionException('qmake',
sipbuild.pyproject.PyProjectOptionException
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\mshal\appdata\local\programs\python\python39\python.exe' 'C:\Users\mshal\AppData\Roaming\Python\Python39\site-packages\pip\_vendor\pep517\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\mshal\AppData\Local\Temp\tmp41s11ev6' Check the logs for full command output.
I am on the latest version of pip. Any ideas on the root cause of this issue?
What helped me is upgrading pip from 20.2.3 to the latest one (in my case 21.1.1)
For Mac/Homebrew users.
The answer by #the-x is leading in the right direction. On a Mac with QT5 installed via Homebrew the qmake binary just needs to be added to the path. This can be achieved through
export PATH="/opt/homebrew/opt/qt5/bin:$PATH"
(of course depending on where the homebrew files are installed)
Running on arm with python3.6 (ubuntu18 on nvidia Xavier):
sudo apt install qt5-default
For MacOS users.
I am on Apple M1 silicon using Python 3.9.8. What worked for me was #Apaul's comment in the original question section. Install pyqt5-sip prior to pyqt5.
I also have an Intel Mac and on that machine, I do not need to do this.
Checking the binaries that PyQt5 provides in pypi for version 5.15.0 I see that it does not provide the binaries for python3.9 in windows, so pip is trying to compile using the source code which is complicated and can generate several dependency problems (for example you must have Qt 5.15 installed, etc). So my recommendation is to install a more updated version of PyQt5, for example 5.15.2 since if it provides the binaries for python3.9 on windows, in addition to being a wrapper of an LTS version of Qt then it will have solved several bugs.
python -m pip install PyQt5==5.15.2
Another solution is to use python3.8 instead of python3.9 so that you can install pyqt5 5.15.0 from pypi without problems.
Upgrading your pip enables you to install PyQt5. Personally, I had the same issue while installing PyQt6 and I upgraded my pip, and everything installed perfectly. I think both python and pip versions play an important role in installing PyQt so make sure you have later versions.
This is the command I used in Linux:
pip install --upgrade pip
Combining several answers on this question: On an Apple M1 Pro Macbook with macOS Ventura 13.0.1, with Homebrew 3.6.17 and python 3.11.0 the following commands fixed it for me (no sudo):
brew install qt5
export PATH="/opt/homebrew/opt/qt5/bin:$PATH"
python3 -m ensurepip --default-pip
pip3 install pyqt5-sip
pip3 install pyqt5 --config-settings --confirm-license= --verbose
That last step calls qmake to compile all of Qt on your M1 and takes many minutes to complete, be patient and let it finish.
Since qt5-default was not available, I installed qt5-default's dependencies
sudo apt-get install qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools
after that I installed pyqt5 via apt-get first and afterwards via pip
sudo apt-get install pyqt5-dev
pip install pyqt5
now wheel seems to work
side-note:
I am not sure if sudo apt-get install pyqt5-dev is even necessary
The error message thrown here is misleading - it's not an issue with a sipbuild.api attribute. Indeed, in this case program qmake is missing, see last line of the Python traceback. Have a look if it's installed on your system and add it to your PATH variable. Otherwise, install it. On Linux this would be done with
sudo apt-get install qt5-qmake
I had this problem on my M1 Mac using Python 3.9.12 when I was trying to install a library: pip install pixellib.
The first thing I did was: pip install pixellib --verbose to see the whole log, and there I noticed that PyQt5 was waiting for an input. So then I found someone else with that issue, and used pip install pyqt5 --config-settings --confirm-license= --verbose which took some time to compile, but worked!
I could not get any of the above solutions to work but I managed to get it working using python3.9, PyQt5=5.15.2, pip=22.0.2 and sip=6.5.0 by using sudo apt-get install PyQt5. If you need it in a virtual environment, you can manually copy the PyQt5 folder from your default /usr/lib/python3/dist-packages to the site-packages folder in your virtual environment.
To all those that are struggling with Apple M1 installation, here is a working solution, specifically addressing the problem of installing the pixellib library that depends on PyQt5 but you can apply it equally to other libs:
PyQt5 is not supported on Apple M1, it needs qt6: https://www.reddit.com/r/learnpython/comments/o4w1ut/comment/h2jele3/?utm_source=share&utm_medium=web2x&context=3 , https://www.qt.io/product/qt6
this means you need to install PyQt6: python3 -m pip install PyQt6
go to the lib you need, in my case pixellib: https://pypi.org/project/pixellib/#files and
download the wheel file
get the wheel tool: pip install wheel
unpack the wheel wheel unpack pixellib-0.7.1-py3-none-any.whl
Change its dependency of PyQt5 to PyQt6
edit pixellib-0.7.1/pixellib-0.7.1.dist-info/METADATA
pyQt5 => pyQt6
pack it back wheel pack pixellib-0.7.1
install it: pip install pixellib-0.7.1-py3-none-any.whl
test in python: `
# should work
import pixellib
P.S. thanks to Terra and ChaOS for supporting work on the project underlying this report.
I finally managed to make it works on M1/M2 Macbook Pro.
None of these answers worked for me, so I looked at brew to install pyqt.
The following command will install pyqt5 via brew:
brew install pyqt#5
Then it just worked.
This can be resolved by switching to an environment with Python >= 3.8
I'm been trying to install PyQt and I can't get past the below error. I've read a few posts suggesting that I should upgrade PIP, setup_tools, and ez_install. I've tried all of that with no luck. Any tips?
c:\Python27>pip install PyQt5_gpl-5.10.tar.gz
Processing c:\python27\pyqt5_gpl-5.10.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\program files (x86)\python36-32\lib\tokenize.py", line 452, in open
buffer = _builtin_open(filename, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\JAME~1.KRK\\AppData\\Local\\Temp\\pip-0u8uht47-build\\setup.py'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\JAME~1.KRK\AppData\Local\Temp\pip-0u8uht47-build\
Same thing in 3.6:
c:\Program Files (x86)\Python36-32>pip install PyQt5_gpl-5.10.tar.gz
Processing c:\program files (x86)\python36-32\pyqt5_gpl-5.10.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\program files (x86)\python36-32\lib\tokenize.py", line 452, in open
buffer = _builtin_open(filename, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\JAME~1.KRK\\AppData\\Local\\Temp\\pip-f9s0_6sp-build\\setup.py'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in
C:\Users\JAM~1.KRK\AppData\Local\Temp\pip-f9s0_6sp-build\
I just encountered the same issue and find clue in the topic. It has been solved by pip upgrade.
Here is the detail:
1. Issue case:
pip3 install pyqt5.
failed and report FileNotFoundError: [Errno 2] No such file or directory:
2. OS environment:
Win10 64x WSL2
3. Python environment
python 3.7.3
pip version 19.X (not write down)
Solved steps:
pip3 install --upgrade pip
pip3 install --user PyQt5
sudo apt-get update -y
sudo apt install libgl1-mesa-glx -y
now. It works.
Root cause:
a. pyqt
in wsl, pip old version download wrong package.
pip (v20.x) download below version
PyQt5-5.15.2-5.15.2-cp35.cp36.cp37.cp38.cp39-abi3-manylinux2014_x86_64.whl
b. libgl1.so1.
not such lib need install by apt intall
Hope my experience can help you.
On PyPI it seems PyQT5 is for python 3.5 or higher only. Not python 2.7. Use an earlier version of PyQt or a newer version of python (Python 2.7 isn't supported beyond 2020, you'll need to move sooner or later).
You appear to be trying to make pip install the PyQt5 source archive. PyQt doesn't use the usual setup.py script that many python packages use and cannot be built and installed from source with pip. Furthermore, the .tar.gz format is intended for linux systems and Windows provides no native support. I am not sure whether pip on Windows would even handle the format. There is a .zip version provided for Windows users.
You need to either extract the archive and build from source, or allow pip to download and install the package itself with pip install PyQt5.
If you are using Python < 3.5, you will have to build from source (or install PyQt4 instead), as there are no official builds provided for these versions of Python. For everything else the pip command above should be enough.
you need to use Python >= 3.5 or try the older PyQt4
on debianoids there is a nice way out of this bug
apt install python3-pyqt5
I've found a problem with pip and can't do anything with it anymore.
I'm on a Windows 7 computer and have a Dutch language (maybe it will occur problems with reading)
I did use pip version 8.1.1, but there's a newer version, 9.0.1. I installed it using 'pip install --upgrade pip' and he's doing pretty well so it uninstalled the previous version of pip and then the problem came. Now I can't use pip as well. When I try to install or upgrade my system says: 'ImportError: No module named pip'.
I had this problem somewhere in 2016 and never found an answer, so I installed Python again on my computer. I hope there's a better way to do this instead of install whole Python and all those modules again.
So for me is this a bit strange, I hope anyone know this problem and knows a way to fix this. Beneath I'll show up the texts in the command prompt.
Code:
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' comm
and.
D:\PythonProjects\Python Crash Course\learning_log\ll_env\Scripts>pip install --
upgrade pip
Collecting pip
Using cached pip-9.0.1-py2.py3-none-any.whl
Installing collected packages: pip
Found existing installation: pip 8.1.1
Uninstalling pip-8.1.1:
Exception:
Traceback (most recent call last):
File "C:\Users\Pascal\AppData\Local\Programs\Python\Python35\lib\shutil.py", l
ine 538, in move
os.rename(src, real_dst)
OSError: [WinError 17] Het systeem kan het bestand niet verplaatsen naar een and
er station: 'd:\\pythonprojects\\python crash course\\learning_log\\ll_env\\scri
pts\\pip.exe' -> 'C:\\Users\\Pascal\\AppData\\Local\\Temp\\pip-0hagtsau-uninstal
l\\pythonprojects\\python crash course\\learning_log\\ll_env\\scripts\\pip.exe'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "d:\pythonprojects\python crash course\learning_log\ll_env\lib\site-packa
ges\pip\basecommand.py", line 209, in main
File "d:\pythonprojects\python crash course\learning_log\ll_env\lib\site-packa
ges\pip\commands\install.py", line 317, in run
File "d:\pythonprojects\python crash course\learning_log\ll_env\lib\site-packa
ges\pip\req\req_set.py", line 726, in install
File "d:\pythonprojects\python crash course\learning_log\ll_env\lib\site-packa
ges\pip\req\req_install.py", line 746, in uninstall
File "d:\pythonprojects\python crash course\learning_log\ll_env\lib\site-packa
ges\pip\req\req_uninstall.py", line 115, in remove
File "d:\pythonprojects\python crash course\learning_log\ll_env\lib\site-packa
ges\pip\utils\__init__.py", line 267, in renames
File "C:\Users\Pascal\AppData\Local\Programs\Python\Python35\lib\shutil.py", l
ine 553, in move
os.unlink(src)
PermissionError: [WinError 5] Toegang geweigerd: 'd:\\pythonprojects\\python cra
sh course\\learning_log\\ll_env\\scripts\\pip.exe'
D:\PythonProjects\Python Crash Course\learning_log\ll_env\Scripts>pip freeze > r
equirements.txt
Traceback (most recent call last):
File "C:\Users\Pascal\AppData\Local\Programs\Python\Python35\lib\runpy.py", li
ne 184, in _run_module_as_main
"__main__", mod_spec)
File "C:\Users\Pascal\AppData\Local\Programs\Python\Python35\lib\runpy.py", li
ne 85, in _run_code
exec(code, run_globals)
File "D:\PythonProjects\Python Crash Course\learning_log\ll_env\Scripts\pip.ex
e\__main__.py", line 5, in <module>
ImportError: No module named 'pip'
Not sure how many people will be drawn to this note, however, if you find yourself in the scenario where the pip install, terminal within PyCharm install, Python Package install, etc. methods are not working and you are receiving the errors that pygame is installed in Conda but module not recognized in PyCharm; it is most likely due to conflicting Python versions having been installed as PyCharm and Conda are both IDEs and you can have overlapping versions of Python installed.
If this is the case, you will need to uninstall all of the versions of Python and Anaconda along with PyCharm. Then once reinstalled, if PyCharm doesn't recognize itself as a Python Interpreter, then add an interpreter and run as a virtual environment. At this stage, you should be able to use the python packages section to install PyGames without issue. You may be able to get by without uninstalling other IDEs however I find that a full purge is full proof.
Hope this helps
This is related to disk drives on Windows. Pip downloads the new files to your current drive (D:) and then tries to move them over to the system files (on C:) and fails.
(See https://github.com/pypa/pip/issues/2824)
Could you run
python -m pip install -U pip
or is pip completely gone?
If it's gone then you would have to re-install it. Maybe re-installing all of Python is easier although probably more time consuming.
After updating a package (IPython in my case) using pip install -U ipython running any Python script that uses entry points fails with this error:
Traceback (most recent call last):
File "/home/adrian/dev/indico/env/bin/indico", line 5, in <module>
from pkg_resources import load_entry_point
...
File "/home/adrian/dev/indico/env/lib/python2.7/site-packages/pkg_resources/_vendor/packaging/requirements.py", line 94, in __init__
requirement_string[e.loc:e.loc + 8], requirement_string))
pkg_resources._vendor.packaging.requirements.InvalidRequirement: Invalid requirement, parse error at "'< 2.0'"
Nothing else changed, I did not update any other libraries.
This is caused by an issue in setuptools==20.2.1 which is pulled in by IPython (setuptools>..), so a pip install -U updated it.
Until a fixed version is released or the broken version is pulled from PyPI there is a simple workaround (but note that it will break again if something updates setuptools):
pip install -U pip
pip uninstall setuptools
pip install 'setuptools<20.2'
The pip update is needed since older versions of pip will not work without setuptools being installed
See these IRC logs and BitBucket issue for details:
http://chat-logs.dcpython.org/day/pypa/2016-02-25
https://bitbucket.org/pypa/setuptools/issues/502/packaging-164-does-not-allow-whitepace
Try downgrading your pip to 8.1.1:
pip install pip==8.1.1
That solved it for me.
In my case I had package = "2.8.0" in my Pipfile. Changing it to package = "==2.8.0" fixed this error for me.
I was trying to follow the instruction from this link :http://www.thisisthegreenroom.com/2011/installing-python-numpy-scipy-matplotlib-and-ipython-on-lion/
However, it seems my python can not find the Numpy, Scipy and everything I install using pip.
Right now, when I type which python, it shows /usr/local/bin/python.
However, when I type
pip install numpy
it shows
Requirement already satisfied (use --upgrade to upgrade): numpy in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python.
Thus it seems they are in different directory, and probably I installed numpy previously, which makes pip keep telling me they are installed. I wonder is there any way around that ?
update, I have tried to import it.
import numpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named numpy
I have also tried to uninstall the numpy and install it again. However, when I uninstall it. It still gives me error.
applematoMacBook-Air:~ apple$ pip uninstall numpy
DEPRECATION: Uninstalling a distutils installed project (numpy) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
Uninstalling numpy-1.8.0rc1:
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy-1.8.0rc1-py2.7.egg-info
Proceed (y/n)? y
Exception:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/pip-6.1.1-py2.7.egg/pip/basecommand.py", line 246, in main
status = self.run(options, args)
File "/usr/local/lib/python2.7/site-packages/pip-6.1.1-py2.7.egg/pip/commands/uninstall.py", line 70, in run
requirement_set.uninstall(auto_confirm=options.yes)
File "/usr/local/lib/python2.7/site-packages/pip-6.1.1-py2.7.egg/pip/req/req_set.py", line 274, in uninstall
req.uninstall(auto_confirm=auto_confirm)
File "/usr/local/lib/python2.7/site-packages/pip-6.1.1-py2.7.egg/pip/req/req_install.py", line 730, in uninstall
paths_to_remove.remove(auto_confirm)
File "/usr/local/lib/python2.7/site-packages/pip-6.1.1-py2.7.egg/pip/req/req_uninstall.py", line 126, in remove
renames(path, new_path)
File "/usr/local/lib/python2.7/site-packages/pip-6.1.1-py2.7.egg/pip/utils/__init__.py", line 292, in renames
shutil.move(old, new)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 302, in move
os.unlink(src)
OSError: [Errno 13] Permission denied: '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy-1.8.0rc1-py2.7.egg-info'
Seems like the version of pip you are using is using the default mac system-wide python interpreter /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python instead of the one installed in /usr/local/bin.
I've pretty much experienced the same issues until I started using homebrew. I'd recommend to have a look at this page on brew and python. You'd might need to remove pip and reinstall it from brew. Btw, using brew, there's no need for sudo.
try: pip uninstall numpy
and then: pip install numpy
...and try it with sudo:
sudo pip install numpy
first, you should use pip list to check out have you installed numpy .
if you already installed, check out your program IDE whether the pycharm, and check the pycharm interpreter does the local interpreter or virtual interpreter. if the interpreter is virtual, you should change to local. if it works, you can create the new project with select the local interpreter.
more detail: https://www.jianshu.com/p/9c3507cca2b9
in my problem, i can't update scikit-learn with pip install -U scikit-learn, and occur the problem
Cannot uninstall 'scikit-learn'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
it occured in your error too. so, i find your problem.
and i try the commod pip install -U --ignore-installed scikit-learn, and it solve my problem.