Issue
I've just completed the installation of Anaconda on my MacBook Pro (running OS X 10.10 Yosemite). I installed the recommended package, which includes Python 2.7.
The versions I have of the (I think) pertinent packages are: Numpy: 1.9.0 Scipy: 0.14.0 IPython: 2.2.0 matplotlib: 1.4.0
I was following the instructions for testing the installation listed here: https://python4astronomers.github.io/installation/python_install.html#test-the-installation
Everything was fine, except for running IPython with matplotlib integration. Based on the guide on that page (which do not tell you to explicitly import matplotlib), and on my limited knowledge of IPython, I was under the impression that invoking IPython with
ipython --matplotlib
would "automagically" import the matplotlib modules somehow.
However, when I typed the line below into the IPython interpreter session:
print(matplotlib.__version__)
an error message was displayed which indicated that matplotlib was unavailable:
NameError
Traceback (most recent call last)
<ipython-input-1-dc737d9da186> in <module>()
----> 1 print(matplotlib.__version__)
NameError: name 'matplotlib' is not defined
However, IPython does say this when it is invoked:
IPython 2.2.0 -- An enhanced Interactive Python.
...
Using matplotlib backend: MacOSX
I know that IPython develops at a rapid pace, so my question is:
Did I miss something in the installation process (although it was performed using the Anaconda pre-compiled binary installer), or has the was matplotlib integration is achieved with IPython changed, or could the set of instructions I followed for testing the installation be missing something? I checked that site for a way to contact those guys before coming here, but I could not find it.
I've been through period of extraordinary hair loss due to having pulled huge tufts of it out while trying to sort out $PATH issues with Python and related problems while using Python on OS X, so this time I went with Anaconda and am just trying to quash any problems that may arise before I further complicate the situation by installing other modules not included with Anaconda.
Thanks in advance!
Solution
All the --matplotlib option does is set IPython up to display images generated by matplotlib so they are not blocking. It doesn't import anything. You still have to import matplotlib manually.
Answered By - moorepants
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.