matplotlib Error: No module named matplotlib even though it is installed - python-3.x

No module named matplotlib after installing
I have already installed matplotlib using >> pip3 install matplotlib. As I'm using the latest version of python 3.8.0.
Even updated the PIP to the latest version
After selecting import matplotlib, it says " No module named matplotlib"
While if I tried to install again received message
Requirement already satisfied: matplotlib in c:\program files (x86)\python38-32\lib\site-packages (3.2.0rc1)"
C:\Users\Username>py
Python 3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:21:23) [MSC v.1916 32 bit (Intel)] on win32
>>> import matplotlib
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'matplotlib'
C:\Users\Username>pip install matplotlib
Requirement already satisfied: matplotlib in c:\program files (x86)\python38-32\lib\site-packages (3.2.0rc1)

try pip3 install matplotlib so that it installs it on python3 instead of python2
update: not sure If that's how it works on Windows though, it certainly is on Linux.

Related

How to get Python3 to find installed module?

I'm attempting to install xlsxwriter on CentOS centos-release-7-6.1810.2.el7.centos.x86_64
when I install xlsxwriter:
703404669#bioitutil2:~$ sudo pip3 install xlsxwriter
Requirement already satisfied: xlsxwriter in /usr/lib64/python3.4/site-packages (1.2.6)
and when I attempt to load the module, I get a contradictory message:
703404669#bioitutil2:~$ python3
Python 3.6.8 (default, Aug 7 2019, 17:28:10)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import xlsxwriter
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'xlsxwriter'
I've also tried pip3.6, but get more errors:
703404669#bioitutil2:~$ sudo pip3.6 install xlsxwriter
Traceback (most recent call last):
File "/bin/pip3.6", line 16, in <module>
sys.exit(main())
TypeError: 'module' object is not callable
How can I get python3 to find xlsxwriter?
pip3 install xlsxwriter
gives you
Requirement already satisfied: xlsxwriter in /usr/lib64/python3.4/site-packages (1.2.6)
so it is installed for python3.4, but python3 calls Python 3.6.8, so two different python versions that have their seperate site-package directory.
You can avoid this problem by doing python3 -m pip install, which should
Make sure that you are installing exactly for the python version you are intending to use
Avoid the 'module' object is not callable error
Note
I don't know how you ended up having two python versions, but it might be worth to check if you can uninstall one of them and then use a virtual environment or similar to manage multiple python versions on your system

Linux pyarrow undefined symbol

I am running Python 3.7.2 and using Miniconda3 to create a new environment named test-env. I have installed the pyarrow package from the default channel into this environment; however, when I try and import pyarrow, the Python interpreter gives me an undefined symbol error:
Import Error: /test-env/lib/python3.7/site-packages/pyarrow/lib.cpython-37m-x86_64-linux-gnu.so: undefined symbol: _ZNK5arrow6Status8ToStringB5cxx11Ev
From other threads on SO, I gather that this is due to a compiler incompatibility. I'm not a developer so I'm not sure how to fix this.
I had the same error after I installed by conda install, after I conda uninstall, I did pip install, the issue went away.
>>> import pyarrow
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/dv6/anaconda3/envs/spark/lib/python3.6/site-
packages/pyarrow/__init__.py", line 54, in <module>
from pyarrow.lib import cpu_count, set_cpu_count
ImportError: /home/dv6/anaconda3/envs/spark/lib/python3.6/site-
packages/pyarrow/lib.cpython-36m-x86_64-linux-gnu.so: undefined symbol:
_ZNK5arrow5Field8B5cxx11Ev
>>> quit()
Then I conda uninstall
(spark) dv6#dv6:~$ conda uninstall pyarrow
Then I pip install
(spark) dv6#dv6:~$ pip install pyarrow --user
Collecting pyarrow
Downloading pyarrow-0.16.0-cp36-cp36m-manylinux2014_x86_64.whl (63.1 MB)
|████████████████████████████████| 63.1 MB 25 kB/s
Requirement already satisfied: numpy>=1.14 in
./anaconda3/envs/spark/lib/python3.6/site-packages (from pyarrow) (1.18.1)
Requirement already satisfied: six>=1.0.0 in
./anaconda3/envs/spark/lib/python3.6/site-packages (from pyarrow) (1.14.0)
Installing collected packages: pyarrow
Successfully installed pyarrow-0.16.0
(spark) dv6#dv6:~$ python -c "import pyarrow"
(spark) dv6#dv6:~$
Here is my Python version
(spark) dv6#dv6:~$ python
Python 3.6.10 |Anaconda, Inc.| (default, Jan 7 2020, 21:14:29)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
I would recommend opening a ticket at https://issues.apache.org/jira/projects/ARROW/issues/ARROW-4774?filter=allopenissues
Provide how you installed pyarrow (pip or conda), which distribution of linux. If you can reproduce this in a clean environment, even better.

