Fix matplotlib / numpy addiction hell in Anaconda

I am running Python 2.7.11 under Anaconda 2.0.0 (x86_64) on a MacBook.

A few weeks ago, as part of the OpenCV process, I downgraded numpy from where it was (unfortunately / stupid, I don't have a record) to 1.7.1. I seem to remember that it was necessary, and I don’t want OpenCV to stop working, so I’m sure now I have to leave numpy where it is.

However, today I discovered that it broke my matplotlib / pylab . When I do import pylab , I get the following:

 --------------------------------------------------------------------------- RuntimeError Traceback (most recent call last) RuntimeError: module compiled against API version 9 but this version of numpy is 7 --------------------------------------------------------------------------- ImportError Traceback (most recent call last) ... ... ImportError: numpy.core.multiarray failed to import 

So my question is: how do I install (or roll back) a version of matplotlib compatible with existing numpy , without breaking existing numpy ?

Here's where I am so far: based on conda related questions on SO, I looked at the output of conda list --revisions matplotlib , which includes:

 ... 2016-03-28 17:16:36 (rev 6) conda {3.8.3 -> 4.0.5} conda-env {2.0.1 -> 2.4.5} numpy {1.8.1 -> 1.7.1} ... 

Now I'm not sure how to interpret this, but given the numpy version number, it looks like it actually crashes unlike all the other entries here, it sounds promising to me, "in March 2016 matplotlib realized this could go back to an earlier version its numpy dependencies. " However, when I ask for this review:

 conda install --revision=6 matplotlib 

I was told that I already have this, and that its numpy 1.8 dependency:

 Fetching package metadata: .... # All requested packages already installed. # packages in environment at /Users/jez/anaconda: # matplotlib 1.3.1 np18py27_1 <unknown> 

So, I'm not sure how to proceed. I supposedly played with some variations on conda install matplotlib , but it clearly wants to communicate with my numpy at the same time, so I never pressed y . Likewise, I'm not in my depths in conda , so I really appreciate your help.

+5
source share
1 answer

You can specify the exact versions of any libraries that you want to use in the conda install command. For instance:

 $ conda install numpy=1.7.1 matplotlib=1.3 

If the versions are incompatible, the command will give you an error that accurately determines what incompatibility is.

+6
source

Source: https://habr.com/ru/post/1247739/


All Articles