AttributeError with pip install matplotlib - python-2.7

I am attempting to install matplotlib with pip inside a virtualenv on Ubuntu Linux. I already have a bunch of packages installed successfully - this is the one that's failing. As the output indicates, This is python 2.7.3 and all of the dependencies are already present.
Is this specific to v1.4.3 of matplotlib? Should I perhaps install an earlier version? I've even manually installed mock (v1.3.0), since the install seems to fail on trying to import it, but that didn't help either.
Here is the output:
Collecting matplotlib
Using cached matplotlib-1.4.3.tar.gz
Complete output from command python setup.py egg_info:
============================================================================
Edit setup.cfg to change the build options
BUILDING MATPLOTLIB
matplotlib: yes [1.4.3]
python: yes [2.7.3 (default, Jun 22 2015, 19:33:41) [GCC
4.6.3]]
platform: yes [linux2]
REQUIRED DEPENDENCIES AND EXTENSIONS
numpy: yes [version 1.9.2]
six: yes [using six version 1.9.0]
dateutil: yes [using dateutil version 2.4.2]
pytz: yes [using pytz version 2015.4]
tornado: yes [tornado was not found. It is required for the
WebAgg backend. pip/easy_install may attempt to
install it after matplotlib.]
pyparsing: yes [using pyparsing version 2.0.3]
pycxx: yes [Couldn't import. Using local copy.]
libagg: yes [pkg-config information for 'libagg' could not
be found. Using local copy.]
freetype: yes [version 2.4.8]
png: yes [version 1.2.46]
qhull: yes [pkg-config information for 'qhull' could not be
found. Using local copy.]
OPTIONAL SUBPACKAGES
sample_data: yes [installing]
toolkits: yes [installing]
Traceback (most recent call last):
File "<string>", line 20, in <module>
File "/tmp/pip-build-mHyI6G/matplotlib/setup.py", line 155, in <module>
result = package.check()
File "setupext.py", line 666, in check
import mock
File "/home/awarnock/PyProjects/OMTO3dIMG/local/lib/python2.7/site-packages/mock/__init__.py", line 2, in <module>
import mock.mock as _mock
File "/home/awarnock/PyProjects/OMTO3dIMG/local/lib/python2.7/site-packages/mock/mock.py", line 71, in <module>
_v = VersionInfo('mock').semantic_version()
AttributeError: 'VersionInfo' object has no attribute 'semantic_version'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip- build-mHyI6G/matplotlib
Thanks in advance for any suggestions.

You can try with:
pip install oslo.utils
Or:
pip install testrepository
pip install oslo.utils
You can also install it with packages:
Debian / Ubuntu:
apt-get install python-matplotlib
Redhat / CentOS:
yum install python-matplotlib

Related

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-dxjZrU/pyproj/ when installing 'geopandas'

Before going to the topic, my computer information:
OS: Debian jessie, Python version: 2.7
I need to install the module "geopandas" for a project i am working on. The problem is that when i tried, i receive the following error:
root#debian:~# pip install geopandas
Collecting geopandas
Using cached https://files.pythonhosted.org/packages/0a/0e/8ae74743ed7915ddb7d70cc8dfa8fc0b9b9cc81205c6e288a01915a46192/geopandas-0.3.0-py2.py3-none-any.whl
Collecting pyproj (from geopandas)
Using cached https://files.pythonhosted.org/packages/29/72/5c1888c4948a0c7b736d10e0f0f69966e7c0874a660222ed0a2c2c6daa9f/pyproj-1.9.5.1.tar.gz
Complete output from command python setup.py egg_info:
unable to execute 'i586-linux-gnu-gcc': No such file or directory
using bundled proj4..
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-dxjZrU/pyproj/setup.py", line 72, in <module>
objects = cc.compile(['nad2bin.c', 'src/pj_malloc.c'])
File "/usr/lib/python2.7/distutils/ccompiler.py", line 574, in compile
self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
File "/usr/lib/python2.7/distutils/unixccompiler.py", line 122, in _compile
raise CompileError, msg
distutils.errors.CompileError: command 'i586-linux-gnu-gcc' failed with exit status 1
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-dxjZrU/pyproj/
I also looked other questions in this website about similiar problems, most of people recommend to update the setuptools, i have done that and still doesn't work, here the prove:
root#debian:~# pip install --upgrade setuptools
Requirement already up-to-date: setuptools in /usr/local/lib/python2.7/dist-packages (39.2.0)
If anyone could help me with that i will be really happy
Thanks
Debian 8 Jessie, 32bit
'i586-linux-gnu-gcc': No such file or directory
# apt install g++ gfortran python-all-dev python-numpy libgdal-dev libgeos-dev python-matplotlib
# pip install geopandas
.
.
Running setup.py install for munch
Successfully installed geopandas shapely pandas fiona descartes pyproj python-dateutil numpy cligj click-plugins munch enum34 click
Cleaning up...

ImportError: libcusolver.so.8.0: cannot open shared object file: No such file or directory

Possible duplicate of this question.
I have a gpu account to whom I connect through putty (ssh login). I have created a virtualenv there and I am installing tenorflow through pip for gpu. Everything works fine, when I run command
$ pip list
following list is being shown:
backports.weakref (1.0rc1)
bleach (1.5.0)
funcsigs (1.0.2)
html5lib (0.9999999)
Markdown (2.6.8)
mock (2.0.0)
numpy (1.13.1)
olefile (0.44)
pbr (3.1.1)
Pillow (4.2.1)
pip (9.0.1)
protobuf (3.3.0)
setuptools (36.0.1)
six (1.10.0)
tensorflow-gpu (1.2.1)
Werkzeug (0.12.2)
wheel (0.29.0)
But when I run:
$ python
>>> import tensorflow
It shows the following error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/nauman/junaid/final/test/lib/python2.7/site-
packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/home/nauman/junaid/final/test/lib/python2.7/site-
packages/tensorflow/python/__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "/home/nauman/junaid/final/test/lib/python2.7/site-
packages/tensorflow/python/pywrap_tensorflow.py", line 52, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/home/nauman/junaid/final/test/lib/python2.7/site-
packages/tensorflow/python/pywrap_tensorflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/home/nauman/junaid/final/test/lib/python2.7/site-
packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in
<module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/home/nauman/junaid/final/test/lib/python2.7/site-
packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in
swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname,
description)
ImportError: libcusolver.so.8.0: cannot open shared object file: No such
file or directory
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/install_sources#common_installation_problems
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
I have also set my environment variables like this:
export CUDA_HOME=/opt/cuda
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$CUDA_HOME/lib64:$CUDA_HOME/extras/CUPTI/lib64"
Moreover, I found that libcusolver.so.8.0 is not there, while libcusolver.so.7.5
is there in cuda/lib64/.
Somehow tensorflow is finding wrong file or I ain't know nothing.
Any help would be appreciated as I am new to all this stuff.
Python version: 2.7
OS: Linux
This may be connected to the incorrect linking of your libraries.
Simply run sudo ldconfig /usr/local/cuda/lib64. It solved for me.
If you need to know more: ldconfig man page.
I solved the issue. Actually I have cuda 7.5 installed and I was installing latest tensorflow version which probably support cuda 8.0.
So I downgraded.
pip install --upgrade \ https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.10.0-cp27-none-linux_x86_64.whl
If you installed tensorflow-gpu by using pip with prebuilt .whl, the cuda version were fixed. As far as I know, starting 0.11.0rc1, all the prebuilt packages are now built for cuda 8. So there are two ways to solve the problem:
install cuda 8 for the prebuilt packages tensorflow-gpu >= 0.11.orc1
keep cuda 7.5 stay, then build tensorflow-gpu from source code
If you are using cuda-9.0 try sudo apt install nvidia-cuda-dev (if you are using an Ubuntu distribution)

