ImportError: no module named pkg_resources when installing matplotlib

This is on CentOs 6.6. I am trying to create a python science environment. I want to avoid Anaconda. When I try to install matplotlib, I get "ImportError: No module named pkg_resources". Full installation history:

sudo yum install gcc-c++.x86_64 sudo yum install gcc sudo yum install atlas atlas-devel lapack-devel blas-devel sudo yum install python-devel sudo pip install numpy sudo pip install scipy sudo pip install pandas sudo pip install matplotlib 

In the last step, I get a message

 Complete output from command python setup.py egg_info: The required version of distribute (>=0.6.28) is not available, and can't be installed while this script is running. Please install a more recent version first, using 'easy_install -U distribute'. 

Then i do

 sudo pip install --upgrade distribute 

which installs distribute-0.7.3 , setuptools-18.0.1 . Then:

 sudo pip install matplotlib 

that leads to:

 File "/usr/bin/pip", line 5, in <module> from pkg_resources import load_entry_point ImportError: No module named pkg_resources 

Any ideas?

Update

After the above steps, setuptools and pip will be broken in this installation. From the python shell, running help() followed by modules does not display setuptools . A file search for setuptools directories shows:

 /usr/lib/python2.6/site-packages/setuptools-18.0.1.dist-info/ 

while the setuptools.pth file in /usr/lib/python2.6/site-packages/ contains a pointer to a nonexistent ./setuptools-0.6c11-py2.6.egg-info .

At the same time, there is a directory

 /usr/share/doc/python-setuptools-0.6.10/ 

After that, the pip no longer works.

+5
source share
3 answers

@pavan they told CentOS, so apt is unlikely to help them.

They could, however, do:

 yum remove python-setuptools yum install python-setuptools 

(I also need to reinstall pip: yum install python-pip)

And that can solve the problem.

+2
source

Try this for OSs supporting apt-get (Ubuntu etc.)

sudo apt-get install python-pkg-resources python-setuptools --reinstall

+1
source

Try installing python-pip (and dependencies):

 yum install python-pip 

This solved my problem (Centos release 6.8).

0
source

All Articles