matplotlib not working in Jupyter lab - anaconda

import matplotlib and
%matplotlib inline are not working. Getting the following errors.
On the anaconda prompt I ran this command as well.
conda install matplotlib
Even after this, this did not work.
Just observed a strange thing.
When I launched using the command jupyter lab from the anaconda prompt, microsoft edge browser launched. And in that this works fine. But when I opened in chrome browser, this gives the problem.
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-0484cd13f94d> in <module>()
----> 1 import matplotlib
ModuleNotFoundError: No module named 'matplotlib'
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-2-9e3324102725> in <module>()
----> 1 get_ipython().run_line_magic('matplotlib', 'inline')
~\AppData\Local\conda\conda\envs\scipy18jlab\lib\site-
packages\IPython\core\interactiveshell.py in run_line_magic(self,
magic_name, line, _stack_depth)
2129 kwargs['local_ns'] =
sys._getframe(stack_depth).f_locals
2130 with self.builtin_trap:
-> 2131 result = fn(*args,**kwargs)
2132 return result
2133
<decorator-gen-108> in matplotlib(self, line)
~\AppData\Local\conda\conda\envs\scipy18jlab\lib\site-
packages\IPython\core\magic.py in (f, *a, **k)
185 # but it's overkill for just that one bit of state.
186 def magic_deco(arg):
--> 187 call = lambda f, *a, **k: f(*a, **k)
188
189 if callable(arg):
~\AppData\Local\conda\conda\envs\scipy18jlab\lib\site-
packages\IPython\core\magics\pylab.py in matplotlib(self, line)
97 print("Available matplotlib backends: %s" %
backends_list)
98 else:
---> 99 gui, backend = self.shell.enable_matplotlib(args.gui)
100 self._show_matplotlib_backend(args.gui, backend)
101
~\AppData\Local\conda\conda\envs\scipy18jlab\lib\site-
packages\IPython\core\interactiveshell.py in enable_matplotlib(self, gui)
3035 """
3036 from IPython.core import pylabtools as pt
-> 3037 gui, backend = pt.find_gui_and_backend(gui,
self.pylab_gui_select)
3038
3039 if gui != 'inline':
~\AppData\Local\conda\conda\envs\scipy18jlab\lib\site-
packages\IPython\core\pylabtools.py in find_gui_and_backend(gui,
gui_select)
271 """
272
--> 273 import matplotlib
274
275 if gui and gui != 'auto':
ModuleNotFoundError: No module named 'matplotlib'

I am not sure why, pasting the entire url generated from the anaconda prompt worked.
So I did the following.
installed the matplotlib using the command conda install matplotlib
Then typed the command jupyter lab.
Then pasted the entire url shown as follows in the chrome browser. Then it working.

Indeed, in the conda documentation - browser compatibility section, you can read:
The Jupyter Notebook aims to support the latest versions of these browsers:
Chrome
Safari
Firefox
Up to date versions of Opera and Edge may also work, but if they don’t, please use one of the supported browsers.
Using Safari with HTTPS and an untrusted certificate is known to not work (websockets will fail).
You might consider to set up one of the compatible browsers as your default to avoid having to copy/paste the url every time.

Related

Opentelemetry python