Python modules not installing

I had some code that was running just fine, and over the course of the day, I broke something, and now I cannot install any python modules. Specifically, I need numpy, matplotlib, and pillow. I cannot install any of them.
But the weird part is that they both appear to install just fine:
$ sudo pip install numpy
Collecting numpy
Downloading numpy-1.11.0-cp27-cp27mu-manylinux1_x86_64.whl (15.3MB)
100% |████████████████████████████████| 15.3MB 94kB/s
Installing collected packages: numpy
Successfully installed numpy-1.11.0
Or when I try:
$ sudo apt-get install python-numpy
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
python-nose python-numpy-dbg python-numpy-doc
The following NEW packages will be installed:
python-numpy
0 upgraded, 1 newly installed, 0 to remove and 20 not upgraded.
Need to get 0 B/1,763 kB of archives.
After this operation, 9,598 kB of additional disk space will be used.
Selecting previously unselected package python-numpy.
(Reading database ... 221259 files and directories currently installed.)
Preparing to unpack .../python-numpy_1%3a1.11.0-1ubuntu1_amd64.deb ...
Unpacking python-numpy (1:1.11.0-1ubuntu1) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up python-numpy (1:1.11.0-1ubuntu1) ...
I am using python 2.7, and I am on Ubuntu 16.04.
$ python
Python 2.7.5 (default, May 12 2016, 13:11:58)
[GCC 5.3.1 20160413] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named numpy
>>>
It does this for any module I try and install. Any help would be greatly appreciated.
This is a result of the default python and the default pip not matching up. To ensure that packages are being installed to the correct location, use:
python -m pip install $PACKAGE
This results in running the pip assigned to the desired python rather than the first one found in your path.