When importing tensorflow, I get the following error: No module named 'numpy.core._multiarray_umath'

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.

ImportError: No module named sip

I have installed electrum alongwith python 3.4, But when i run electrum it gives me below error. And I installed pyqt5 without --no-deps.
pip3.4 install pyqt5 --no-deps
pip3.4 install https://download.electrum.org/3.1.3/Electrum-3.1.3.tar.gz
#electrum
Traceback (most recent call last):
File "/usr/local/bin/electrum", line 418, in <module>
d.init_gui(config, plugins)
File "/usr/local/lib/python3.4/site-packages/electrum/daemon.py", line 308, in init_gui
gui = __import__('electrum_gui.' + gui_name, fromlist=['electrum_gui'])
File "/usr/local/lib/python3.4/site-packages/electrum_gui/qt/__init__.py", line 35, in <module>
from PyQt5.QtGui import *
ImportError: No module named 'sip'
I also upgraded pip. Getting error with deps:
pip3.4 install pyqt5
# pip3.4 install pyqt5
Requirement already satisfied: pyqt5 in /usr/local/lib/python3.4/site-packages
Collecting sip>=4.19.1 (from pyqt5)
Could not find a version that satisfies the requirement sip>=4.19.1 (from pyqt5) (from versions: )
No matching distribution found for sip>=4.19.1 (from pyqt5)
You are using pip version 9.0.1, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
I think the problem is because you are using Python 3.4.
According to the documentation of PyQt5, if you install from wheel, Python 3.5 is the minimum requirement.
Not a Problem just try it
First, activate your virtual env in your cmd using this,
./utfod/Scripts/activate
If error come like: cannot be loaded because running scripts is disabled on this system, Then for Solution execute this,
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser
command first in powershell then
./utfod/Scripts/activate

Something wrong with scikits.talkbox with Python3?

I am migrating a Python program from 2.10 to 3.6. The packages scikits.talkbox is part of it. However, I cannot figure out how to use it any more. The installation from pip seems to work fine but I cannot import it. Has anyone faced this problem before ?
[manjaro#manjaro-pc ~]$ python --version
Python 3.6.0
[manjaro#manjaro-pc ~]$ sudo pip install scikits.talkbox
Collecting scikits.talkbox
Using cached scikits.talkbox-0.2.5.tar.gz
Requirement already satisfied: numpy in /usr/lib/python3.6/site-packages (from scikits.talkbox)
Installing collected packages: scikits.talkbox
Running setup.py install for scikits.talkbox ... done
Successfully installed scikits.talkbox-0.2.5
[manjaro#manjaro-pc ~]$ python
Python 3.6.0 (default, Jan 16 2017, 12:12:55)
[GCC 6.3.1 20170109] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import scikits.talkbox
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.6/site-packages/scikits/talkbox/__init__.py", line 5, in <module>
__all__ += tools.__all__
AttributeError: module 'tools' has no attribute '__all__'
The answer to your question is this link Error while importing scikits.talkbox
Even I am facing this issue
I have switched to librosa
There is another way for MFCC features: python_speech_features
http://python-speech-features.readthedocs.io/en/latest/

Resources