HP ENVY 17" i7 laptop:
Kubuntu 21.10
Greetings, I'm relatively new to Opentelemetry. I've followed many tutorials including opentelemetry.io but I keep running into dependency problems with the python stack.
What is the expected behavior?
I don't expect any error
What is the actual behavior?
python ./metrics01.py ─╯
Traceback (most recent call last):
File "/home/iomari/temp/opentelemetry/newsample/./metrics01.py", line 7, in <module>
from opentelemetry.sdk.metrics.export.controller import PushController
ModuleNotFoundError: No module named 'opentelemetry.sdk.metrics.export.controller'
Additional context:
Using opentelemetry-python 1.12.0rc1:
─ pip freeze ─╯
asttokens==2.0.5
backcall==0.2.0
backoff==1.11.1
certifi==2022.6.15
chainmap==1.0.3
charset-normalizer==2.0.12
colorama==0.4.5
combomethod==1.0.12
decorator==5.1.1
Deprecated==1.2.13
executing==0.8.3
googleapis-common-protos==1.56.3b1
grpcio==1.47.0rc1
idna==3.3
ipython==8.4.0
jedi==0.18.1
matplotlib-inline==0.1.3
nulltype==2.3.1
opentelemetry-api==1.12.0rc1
opentelemetry-distro==0.31b0
opentelemetry-exporter-jaeger==1.12.0rc1
opentelemetry-exporter-jaeger-proto-grpc==1.12.0rc1
opentelemetry-exporter-jaeger-thrift==1.12.0rc1
opentelemetry-exporter-otlp==1.12.0rc1
opentelemetry-exporter-otlp-proto-grpc==1.12.0rc1
opentelemetry-exporter-otlp-proto-http==1.12.0rc1
opentelemetry-exporter-prometheus==1.12.0rc1
opentelemetry-instrumentation==0.31b0
opentelemetry-propagator-b3==1.12.0rc1
opentelemetry-propagator-jaeger==1.12.0rc1
opentelemetry-proto==1.12.0rc1
opentelemetry-sdk==1.12.0rc1
opentelemetry-semantic-conventions==0.31b0
options==1.4.10
parso==0.8.3
pexpect==4.8.0
pickleshare==0.7.5
prometheus-client==0.14.1
prompt-toolkit==3.0.29
protobuf==3.20.0
ptyprocess==0.7.0
pure-eval==0.2.2
Pygments==2.12.0
requests==2.28.0
six==1.12.0
stack-data==0.3.0
termcolor==1.1.0
thrift==0.16.0
traitlets==5.3.0
typing_extensions==4.2.0
urllib3==1.26.9
wcwidth==0.2.5
wrapt==1.14.1
Problem solved.
Did a pip cache purge, reinstalled all modules and all is working.

how to resolve AttributeError: module 'graphviz.backend' has no attribute 'ENCODING'

