Dependencies error in Matplotlib and numpy - python

These versions of softwares are installed :
python-2.5
numpy-1.0.1.win32-py2.5
scipy-0.5.2.win32-py2.5
matplotlib-0.87.7.win32-py2.5
[installed in same order]
While running my program, I am getting this error message :
*The import of the numpy version of the _transforms module,
_ns_transforms, failed. This is is either because numpy was
unavailable when matplotlib was compiled, because a dependency of
_ns_transforms could not be satisfied, or because the build flag for
this module was turned off in setup.py. If it appears that
_ns_transforms was not built, make sure you have a working copy of
numpy and then re-install matplotlib. Otherwise, the following
traceback gives more details:
Traceback (most recent call last):
File "C:\Python25\Scripts\_pictsim.py", line 16, in <module>
from pylab import plot, legend, savefig, gca, vlines, figure, title, xlabel, ylabel, semilogy,\
File "C:\Python25\Lib\site-packages\pylab.py", line 1, in <module>
>from matplotlib.pylab import *
File "C:\Python25\Lib\site-packages\matplotlib\pylab.py", line 201, in <module>
>from axes import Axes, PolarAxes
File "C:\Python25\Lib\site-packages\matplotlib\axes.py", line 14, in <module>
>from artist import Artist, setp
File "C:\Python25\Lib\site-packages\matplotlib\artist.py", line 4, in <module>
>from transforms import identity_transform
File "C:\Python25\Lib\site-packages\matplotlib\transforms.py", line 223, in <module>
>from _transforms import Value, Point, Interval, Bbox, Affine
File "C:\Python25\Lib\site-packages\matplotlib\_transforms.py", line 17, in <module>
>from matplotlib._ns_transforms import *
ImportError: DLL load failed: The specified module could not be found.*
There are some dependency errors, how can I resolve them
While installing numpy, scipy, and matplotlib it says : could not create key and set key value

The issue was resolved by downloading 2 dll files and copying in system32 and syswow64
Got this answer from another similar stackoverflow question
ImportError: DLL load failed: The specified module could not be found

Related

DLL load failed while importing _imaging:

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

from scipy.linalg import _fblas: ImportError: DLL load failed: The specified module could not be found

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

Cannot import mayavi: "ImportError: cannot import name implements"

I'm trying to use Mayavi in Python 2.7, but cannot import it. My OS is Ubuntu (LTS). Here is the code:
import numpy
from mayavi.mlab import *
The following error is produced:
Traceback (most recent call last):
File "/path/to/my/script/my_script_name.py", line 2, in <module>
from mayavi import mlab
File "/usr/local/lib/python2.7/dist-packages/mayavi/mlab.py", line 16, in <module>
from mayavi.tools.camera import view, roll, yaw, pitch, move
File "/usr/local/lib/python2.7/dist-packages/mayavi/tools/camera.py", line 24, in <module>
from .engine_manager import get_engine
File "/usr/local/lib/python2.7/dist-packages/mayavi/tools/engine_manager.py", line 12, in <module>
from mayavi.preferences.api import preference_manager
File "/usr/local/lib/python2.7/dist-packages/mayavi/preferences/api.py", line 4, in <module>
from .preference_manager import preference_manager
File "/usr/local/lib/python2.7/dist-packages/mayavi/preferences/preference_manager.py", line 30, in <module>
from apptools.preferences.api import (ScopedPreferences, IPreferences,
File "/usr/lib/python2.7/dist-packages/apptools/preferences/api.py", line 4, in <module>
from preferences import Preferences
File "/usr/lib/python2.7/dist-packages/apptools/preferences/preferences.py", line 9, in <module>
from traits.api import Property, Str, Undefined, implements
ImportError: cannot import name implements
I have tried force-reinstalling the packages mayavi, implements, traits, but to no avail. I tried both with pip and with apt.
Edit: I think the error is that mayavi cannot access VTK for my Python 2.7 installation. When I try to pip force-reinstall mayavi, I get the error "Could not find any downloads that satisfy the requirement vtk (from mayavi)". That error is described here. I do not know what to do, since both vtk and vtkpython are properly installed (with apt) and working - the issue is with mayavi and pip not knowing what to do?

matplotlib says it needs libpng15, but I have libpng16

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.

How to fix ImportError in matplotlib

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.

Categories