Modules are installed using pip on OSX but not found when importing
Since your problem maybe caused due to various reason, I have listed down a few of them here :
- This is possibly because of what ever is stated here : Pip installs but module is not found. Have updated the answer with newer link.
The link you were looking for : https://pythonhosted.org/setuptools/setuptools.html#development-mode
- It may also happen if you have two versions of python installed. If the
pip
that you are accessing is of one version & the python interpreter used is another.
So just see to that you are using the same version of python to install and use the package.
You may fix this using alias,
First, set up a shell alias:
alias python=/usr/local/bin/python3
Then, type that at a prompt, or put it in your ~/.bashrc
so that whenever you open python from the terminal the correct version opens.
- If both of the above methods don't work for you then check this :
ImportError No module named or this
Python pip install module is not found. How to link python to pip location?
As a quick workaround, and assuming that you are on a bash-like terminal (Linux/OSX), you can try to export the PYTHONPATH environment variable:
export PYTHONPATH="${PYTHONPATH}:/usr/local/lib/python2.7/site-packages:/usr/lib/python2.7/site-packages"
For Python 2.7
Unable to import a module that is definitely installed
In my case, it is permission problem. The package was somehow installed with root rw permission only, other user just cannot rw to it!
Can't install some pythons modules and some python modules are showing incompatible in my macbook
I was able to fix the problem on my MacBook pro m1 by deleting all pip packages using
pip3 freeze | xargs pip3 uninstall -y
then reinstalling the required module. In my case matplotlib using
pip install matplotlib
Related Topics
How to Get Flask to Run on Port 80
Socket.Shutdown VS Socket.Close
How to Execute a Python Script in Notepad++
Include Intermediary (Through Model) in Responses in Django Rest Framework
Split a String to Even Sized Chunks
Retrieving a Foreign Key Value with Django-Rest-Framework Serializers
Find P-Value (Significance) in Scikit-Learn Linearregression
Getting Individual Colors from a Color Map in Matplotlib
Python: Best Way to Add to Sys.Path Relative to the Current Running Script
Subprocess: Deleting Child Processes in Windows
What Is the _Dict_._Dict_ Attribute of a Python Class
Generating Random Dates Within a Given Range in Pandas
Convert Variable Name to String
What Is the Recommended Way of Allocating Memory for a Typed Memory View