libspatialindex and Rtree on python

Okay, so I am trying to install libspatialspatialindex to my Ubuntu machine python. I did follow all the instructions and downloaded libspatialindex1_1.4.0-1.1_amd64.deb from http://packages.ubuntu.com/lucid/libspatialindex1 and downloaded the amd64 version of it as my machine is 64bits machine. I installed it and then jumped to Rtree python https://pypi.python.org/pypi/Rtree to download and install the Rtree in python. I followed the installation instruction given in the install.txt file inside the folder. It says run the local setup.py by $ python setup.py install I did that as well but what I get after that is
`root#ubuntu:/# cd /home/neelabh/Desktop/Rtree
root#ubuntu:/home/neelabh/Desktop/Rtree# python setup.py install
Traceback (most recent call last):
File "setup.py", line 4, in <module>
import rtree
File "/home/neelabh/Desktop/Rtree/rtree/__init__.py", line 1, in <module>
from .index import Rtree
File "/home/neelabh/Desktop/Rtree/rtree/index.py", line 6, in <module>
from . import core
File "/home/neelabh/Desktop/Rtree/rtree/core.py", line 110, in <module>
rt.Error_GetLastErrorNum.restype = ctypes.c_int
File "/usr/lib/python2.7/ctypes/__init__.py", line 378, in __getattr__
func = self.__getitem__(name)
File "/usr/lib/python2.7/ctypes/__init__.py", line 383, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: python: undefined symbol: Error_GetLastErrorNum`
Can somebody please help me in resolving this issue!
I really appreciate in advance!
You have to install the package "libspatialindex-dev" with the systems package manager. At least this is true with my system (Mint 17.1) which should be 100% compatible to a default Ubuntu installation.
You have to install libspatialindex-dev in your ubuntu system. Here i am using ubuntu 16.04 or 18.04
sudo apt update
sudo apt install libspatialindex-dev
install Rtree using your python pip version, i have pip 3.7
pip3.7 install Rtree
import rtree

Python 2.7.4 on Ubuntu 10.04, Import readline error(Tried many ways never work)

As in the title, my system version is Ubuntu 10.04. The default version of Python is 2.6.5.
When I start python2.6 in command line and
import readline
This works well.
Then I compile the python 2.7.4 (Downloaded from www.python.org/getit). Nightmare began.
Here is how I installed Python 2.7.4:
./configure --prefix=/usr
make
su root
make install
Then tried import readline:
Python 2.7.4 (default, Apr 11 2013, 11:17:09)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import readline
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named readline
Googled, firstly what I did is
sudo apt-get install libreadline5-dev
sudo ldconfig
Reinstall, does not work.
Then tried to install libpython and reinstall python 2.7.4, still does not work.
But the strange thing is that at the last few lines of command "make", the information is like this:
Python build finished, but the necessary bits to build these modules were not found:
_bsddb _sqlite3 bsddb185
bz2 dbm gdbm
sunaudiodev
To find the necessary bits, look in setup.py in detect_modules() for the module's name.
Seems there is no readline, but it just does not work!
BTW, here is another information might help:
/usr/bin/python -c "import readline; print readline.__doc__"
Importing this module enables command line editing using GNU readline.
Anyone can help me for this...
Thank you in advance.
I tried again, installed these packets:
sudo apt-get install build-essential
sudo apt-get install libreadline5-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
Then remove everything about python2.7 including in /usr/local/bin, /usr/bin, etc and reinstall.
This time it works...
Ok...Hope this will help people who has the same problem with me.