I installed matplotlib on Anaconda Prompt with conda install -c conda-forge matplotlib.
However, when I run import matplotlib.pyplot as plt on Spyder 4.1.5 (with Python 3.7), I got an error message:
ModuleNotFoundError: No module named 'matplotlib.pyplot'
Before getting this error message, I installed matplotlib_scalebar with conda install -c conda-forge matplotlib-scalebar. I had no issue importing matplotlib.pyplot before this, and I suspect that installing this might have caused the problem.
Under C:\ProgramData\Anaconda3\Lib\site-packages, I have folders with the following names:
matplotlib
matplotlib-3.0.2.dist-info
matplotlib-3.3.2.dist-info
I'm not sure if having different folders (3.0.2 and 3.3.2) is an issue here.
How can I fix this No module issue?
Related
I just got a new computer and after downloading the newest version of the anaconda distribution I tried to install geopandas and run my script.
However, the gpd.read_file command causes an ImportError.
I have been trying to reinstall everything but nothing changed.
Does anybody know how to figure this out?
import geopandas as gpd
path = "C:/someshapefile.shp"
gpd.read_file(path)
ImportError: The 'read_file' function requires the 'pyogrio' or
'fiona' package, but neither is installed or imports correctly.
Importing fiona resulted in:
DLL load failed while importing ogrext: The specified module could not be found.
Importing pyogrio resulted in:
No module named 'pyogrio'
Just installing fiona manually like this:
conda install -c conda-forge fiona
did unfortunately not work for me.
Thanks a lot!
CM
git issue comment
python -m pip install git+https://github.com/Toblerity/Fiona.git
working for me
I have installed rioxarray using anaconda command prompt with the following code:
conda install -c conda-forge rioxarray
However, whenever I import the package it gives me error as: Module not Found.
I am installing it by creating a new environment. Please help
I have error on Jupyter Notebook with macOS as below
ImportError Traceback (most recent call last)
in
----> 1 from mpl_toolkits.basemap import Basemap
seems have problem on installing Basemap. So I tried,
(1) !conda install -c anaconda basemap -y
: installed successfully according to message. And closed all browser and restarted but still have ImportError.
(2) Installed anaconda and tried to install basemap from "Environments" tab by select basemap from "Not Installed" list, check and apply.
But I have another error as below
UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:
Specifications:
basemap -> python[version='>=3.5,<3.6.0a0|>=3.9,<3.10.0a0']
Your python: python=3.8
If python is on the left-most side of the chain, that's the version you've asked for.
When python appears to the right, that indicates that the thing on the left is somehow
not available for the python version you are constrained to. Note that conda will not
change your python version to a different minor version unless you explicitly specify
that.
But my python version is 3.9.5
How can I install Basemap to avoid ImportError?
Resolved by running follow line on Jupyter
conda install -c conda-forge basemap matplotlib==3.1 -y
I have installed Ancaconda3 and Tensorflow. When I try to import Tensorflow in python shell I receive the following error:
ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'
ImportError: numpy.core.multiarray failed to import
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "", line 980, in _find_and_load SystemError:
<class '_frozen_importlib._ModuleLockManager'> returned a result with
an error set ImportError: numpy.core._multiarray_umath failed to
import ImportError: numpy.core.umath failed to import
I am not sure what the problem is as numpy is installed on my system and can be successfully imported in python.
I am using Windows10.
I also had the same issue.
It got resloved once I upgraded the numpy from 1.15.4 to 1.16.1.
If you're using pip:
pip install numpy --upgrade
Numpy that came with Anaconda3 is of version 1.15.4. so i upgraded and it worked.
Side note: if you're also using scikit-image in your script, be aware that numpy 1.16.3 has a conflict with old versions of scikit-image (e.g. you may get ImportError: cannot import name '_validate_lengths'). In that case, pip install --upgrade scikit-image from terminal solved the issue for me.
Kindly check whether you have installed the numpy package from pip. Because if you are running on conda evironment, then all packages need to be downloaded from there.
Please use the below mentioned statement for this purpose
conda install -c anaconda numpy
Also make sure that the numpy version supports the Python version you are using.
You can use two options in python 3.6
Install
py pip -m install numpy==1.14.5
Upgrade
py pip install numpy --upgrade
Note: the version most recently is 1.14.5
I also had this issue with python 3.8.9 and Numpy 1.24.1.
Downgrading to Numpy 1.21.0 fixed the issue.
I installed seaborn package through conda:
~user: conda install seaborn
The following NEW packages will be INSTALLED:
seaborn: 0.8-py27_0
The following packages will be UPDATED:
conda: 4.3.8-py27_0 --> 4.3.30-py27h407ed3a_0
matplotlib: 1.4.3-np19py27_2 --> 1.5.3-np111py27_1
statsmodels: 0.6.1-np19py27_0 --> 0.8.0-np111py27_0
And it messed up my matplotlib installation, now when I run my python script, it raises an error when importing matplotlib:
ImportError: dlopen(/Users/.../anaconda/lib/python2.7/site-packages/matplotlib/_png.so, 2): Library not loaded: #rpath/libpng16.16.dylib
Referenced from: /Users/.../anaconda/lib/python2.7/site-packages/matplotlib/_png.so
Reason: Incompatible library version: _png.so requires version 39.0.0 or later, but libpng16.16.dylib provides version 34.0.0
This error can be caused by old version of conda. You need to first update conda and then try again.
conda update conda
Try this from your conda command prompt:
conda install -c anaconda seaborn