I am trying to update my matplotlib in virtualenv and now it seems everything crashed :(
what I did till now is basically,
source ~/myenv/bin/activate
pip install -U matplotlib
I had previously matplotlib 1.3 now if I activate py virtual environment and check the matplotlib version it shows 2.1
but I cannot import Axes3D from matplotlib.
>>> import importlib
>>> importlib.import_module('mpl_toolkits.mplot3d').__path__
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/nld/python-2.7.6-freya/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/usr/vir_python/lib/python2.7/site-packages/mpl_toolkits/mplot3d/__init__.py", line 6, in <module>
from .axes3d import Axes3D
File "/home/usr/vir_python/lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.py", line 32, in <module>
from matplotlib.cbook import _backports
ImportError: cannot import name _backports
I working on linux platform and using Python 2.7.
Further problem, I saw,
If I just open virtual python, without activating the virtualenv, I get matplotlib 2.1
$:~> myenv/bin/python
Python 2.7.6 (default, Apr 15 2014, 11:17:36)
[GCC 4.3.4 [gcc-4_3-branch revision 152973]] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
>>> matplotlib.__version__
'2.1.0'
but if I activate the virtual environment and then open the virtual python with I get matplotlib 1.3.1 or old matplotlib.
$:~> source myenv/bin/activate
(vir_python)$:~> myenv/bin/python
Python 2.7.6 (default, Apr 15 2014, 11:17:36)
[GCC 4.3.4 [gcc-4_3-branch revision 152973]] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
>>> matplotlib.__version__
'1.3.1'
I did the following as per Karthik's suggestion :
First activated the virtual python
(vir_python) $: pip install matplotlib==2.1.0
(vir_python) $: pip freeze
backports.functools-lru-cache==1.4
backports.ssl-match-hostname==3.4.0.2
cycler==0.10.0
imageio==2.1.2
Jinja2==2.7.2
MarkupSafe==0.19
matplotlib==1.3.1
mpi4py==2.0.0
nose==1.3.1
numpy==1.12.0
olefile==0.44
pandas==0.19.2
Pillow==4.0.0
pyparsing==2.0.1
python-dateutil==2.6.0
pytz==2016.10
scipy==0.19.0
six==1.10.0
subprocess32==3.2.7
svg.path==1.1
tornado==3.2
virtualenv==1.11.4
Your virtualenv has a local matplotlib installed.
After sourcing activate, upgrade matplotlib using
pip install matplotlib==2.1.0
or
pip install --upgrade matplotlib
plt.__version__
>> 3.0.0
this is current version of matplotlib in my system.
In the terminal, give the following comments:
$source activate envname
$pip install --upgrade matplotlib
In python prompt,
import matplotlib as plt
plt.__version__
>> 3.0.2
updates the existing version
Related
I have tried to install matplotlib in my environment "cs323V2"with the following commands:
(cs323V2) conda install matplotlib
Collecting package metadata (current_repodata.json): done
Solving environment: done
# All requested packages already installed.
Retrieving notices: ...working... done
(cs323V2) python
Python 2.7.5 (default, Nov 16 2020, 22:23:17)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
[3]+ Stopped python
>>> import matplotlib
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'matplotlib'
Use the conda-forge channel.
conda install -c conda-forge matplotlib
I am not really sure why only
conda install matplotlib
does not work.
I am trying to run a python script which needs numpy module ,when I try to install it,it shows it is already present, when I run import numpyit throws the error ImportError: No module named numpy,any guidance on what is wrong?
[username#machine build]$ pip install numpy
You are using pip version 7.1.0, however version 18.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Requirement already satisfied (use --upgrade to upgrade): numpy in /usr/lib64/python2.6/site-packages
Below command shows numpy is not installed
[username#machine build]$ python
Python 2.7.12 (default, Feb 22 2017, 20:16:44)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-11)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print(sys.version)
2.7.12 (default, Feb 22 2017, 20:16:44)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-11)]
>>> import numpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named numpy
If you're running Linux then use python2.7 -m pip install numpy
For python version 2.7 use python2.7 -m pip install numpy
Alternatively, on Windows under bash use py -2.7 -m pip install numpy
I am installing MultiNEAT at conda.
conda create -n py35 python=3.5
source activate py35
conda install multineat -c conda-forge
The installation ended normally, but when importing, the following error appears
python
Python 3.5.6 |Anaconda, Inc.| (default, Aug 26 2018, 21:41:56)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import MultiNEAT
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/bc/anaconda3/envs/py35/lib/python3.5/sitepackages/MultiNEAT/__init__.py", line 3, in <module>
from ._MultiNEAT import *
ImportError: libboost_system.so.1.67.0: cannot open shared object file: No such file or directory
Please tell me how to resolve
Looks like the shared object packaged for linux is linked to a specific version of libboost (1.67.0), even though the conda dependency only specifies >=1.66. Installing that version from conda-forge seems to be sufficient:
conda install -n py35 -c conda-forge boost=1.67.0 boost-cpp=1.67.0
You may want to pin these versions so future updates don't mess it up. Also, consider dropping an issue on the GitHub.
I used pip3 to install tensorflow.. And after installation, I can find it in
/usr/local/lib/python3.6/site-packages
Besides, I use pip3 list and find it on the list:
vincent#ubuntu:/usr/local/lib/python3.6/site-packages/tensorflow$ pip3 list
backports.weakref (1.0rc1)
bleach (1.5.0)
html5lib (0.9999999)
Markdown (2.6.8)
numpy (1.13.1)
pip (9.0.1)
protobuf (3.3.0)
setuptools (28.8.0)
six (1.10.0)
tensorflow (1.2.1)
Werkzeug (0.12.2)
wheel (0.29.0)
But but I failed to import it in python3.6
vincent#ubuntu:/usr/local/lib/python3.6/site-packages/tensorflow$ python
Python 3.6.1 |Anaconda 4.4.0 (64-bit)| (default, May 11 2017, 13:09:58)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'tensorflow'
>>>
What's wrong with it?
I ran it in Linux14.04(x64) in VMware
There may be multiple versions of python installed. You can do the following to ensure that tensorflow is installed for the version you are using -
python -mpip install tensorflow
Here I assume that you are using python prompt to run python. If you are using a different prompt just use that in place of python.
on Ubuntu I installed Anaconda3-2.1.0-Linux-x86_64, works fine however the version 1.4.2 is not activated in python, how can I activate it ?
pip freeze
matplotlib==1.4.2
python in a shell
Python 3.3.2+ (default, Feb 28 2014, 00:52:16)
[GCC 4.8.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
>>> matplotlib.__version__
'1.2.1'
ipython
In [1]: import matplotlib
In [2]: matplotlib.__version__
Out[2]: '1.4.2'
paths
which python
/home/xxx/anaconda3/bin/python
which ipython
/home/xxx/anaconda3/bin/ipython
I tried to create a virtual environment with
conda create -n py34 matplotlib=1.4.2
The following NEW packages will be INSTALLED:
....
matplotlib: 1.4.2-np19py34_0
....
pip is at least consistent with python in the environment
(py34)pip freeze
matplotlib==1.2.1