The problem is likely a configuration issue, because getting the installation correct on Macs seems to be tricky. I'm running Mavericks and matplotlib 1.4.x, yet when I open a Python 2.7.5 shell and import pylib, I get this error:
>>> import pylab
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.7/site-packages/matplotlib-1.4.x-py2.7-macosx-10.9-intel.egg/pylab.py", line 1, in <module>
from matplotlib.pylab import *
File "/Library/Python/2.7/site-packages/matplotlib-1.4.x-py2.7-macosx-10.9-intel.egg/matplotlib/pylab.py", line 230, in <module>
import matplotlib.finance
File "/Library/Python/2.7/site-packages/matplotlib-1.4.x-py2.7-macosx-10.9-intel.egg/matplotlib/finance.py", line 38, in <module>
from matplotlib.collections import LineCollection, PolyCollection
File "/Library/Python/2.7/site-packages/matplotlib-1.4.x-py2.7-macosx-10.9-intel.egg/matplotlib/collections.py", line 27, in <module>
import matplotlib.backend_bases as backend_bases
File "/Library/Python/2.7/site-packages/matplotlib-1.4.x-py2.7-macosx-10.9-intel.egg/matplotlib/backend_bases.py", line 55, in <module>
import matplotlib.textpath as textpath
File "/Library/Python/2.7/site-packages/matplotlib-1.4.x-py2.7-macosx-10.9-intel.egg/matplotlib/textpath.py", line 22, in <module>
from matplotlib.mathtext import MathTextParser
File "/Library/Python/2.7/site-packages/matplotlib-1.4.x-py2.7-macosx-10.9-intel.egg/matplotlib/mathtext.py", line 64, in <module>
import matplotlib._png as _png
ImportError: dlopen(/Library/Python/2.7/site-packages/matplotlib-1.4.x-py2.7-macosx-10.9-intel.egg/matplotlib/_png.so, 2): Library not loaded: /usr/local/lib/libpng15.15.dylib
Referenced from: /Library/Python/2.7/site-packages/matplotlib-1.4.x-py2.7-macosx-10.9-intel.egg/matplotlib/_png.so
Reason: image not found
I have libpng16 installed, but not libpng15.
I saw a hardcoded reference to libpng15 in _png.so.
Uninstall and install of matplotlib fixed the issue for me.
You can always moke it by generating a soft link like this
sudo ln -s /opt/X11/lib/libpng.dylib /usr/local/lib/libpng15.15.dylib
Not the cleaner solution but I haven't figure out why matplotlib stubbornly asks specifically for libpng15 and not any 15 or greater.
Related
I'm trying to run my Python program and these are the modules I'm importing:
from tkinter import *
from functools import partial
import numpy as np import
matplotlib matplotlib.use("TkAgg")
from matplotlib.figure import Figure
from matplotlib.backends.backend_tkagg
import FigureCanvasTkAgg, NavigationToolbar2Tk
I always end up with the following error message:
C:\Users\HP\anaconda3\lib\site-packages\numpy\__init__.py:138: UserWarning: mkl-service package failed to import, therefore Intel(R) MKL initialization ensuring its correct out-of-the box operation under condition when Gnu OpenMP had already been loaded by Python process is not assured. Please install mkl-service package, see http://github.com/IntelPython/mkl-service
from . import _distributor_init
Traceback (most recent call last):
File "ASRS.py", line 12, in <module>
from matplotlib.figure import Figure
File "C:\Users\HP\AppData\Roaming\Python\Python38\site-packages\matplotlib\figure.py", line 18, in <module>
from matplotlib import docstring, projections
File "C:\Users\HP\AppData\Roaming\Python\Python38\site-packages\matplotlib\projections\__init__.py", line 1, in <module>
from .. import axes, docstring
File "C:\Users\HP\AppData\Roaming\Python\Python38\site-packages\matplotlib\axes\__init__.py", line 1, in <module>
from ._subplots import *
File "C:\Users\HP\AppData\Roaming\Python\Python38\site-packages\matplotlib\axes\_subplots.py", line 6, in <module>
from matplotlib.axes._axes import Axes
File "C:\Users\HP\AppData\Roaming\Python\Python38\site-packages\matplotlib\axes\_axes.py", line 14, in <module>
import matplotlib.contour as mcontour
File "C:\Users\HP\AppData\Roaming\Python\Python38\site-packages\matplotlib\contour.py", line 17, in <module>
import matplotlib.text as text
File "C:\Users\HP\AppData\Roaming\Python\Python38\site-packages\matplotlib\text.py", line 16, in <module>
from .textpath import TextPath # Unused, but imported by others.
File "C:\Users\HP\AppData\Roaming\Python\Python38\site-packages\matplotlib\textpath.py", line 11, in <module>
from matplotlib.mathtext import MathTextParser
File "C:\Users\HP\AppData\Roaming\Python\Python38\site-packages\matplotlib\mathtext.py", line 27, in <module>
from PIL import Image
File "C:\Users\HP\anaconda3\lib\site-packages\PIL\Image.py", line 94, in <module>
from . import _imaging as core
**ImportError: DLL load failed while importing _imaging: Belirtilen modül bulunamadı.**
How can I fix this?
Simply upgrading the package "Pillow" (using the Anaconda environment) worked for me to resolve this issue.
pip install --upgrade Pillow
I am an amateur programmer. I am trying to use:
import thinkdsp as dsp
import thinkplot as plt
I have installed the pip install thinkx module but I keep getting that error and I don't understand why. I will leave what the console shows down below:
Traceback (most recent call last):
File "Karaokemaker1.py", line 1, in <module>
import thinkdsp as dsp
File "C:\Users\keigo\anaconda3\lib\site-packages\thinkdsp.py", line 17, in <module>
import scipy.stats
File "C:\Users\keigo\anaconda3\lib\site-packages\scipy\stats\__init__.py", line 384, in <module>
from .stats import *
File "C:\Users\keigo\anaconda3\lib\site-packages\scipy\stats\stats.py", line 185, in <module>
from . import distributions
File "C:\Users\keigo\anaconda3\lib\site-packages\scipy\stats\distributions.py", line 10, in <module>
from ._distn_infrastructure import (entropy, rv_discrete, rv_continuous,
File "C:\Users\keigo\anaconda3\lib\site-packages\scipy\stats\_distn_infrastructure.py", line 25, in <module>
from scipy import optimize
File "C:\Users\keigo\anaconda3\lib\site-packages\scipy\optimize\__init__.py", line 390, in <module>
from ._minimize import *
File "C:\Users\keigo\anaconda3\lib\site-packages\scipy\optimize\_minimize.py", line 30, in <module>
from ._trustregion_constr import _minimize_trustregion_constr
File "C:\Users\keigo\anaconda3\lib\site-packages\scipy\optimize\_trustregion_constr\__init__.py", line 4, in <module>
from .minimize_trustregion_constr import _minimize_trustregion_constr
File "C:\Users\keigo\anaconda3\lib\site-packages\scipy\optimize\_trustregion_constr\minimize_trustregion_constr.py", line 4, in <module>
from scipy.sparse.linalg import LinearOperator
File "C:\Users\keigo\anaconda3\lib\site-packages\scipy\sparse\linalg\__init__.py", line 116, in <module>
from .eigen import *
File "C:\Users\keigo\anaconda3\lib\site-packages\scipy\sparse\linalg\eigen\__init__.py", line 11, in <module>
from .arpack import *
File "C:\Users\keigo\anaconda3\lib\site-packages\scipy\sparse\linalg\eigen\arpack\__init__.py", line 22, in <module>
from .arpack import *
File "C:\Users\keigo\anaconda3\lib\site-packages\scipy\sparse\linalg\eigen\arpack\arpack.py", line 45, in <module>
from . import _arpack
ImportError: DLL load failed: The specified procedure could not be found.
I assumed the issue was with the scipy because all the following errors come from that module. I checked and I have everything installed properly for the scipy module.
Please help! Thank you!
Run any command prompt you are using as administrator and then run pip install lib_name --force-reinstall
Try using these two commands they will help you:
conda remove --force scipy
And:
pip install scipy
Hello I had the same issue than you. Depend on wich version of python you use you should choose a version thinkx. I recommend you to go on the website of thinkx and check out for past udapte. In my case that was with matplotlib 3.3.1 for python 3.7. I went in git bash and used
pip install matplotlib==3.0.1
and everything worked. I had the same issue with seaborn and it worked.
I did some changes on my Anaconda installation (I just uninstalled previous one, and installed a newer version). Now trying to run my code simply importing this:
from skimage.measure import compare_ssim
But it shows this error. How can I fix it? All searching didn't help. When I do this import on Anaconda Prompt, it doesn't complaint. But when I run this on Eclipse, it shows this error.
Traceback (most recent call last):
File "C:\Users\user\eclipse-workspace\project\hybrid.py", line 18, in <module>
from skimage.measure import compare_ssim
File "C:\Users\user\AppData\Local\Continuum\anaconda3\lib\site-packages\skimage\__init__.py", line 176, in <module>
from .util.lookfor import lookfor
File "C:\Users\user\AppData\Local\Continuum\anaconda3\lib\site-packages\skimage\util\__init__.py", line 12, in <module>
from ._montage import montage, montage2d
File "C:\Users\user\AppData\Local\Continuum\anaconda3\lib\site-packages\skimage\util\_montage.py", line 2, in <module>
from .. import exposure
File "C:\Users\user\AppData\Local\Continuum\anaconda3\lib\site-packages\skimage\exposure\__init__.py", line 1, in <module>
from .exposure import histogram, equalize_hist, \
File "C:\Users\user\AppData\Local\Continuum\anaconda3\lib\site-packages\skimage\exposure\exposure.py", line 4, in <module>
from ..color import rgb2gray
File "C:\Users\user\AppData\Local\Continuum\anaconda3\lib\site-packages\skimage\color\__init__.py", line 1, in <module>
from .colorconv import (convert_colorspace,
File "C:\Users\user\AppData\Local\Continuum\anaconda3\lib\site-packages\skimage\color\colorconv.py", line 59, in <module>
from scipy import linalg
File "C:\Users\user\AppData\Local\Continuum\anaconda3\lib\site-packages\scipy\linalg\__init__.py", line 190, in <module>
from .misc import *
File "C:\Users\user\AppData\Local\Continuum\anaconda3\lib\site-packages\scipy\linalg\misc.py", line 5, in <module>
from .blas import get_blas_funcs
File "C:\Users\user\AppData\Local\Continuum\anaconda3\lib\site-packages\scipy\linalg\blas.py", line 214, in <module>
from scipy.linalg import _fblas
ImportError: DLL load failed: The specified module could not be found.
Uninstalling and re-installing Numpy+mkl from here fixed, in my case.
My error arised from from scipy import signal. But it had given the same error as yours:
"from scipy.linalg import _fblas: ImportError: DLL load failed: The specified module could not be found"
I realized when I run this import on Anaconda Prompt, it doesn't complaint. But when I run this on Eclipse, it shows this error.
The simple solution was to add this to my PATH that helped fix the problem:
C:\Users\user\AppData\Local\Continuum\anaconda3\Library\bin
I'm trying to install Scipy through pip, but it won't work. It says that it already is installed, but when I try to import the modules it gives me errors.
from matplotlib import pyplot as plt
Error:
Traceback (most recent call last):
File "C:\Users\TimGF\Documents\Coding\Python\numpy.py", line 1, in <module>
from matplotlib import pyplot as plt
File "C:\Python36\lib\site-packages\matplotlib\__init__.py", line 127, in <module>
from . import cbook
File "C:\Python36\lib\site-packages\matplotlib\cbook\__init__.py", line 35, in <module>
import numpy as np
File "C:\Users\TimGF\Documents\Coding\Python\numpy.py", line 1, in <module>
from matplotlib import pyplot as plt
File "C:\Python36\lib\site-packages\matplotlib\pyplot.py", line 31, in <module>
import matplotlib.colorbar
File "C:\Python36\lib\site-packages\matplotlib\colorbar.py", line 32, in <module>
import matplotlib.artist as martist
File "C:\Python36\lib\site-packages\matplotlib\artist.py", line 15, in <module>
from . import cbook, docstring, rcParams
ImportError: cannot import name 'rcParams'
EDIT: It turned out, that the problem was, that I called my file "matplotlib.py".
Turned out that I was super stupid, and I just had to rename the python file to something else than "matplotlib.py" since it confused the script.
I compiled matplotlib on a mac running snow leopard only to find that when I import matplotlib.pyplot I get the following error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/pyplot.py", line 6, in <module>
from matplotlib.figure import Figure, figaspect
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/figure.py", line 18, in <module>
from axes import Axes, SubplotBase, subplot_class_factory
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/axes.py", line 12, in <module>
import matplotlib.axis as maxis
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/axis.py", line 10, in <module>
import matplotlib.font_manager as font_manager
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/font_manager.py", line 52, in <module>
from matplotlib import ft2font
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/ft2font.so, 2): Symbol not found: _FT_Attach_File
Referenced from: /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/ft2font.so
Expected in: dynamic lookup
How do I fix this?
Building matplotlib on OS X is notoriously fraught with problems linking to mismatched versions of libraries that can be in the system directories, /usr/local, /opt/local, what have you. That's why there is a README.osx file in the source distribution advising you to use the make.osx file provided in the distribution that fetches and compiles the libraries and builds matplotlib against the fetched copy.