I cannot get matplotlib to work under a virtualenv in Ubuntu 20.04.
(myenv) $ pip3 install matplotlib
Requirement already satisfied: matplotlib in /usr/lib/python3/dist-packages (3.1.2)
(myenv) $ pip3 list | grep matplotlib
matplotlib 3.1.2
(myenv) $ python3
Python 3.8.2 (default, Mar 26 2020, 15:53:00)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
Reading /home/user1/.pythonrc
readline is in /home/user1/apps/anaconda3/envs/myenv/lib/python3.8/lib-dynload/readline.cpython-38-x86_64-linux-gnu.so
>>> import matplotlib
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'matplotlib'
>>>
But it works under the base
virtualenv
(base) $ python3
Python 3.7.6 (default, Jan 8 2020, 19:59:22)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
Reading /home/user1/.pythonrc
readline is in /home/user1/apps/anaconda3/lib/python3.7/lib-dynload/readline.cpython-37m-x86_64-linux-gnu.so
>>> import matplotlib
>>>
Note the different python versions.
I don't recall doing any upgrade, I simply create myenv
with conda create -n myenv
.
I find it puzzling. How can I fix this?