I am not sure why I get an AttributeError: module 'graphviz.backend' has no attribute 'ENCODING' when I tried to export regression tree to graphviz. I tried re-installing graphviz and sklearn but it doesn't solve the problem. Appreciate any advice on this.
AttributeError Traceback (most recent call last)
<ipython-input-4-9d9e0becf9b6> in <module>
3 # graphviz is the drawing tool
4 from sklearn.tree import export_graphviz
----> 5 import graphviz
6 dot_data = export_graphviz(
7 model,
C:\ProgramData\Anaconda3\lib\site-packages\graphviz\__init__.py in <module>
25 """
26
---> 27 from .dot import Graph, Digraph
28 from .files import Source
29 from .lang import escape, nohtml
C:\ProgramData\Anaconda3\lib\site-packages\graphviz\dot.py in <module>
30
31 from . import backend
---> 32 from . import files
33 from . import lang
34
C:\ProgramData\Anaconda3\lib\site-packages\graphviz\files.py in <module>
20
21
---> 22 class Base(object):
23
24 _engine = 'dot'
C:\ProgramData\Anaconda3\lib\site-packages\graphviz\files.py in Base()
26 _format = 'pdf'
27
---> 28 _encoding = backend.ENCODING
29
30 #property
AttributeError: module 'graphviz.backend' has no attribute 'ENCODING'
I had a similar issue when using pipdeptree. It would seem that there was a very recent change to graphviz, intended to obfuscate its internals. Quoting the module author's reply in issue #149 (a similar issue with backend.FORMATS):
Submodules of graphviz are not part of the public API (cf. https://graphviz.readthedocs.io/en/stable/api.html). Please stick to the documented interface and use graphviz.FORMATS, see https://graphviz.readthedocs.io/en/stable/api.html#graphviz.FORMATS).
In the short term, you could downgrade your graphviz module… it looks like 0.18 was the last tag before the submodules were made opaque.
Moving forward, you may wish to create an issue and/or pull request against the sklearn-pandas repository, to replace graphviz.backend.FORMATS with graphviz.FORMATS, or even just cap its graphviz dependency at 0.18.
I had the same issue and I am very new to Python/conda world, so this might help newbies like me...
I downloaded graphviz 0.19.1 from:
https://pypi.org/project/graphviz/#files
Source Distribution: graphviz-0.19.1.zip (247.8 kB view hashes)
download link
and replaced graphviz folder with this version in "C:\Users\Nino\anaconda3\Lib\site-packages" (will be different for you) and rename it so that name is again graphviz.
"C:\Users\Nino\anaconda3\Lib\site-packages\graphviz"
I have met same problem! The most voted answer works for me! And paste the code to forceably downgrade the graphviz.
pip install --force-reinstall graphviz==0.18
I had the same error with python-graphviz==0.16. OP did not include a version number, but it looks like the line numbers in the traceback match with v0.16.
Note that the traceback shows the error to be inside the python-graphviz package, so it's more likely that it's an issue with a dependency.
With python-graphviz==0.19 I don't get the import error.
On a side note: Versions shown by conda list or pip list can be misleading. In case of doubt check the content of the __init__.py.
I solved this issue in a different way:
Open graphviz file on my PC through following path (Path may differ)
"C:\Users\Anoop\anaconda3\Lib\site-packages\graphviz\backend"
Copy the encoding.py file from here
Paste this file in the backend
"C:\Users\Anoop\anaconda3\Lib\site-packages\graphviz\backend"
Problem solved
In my case, it seems that the class Base in the "C:\ProgramData\Anaconda3\lib\site-packages\graphviz\files.py" takes the 'backend folder' instead of the 'backend.py' on init.
quick solve:
go to "C:\ProgramData\Anaconda3\lib\site-packages\graphviz" and rename the 'backend folder' to something else.
PS: since I didn't check the whole code, it may then cause another dependency problem.
Thanks! ver0.2 was trouble some and this error disappear after downgrading it with ver 0.19

Tensorflow on macOS Apple M1

I am trying to install tensor flow on my macOS M1.
As per chip compatibility I know that not all the pip images of tensor flow works or are even compatible. But I found this repository
https://github.com/apple/tensorflow_macos
Which is supposed to be working on Apple M1.
After the installation, I downgraded my python to version 3.8 and start the installation, everything went just fine without any issue.
just for testing purpose, I found this script online.
#!/usr/bin/env python
# coding: utf-8
# ## Sentiment Analysis on US Airline Reviews
# In[1]:
import pandas as pd
import matplotlib.pyplot as plt
from tensorflow.python.compiler.mlcompute import mlcompute
mlcompute.set_mlc_device(device_name='cpu')
from tensorflow.keras.preprocessing.text import Tokenizer
from tensorflow.keras.preprocessing.sequence import pad_sequences
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import LSTM,Dense, Dropout, SpatialDropout1D
from tensorflow.keras.layers import Embedding
df = pd.read_csv("./Tweets.csv")
# In[2]:
df.head()
# In[23]:
df.columns
# In[4]:
tweet_df = df[['text','airline_sentiment']]
print(tweet_df.shape)
tweet_df.head(5)
# In[22]:
tweet_df = tweet_df[tweet_df['airline_sentiment'] != 'neutral']
print(tweet_df.shape)
tweet_df.head(5)
# In[21]:
tweet_df["airline_sentiment"].value_counts()
# In[6]:
sentiment_label = tweet_df.airline_sentiment.factorize()
sentiment_label
# In[7]:
tweet = tweet_df.text.values
tokenizer = Tokenizer(num_words=5000)
tokenizer.fit_on_texts(tweet)
vocab_size = len(tokenizer.word_index) + 1
encoded_docs = tokenizer.texts_to_sequences(tweet)
padded_sequence = pad_sequences(encoded_docs, maxlen=200)
# In[8]:
print(tokenizer.word_index)
# In[9]:
print(tweet[0])
print(encoded_docs[0])
# In[10]:
print(padded_sequence[0])
# In[11]:
embedding_vector_length = 32
model = Sequential()
model.add(Embedding(vocab_size, embedding_vector_length, input_length=200) )
model.add(SpatialDropout1D(0.25))
model.add(LSTM(50, dropout=0.5, recurrent_dropout=0.5))
model.add(Dropout(0.2))
model.add(Dense(1, activation='sigmoid'))
model.compile(loss='binary_crossentropy',optimizer='adam', metrics=['accuracy'])
print(model.summary())
# In[12]:
history = model.fit(padded_sequence,sentiment_label[0],validation_split=0.2, epochs=5, batch_size=32)
# In[16]:
plt.plot(history.history['accuracy'], label='acc')
plt.plot(history.history['val_accuracy'], label='val_acc')
plt.legend()
plt.show()
plt.savefig("Accuracy plot.jpg")
# In[25]:
plt.plot(history.history['loss'], label='loss')
plt.plot(history.history['val_loss'], label='val_loss')
plt.legend()
plt.show()
plt.savefig("Loss plot.jpg")
# In[18]:
def predict_sentiment(text):
tw = tokenizer.texts_to_sequences([text])
tw = pad_sequences(tw,maxlen=200)
prediction = int(model.predict(tw).round().item())
print("Predicted label: ", sentiment_label[1][prediction])
# In[19]:
test_sentence1 = "I enjoyed my journey on this flight."
predict_sentiment(test_sentence1)
test_sentence2 = "This is the worst flight experience of my life!"
predict_sentiment(test_sentence2)
But when I run it,
I get this error
Traceback (most recent call last):
File "/Users/user/Desktop/MachineLearning/env/lib/python3.8/site-packages/tensorflow/python/pywrap_tensorflow.py", line 64, in <module>
from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: dlopen(/Users/user/Desktop/MachineLearning/env/lib/python3.8/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so, 6): no suitable image found. Did find:
/Users/user/Desktop/MachineLearning/env/lib/python3.8/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so: mach-o, but wrong architecture
/Users/user/Desktop/MachineLearning/env/lib/python3.8/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so: mach-o, but wrong architecture
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "Sentiment Analysis.py", line 13, in <module>
from tensorflow.python.compiler.mlcompute import mlcompute
File "/Users/user/Desktop/MachineLearning/env/lib/python3.8/site-packages/tensorflow/__init__.py", line 41, in <module>
from tensorflow.python.tools import module_util as _module_util
File "/Users/user/Desktop/MachineLearning/env/lib/python3.8/site-packages/tensorflow/python/__init__.py", line 39, in <module>
from tensorflow.python import pywrap_tensorflow as _pywrap_tensorflow
File "/Users/user/Desktop/MachineLearning/env/lib/python3.8/site-packages/tensorflow/python/pywrap_tensorflow.py", line 83, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/Users/user/Desktop/MachineLearning/env/lib/python3.8/site-packages/tensorflow/python/pywrap_tensorflow.py", line 64, in <module>
from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: dlopen(/Users/user/Desktop/MachineLearning/env/lib/python3.8/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so, 6): no suitable image found. Did find:
/Users/user/Desktop/MachineLearning/env/lib/python3.8/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so: mach-o, but wrong architecture
/Users/user/Desktop/MachineLearning/env/lib/python3.8/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so: mach-o, but wrong architecture
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/errors
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
The error is about the architecture but I have no idea how to fix. Did anyone found a solution to this problem?
Thank you so much for any help you can provide.
Things should work better now.
As of Oct. 25, 2021 macOS 12 Monterey is generally available.
Upgrade your machine to Monterey or newer OS if you haven't already.
If you have conda installed, I would probably uninstall it. You can have multiple conda versions installed but things can get tricky.
Then follow the instructions from Apple here. I cleaned them up a bit below:
Download and install Conda from Miniforge:
chmod +x ~/Downloads/Miniforge3-MacOSX-arm64.sh
sh ~/Downloads/Miniforge3-MacOSX-arm64.sh
source ~/miniforge3/bin/activate
In an active conda environment, install the TensorFlow dependencies, base TensorFlow, and TensorFlow metal:
conda install -c apple tensorflow-deps
pip install tensorflow-macos
pip install tensorflow-metal
You should be good to go with fast training speeds.

install wand on a windows machine

I tried to install wand 0.4.4 on a windows 7 (64 bit).
I installed imagemagick binary (ImageMagick-6.9.3-1-Q16-x64-dll.exe).
Then set MAGICK_HOME environment variable to the path of ImageMagick.
Finally, I installed wand through pip in Anaconda (python 2.7.13).
When I run 'from wand.image import Image' I get the following error:
----> 2 from wand.image import Image
3 # from PIL import Image as PI
D:\Anaconda2\lib\site-packages\wand\image.py in <module>()
18
19 from . import compat
---> 20 from .api import MagickPixelPacket, libc, libmagick, library
21 from .color import Color
22 from .compat import (binary, binary_type, encode_filename, file_types,
D:\Anaconda2\lib\site-packages\wand\api.pyc in <module>()
178
179 try:
--> 180 libraries = load_library()
181 except (OSError, IOError):
182 msg = 'http://docs.wand-py.org/en/latest/guide/install.html'
D:\Anaconda2\lib\site-packages\wand\api.pyc in load_library()
124 try:
125 tried_paths.append(libwand_path)
--> 126 libwand = ctypes.CDLL(libwand_path)
127 if libwand_path == libmagick_path:
128 libmagick = libwand
D:\Anaconda2\lib\ctypes\__init__.pyc in __init__(self, name, mode, handle, use_errno, use_last_error)
360
361 if handle is None:
--> 362 self._handle = _dlopen(self._name, mode)
363 else:
364 self._handle = handle
TypeError: LoadLibrary() argument 1 must be string, not unicode
What's going wrong?
What's going wrong?
This has been reported here. It'll most likely be fixed in the near-future.
The fix is to update two lines in api.py.
Locate file wand/api.py file.
Search for methods ctypes.CDLL called under load_library function.
Cast unicode variables to strings.
Change ctypes.CDLL(libwand_path) to ctypes.CDLL(str(libwand_path))
Change ctypes.CDLL(libmagick_path) to ctypes.CDLL(str(libmagick_path))
This is a Python 2.7.13 issue that will be closed with 2.7.14 release, which should come out around mid-2017; before this date you can use the fix suggested by emcconville directly editing the loading of native libraries for each required package or downgrade to Python 2.7.12.
Issue details and settlement patch on:
https://hg.python.org/cpython/rev/4ce22d69e134

import matplotlib.pyplot gives ImportError: dlopen(...) Library not loaded libpng15.15.dylib

Importing pyplot gives an error:
In [1]: import matplotlib
In [2]: import matplotlib.pyplot as plt
ImportError Traceback (most recent call last)
<ipython-input-2-eff513f636fd> in <module>()
----> 1 import matplotlib.pyplot as plt
/Users/r8t/anaconda/lib/python2.7/site-packages/matplotlib/pyplot.py in <module>()
25
26 import matplotlib
---> 27 import matplotlib.colorbar
28 from matplotlib import style
29 from matplotlib import _pylab_helpers, interactive
/Users/r8t/anaconda/lib/python2.7/site-packages/matplotlib/colorbar.py in <module>()
32 import matplotlib.artist as martist
33 import matplotlib.cbook as cbook
---> 34 import matplotlib.collections as collections
35 import matplotlib.colors as colors
36 import matplotlib.contour as contour
/Users/r8t/anaconda/lib/python2.7/site-packages/matplotlib/collections.py in <module>()
25 import matplotlib.artist as artist
26 from matplotlib.artist import allow_rasterization
---> 27 import matplotlib.backend_bases as backend_bases
28 import matplotlib.path as mpath
29 from matplotlib import _path
/Users/r8t/anaconda/lib/python2.7/site-packages/matplotlib/backend_bases.py in <module>()
54
55 import matplotlib.tight_bbox as tight_bbox
---> 56 import matplotlib.textpath as textpath
57 from matplotlib.path import Path
58 from matplotlib.cbook import mplDeprecation
/Users/r8t/anaconda/lib/python2.7/site-packages/matplotlib/textpath.py in <module>()
20 from matplotlib.ft2font import FT2Font, KERNING_DEFAULT, LOAD_NO_HINTING
21 from matplotlib.ft2font import LOAD_TARGET_LIGHT
---> 22 from matplotlib.mathtext import MathTextParser
23 import matplotlib.dviread as dviread
24 from matplotlib.font_manager import FontProperties
/Users/r8t/anaconda/lib/python2.7/site-packages/matplotlib/mathtext.py in <module>()
61
62 import matplotlib.colors as mcolors
---> 63 import matplotlib._png as _png
64 ####################
65
ImportError: dlopen(/Users/r8t/anaconda/lib/python2.7/site-packages/matplotlib/_png.so, 2): Library not loaded: libpng15.15.dylib
Referenced from: /Users/r8t/anaconda/lib/python2.7/site-packages/matplotlib/_png.so
Reason: image not found
I've looked at Error importing matplotlib.pyplot
which suggests deleting the matplotlib folder. I tried it and it didn't work. This also doesn't have a solution, but I think is related: Python: py2app "ImportError: dlopen(): Library not loaded"
Also i made sure I have libpng installed (via brew).
Thanks,
(sorry I can not comment yet.. so here's a new post)
I had the same problem when installing another library (spynner): dlopen(…) Library not loaded libpng15.15.dylib
I tried a similar method to #travelingbones's answer, and just wanted to add some notes for future readers:
DYLD_LIBRARY_PATH should contain directories, not files. E.g.,
export DYLD_LIBRARY_PATH=/Users/xxx/anaconda/lib:$DYLD_LIBRARY_PATH
and not
export DYLD_LIBRARY_PATH=/Users/xxx/anaconda/lib/libpng15.15.dylib:$DYLD_LIBRARY_PATH
The error /usr/X11/lib/libpng15.15.dylib/libpng15.15.dylib: stat() failed with errno=20 is caused by the wrong DYLD_LIBRARY_PATH, since file path /usr/X11/lib/libpng15.15.dylib/libpng15.15.dylib does not exist (notice the double libpng15.15.dylib in the file path).
After I had set the new DYLD_LIBRARY_PATH, I found my matplotlib was messed up, with the following error:
ImportError: dlopen(/Users/shenggao/anaconda/lib/python2.7/site-packages/matplotlib/backends/_macosx.so, 2): Symbol not found: __cg_jpeg_resync_to_restart
Referenced from: /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
Expected in: /Users/shenggao/anaconda/lib/libjpeg.8.dylib in /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
To solve this problem, I changed DYLD_LIBRARY_PATH back to the old value (i.e., empty), and added the libpng path to DYLD_FALLBACK_LIBRARY_PATH
like this:
export DYLD_FALLBACK_LIBRARY_PATH=/Users/shenggao/anaconda/lib:$DYLD_FALLBACK_LIBRARY_PATH
Finally matplotlib and my new library worked like a charm!
I followed these directions and got a different error that's fixable:
First I checked what's in that path:
macair93278:~ r8t$ echo $DYLD_LIBRARY_PATH
(empty)
Next to locate the file I need (libpng15.15.dylib):
macair93278:~ r8t$ locate libpng15.15.dylib
/Applications/KeePassX.app/Contents/MacOS/libpng15.15.dylib
/Users/r8t/anaconda/lib/libpng15.15.dylib
/Users/r8t/anaconda/pkgs/libpng-1.5.13-1/lib/libpng15.15.dylib
/usr/X11/lib/libpng15.15.dylib
Now I appended the bottom three to the path and checked the path:
macair93278:~ r8t$ echo $DYLD_LIBRARY_PATH
/usr/X11/lib/libpng15.15.dylib:/Users/r8t/anaconda/pkgs/libpng-1.5.13-1/lib/libpng15.15.dylib:/Users/r8t/anaconda/lib/libpng15.15.dylib
ok, so now the test,
macair93278:~ r8t$ ipython
In [1]: import matplotlib
In [2]: from matplotlib import pyplot
…(bunch of output)
ImportError: dlopen(/Users/r8t/anaconda/lib/python2.7/site-packages/matplotlib/_png.so, 2): Library not loaded: libpng15.15.dylib
Referenced from: /Users/r8t/anaconda/lib/python2.7/site-packages/matplotlib/_png.so
Reason: no suitable image found. Did find:
/usr/X11/lib/libpng15.15.dylib/libpng15.15.dylib: stat() failed with errno=20
/Users/r8t/anaconda/pkgs/libpng-1.5.13-1/lib/libpng15.15.dylib/libpng15.15.dylib: stat() failed with errno=20
/Users/r8t/anaconda/lib/libpng15.15.dylib/libpng15.15.dylib: stat() failed with errno=20
A different error! progress!
Now following this page I ran the brew link, then unlink it didn't fix it, but it pointed me to the fact that pyplot is looking for libpng15.15.dylib in usr/local/lib but they aren' there:
macair93278:~ r8t$ cd ../usr/local/lib
macair93278:lib r8t$ ls *png*
libpng.a libpng16.16.dylib libpng16.dylib
libpng.dylib libpng16.a
So copy them in there:
macair93278:~ r8t$ cp ../anaconda/lib/*png* /usr/local/lib
macair93278:~ r8t$ cd /usr/local/lib
The test:
In [1]: import matplotlib
In [2]: from matplotlib import pyplot
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/r8t/anaconda/lib/python2.7/site-packages/matplotlib/pyplot.py", line 109, in <module>
_backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
File "/Users/r8t/anaconda/lib/python2.7/site-packages/matplotlib/backends/__init__.py", line 32, in pylab_setup
globals(),locals(),[backend_name],0)
File "/Users/r8t/anaconda/lib/python2.7/site-packages/matplotlib/backends/backend_macosx.py", line 24, in <module>
from matplotlib.backends import _macosx
RuntimeError: Python is not installed as a framework. The Mac OS X backend will not be able to function correctly if Python is not installed as a framework. See the Python documentation for more information on installing Python as a framework on Mac OS X. Please either reinstall Python as a framework, or try one of the other backends.
And we've reduced the problem to this (solved) one: problem w/ mac os backend

Resources