4

I've been struggling for hours on a problem that is making me insane. I installed Python 2.7 with Cygwin and added Scipy, Numpy, Matplotlib (1.4.3) and Ipython. When I decided to run ipython --pylab I get the following error:

/usr/lib/python2.7/site-packages/matplotlib/transforms.py in <module>()
 37 import numpy as np
 38 from numpy import ma
 ----> 39 from matplotlib._path import (affine_transform, count_bboxes_overlapping_bbox,
 40     update_path_extents)
 41 from numpy.linalg import inv

 ImportError: No module named _path

I spent hours on the internet, looking for a solution but nothing worked. I did notice that I am missing _path.so files in the matplotlib directory that everybody seems to have. Instead, I have two files: path.py and path.pyc. But I installed matplotlib directly from the official website using pip install and reinstalling it didn't make any difference. Does anyone have a little clue on what is going wrong? I would be incredibly grateful !!!

4
  • 2
    I don't know about your particular error, but most people would just install a Python distro like Anaconda or Canopy rather than add individual components by hand. Commented May 12, 2015 at 16:33
  • Can you run matplotlib in a normal Python interpreter? Commented May 12, 2015 at 16:48
  • 2
    _path is part of the compiled c extensions. Something has gone wrong with your installation/compilation. See matplotlib.org/users/installing.html#building-on-windows Commented May 12, 2015 at 18:46
  • Arawn, did you see any errors when installing matplotlib through pip? It may have been that the compilation of _path.so failed because of a problem with the compilation, but that pip somehow ignored that and installed everything else of matplotlib. Can you find any other *.so files in the matplotlib site-packages directory? Commented May 13, 2015 at 17:09

3 Answers 3

4

For others having this problem, in my case, the solution was simple. The problem was caused by having the wrong matplot library installed on your computer; creating an error in finding the correct matplotlib path. In my case, I had installed matplotlib on a different version of python. Simply update matplotlib on your computer, so that it is compatible with your current version of python:

pip install --upgrade matplotlib

As for the post, I am unsure of what caused these big issues. Hope my tip can help anyone else stumbling upon this issue!

Sign up to request clarification or add additional context in comments.

1 Comment

'pip install --upgrade matplotlib' (upgrade not update). Can't edit the asnwer for some reason.
0

I doubt that most of you brought here by Google have the problem I had, but just in case:

I got the above "ImportError: No module named _path" (on Fedora 17) because I was trying to make use of matplotlib by just setting sys.path to point to where I had built the latest version (1.5.1 at the time). Don't do that.

Once I ran "python setup.py install" (as root) to do a proper install (and got rid of my sys.path hack), the error was fixed.

Comments

0

The package matplotlib requires multiple dependencies (see them here). For me, the missing dependencies included pyparsing and kiwisolver, but your results my vary. Before you do any of these other things (reinstalling python or the library, etc...), make sure you have installed (pip install ...) all the libs in this list (link).

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.