Reputation: 2153
While I installed properly the matplotlib
and seaborn
. I was able to import matplotlib
but when I was trying to import the seaborn
I got the following error message. ModuleNotFoundError: No module named 'matplotlib._path'
. Same if I was trying to import matplotlib.pyplot
.
After spending a lot of time googling and trying this and that, installing and unistaling, finally, I
first checked out the
import sys
sys.path
to see what are the folders that it searches for the installed packages.
my result was something like this.
['',
'C:\\Users\\gsotiropoulos\\AppData\\Local\\conda\\conda\\envs\\py36\\python36.zip',
'C:\\Users\\gsotiropoulos\\AppData\\Local\\conda\\conda\\envs\\py36\\DLLs',
'C:\\Users\\gsotiropoulos\\AppData\\Local\\conda\\conda\\envs\\py36\\lib',
'C:\\Users\\gsotiropoulos\\AppData\\Local\\conda\\conda\\envs\\py36',
'C:\\Users\\gsotiropoulos\\AppData\\Roaming\\Python\\Python36\\site-packages',
'C:\\Users\\gsotiropoulos\\AppData\\Local\\conda\\conda\\envs\\py36\\lib\\site-packages',
'C:\\Users\\gsotiropoulos\\AppData\\Local\\conda\\conda\\envs\\py36\\lib\\site-packages\\win32',
'C:\\Users\\gsotiropoulos\\AppData\\Local\\conda\\conda\\envs\\py36\\lib\\site-packages\\win32\\lib',
'C:\\Users\\gsotiropoulos\\AppData\\Local\\conda\\conda\\envs\\py36\\lib\\site-packages\\Pythonwin',
'C:\\Users\\gsotiropoulos\\AppData\\Local\\conda\\conda\\envs\\py36\\lib\\site-packages\\IPython\\extensions',
'C:\\Users\\gsotiropoulos\\.ipython']
then as suggested I import matplotlib as mpl
and mpl.__path__
seeing that I import matplotlib from the folder 'C:\\Users\\gsotiropoulos\\AppData\\Roaming\\Python\\Python36\\site-packages'
Which is not the one from anaconda and it is older. I am not sure if it would be better to just remove this folder completely.
However, as I understand, python first searched there and found a matplotlib package which was outdated. I simply changed the name of the `matplotlib' to something like 'matplotlib_test' and then the library is installed from one of the anaconda folders and the problem is solved.
As I understand I installed in the past python but the 'roaming' folder did not get unistalled. Is that right? I wonder if I should delete the "roaming" folder to avoid similar other problems.
Upvotes: 1
Views: 1145
Reputation: 2153
I finally started using anaconda and installing everything in one environment. In this way, I save and import everything that I want in this environment without any confusion.
Upvotes: 0
Reputation: 31
A temporary solution is to add the line sys.path.append(/path/to/located/package). A permanent solution is to add the path to .bashrc
Upvotes: 1