python x86 ImportError: DLL load failed - python

I have system with win7 x64 and code which worked well before with Anaconda2-2.4.0-Windows-x86
from sklearn.linear_model import LinearRegression
But now I get:
File "C:\Anaconda2\lib\site-packages\sklearn\linear_model\__init__.py", line 1
2, in <module>
from .base import LinearRegression
File "C:\Anaconda2\lib\site-packages\sklearn\linear_model\base.py", line 28, i
n <module>
from ..utils import as_float_array, check_array, check_X_y
File "C:\Anaconda2\lib\site-packages\sklearn\utils\__init__.py", line 16, in <
module>
from .class_weight import compute_class_weight, compute_sample_weight
File "C:\Anaconda2\lib\site-packages\sklearn\utils\class_weight.py", line 7, i
n <module>
from ..utils.fixes import in1d
File "C:\Anaconda2\lib\site-packages\sklearn\utils\fixes.py", line 318, in <mo
dule>
from scipy.sparse.linalg import lsqr as sparse_lsqr
File "C:\Anaconda2\lib\site-packages\scipy\sparse\linalg\__init__.py", line 11
3, in <module>
from .matfuncs import *
File "C:\Anaconda2\lib\site-packages\scipy\sparse\linalg\matfuncs.py", line 19
, in <module>
import scipy.misc
File "C:\Anaconda2\lib\site-packages\scipy\misc\__init__.py", line 49, in <mod
ule>
from scipy.special import comb, factorial, factorial2, factorialk
File "C:\Anaconda2\lib\site-packages\scipy\special\__init__.py", line 601, in
<module>
from ._ufuncs import *
ImportError: DLL load failed: The specified procedure could not be found.
Yesterday, I have installed software which brings some python with itself and look like does something else during installation.
In Dependency walker I see following picture:
I have installed Anaconda2-2.4.0-Windows-x86_64 and in this python version all works fine.
Could you please help me to understand what has been changed in system and how I can fix it?(I have completely remove installed software but it does not help)

Related

Skilearn ImportError: DLL load failed: The specified module could not be found

I am attempting to verify version of my Sklearn to verify the proper installation, earlier I was having an issue where I had to change my registry value of Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem#LongPathEnabled value to 1.
Then I was able to install the files how ever, now when I attempt to check the version of my skilearn I get the following:
Traceback (most recent call last):
File "C:/Users/terry/pyversions.py", line 11, in <module>
import sklearn
File "C:\Users\terry\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\sklearn\__init__.py", line 74, in <module>
from .base import clone
File "C:\Users\terry\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\sklearn\base.py", line 20, in <module>
from .utils import _IS_32BIT
File "C:\Users\terry\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\sklearn\utils\__init__.py", line 25, in <module>
from .fixes import np_version
File "C:\Users\terry\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\sklearn\utils\fixes.py", line 18, in <module>
import scipy.stats
File "C:\Users\terry\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\scipy\stats\__init__.py", line 384, in <module>
from .stats import *
File "C:\Users\terry\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\scipy\stats\stats.py", line 179, in <module>
from scipy.spatial.distance import cdist
File "C:\Users\terry\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\scipy\spatial\__init__.py", line 102, in <module>
from ._procrustes import procrustes
File "C:\Users\terry\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\scipy\spatial\_procrustes.py", line 11, in <module>
from scipy.linalg import orthogonal_procrustes
File "C:\Users\terry\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\scipy\linalg\__init__.py", line 195, in <module>
from .misc import *
File "C:\Users\terry\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\scipy\linalg\misc.py", line 5, in <module>
from .blas import get_blas_funcs
File "C:\Users\terry\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\scipy\linalg\blas.py", line 215, in <module>
from scipy.linalg import _fblas
ImportError: DLL load failed: The specified module could not be found.
My versions are as follows:
Python: 3.7.6 (tags/v3.7.6:43364a7ae0, Dec 19 2019, 01:54:44) [MSC v.1916 64 bit (AMD64)]
scipy: 1.4.1
numpy: 1.18.0
matplotlib: 3.1.2
pandas: 0.25.3
Please what do I need to do to fix my errors?
I am leaving this up to help others, I found the solution, had to unistall completely, reinstall and changing the reg file to allow long path download may have played a role in the beginning.

Why do I get this import error when I have the required DLLs?

from sklearn.feature_extraction.text import CountVectorizer
getting this error
from sklearn.feature_extraction.text import CountVectorizer
File "C:\Users\Anaconda3\lib\site-packages\sklearn\__init__.py", line 57, in <module>
from .base import clone
File "C:\Users\Anaconda3\lib\site-packages\sklearn\base.py", line 12, in <module>
from .utils.fixes import signature
File "C:\Users\Anaconda3\lib\site-packages\sklearn\utils\__init__.py", line 11, in <module>
from .validation import (as_float_array,
File "C:\Users\Anaconda3\lib\site-packages\sklearn\utils\validation.py", line 18, in <module>
from ..utils.fixes import signature
File "C:\Users\\Anaconda3\lib\site-packages\sklearn\utils\fixes.py", line 291, in <module>
from scipy.sparse.linalg import lsqr as sparse_lsqr
from .eigen import *
File "C:\Users\Anaconda3\lib\site-packages\scipy\sparse\linalg\eigen\__init__.py", line 11, in <module>
from .arpack import *
File "C:\Users\Anaconda3\lib\site-packages\scipy\sparse\linalg\eigen\arpack\__init__.py", line 22, in <module>
from .arpack import *
File "C:\Users\Anaconda3\lib\site-packages\scipy\sparse\linalg\eigen\arpack\arpack.py", line 45, in <module>
from . import _arpack
ImportError: DLL load failed: The specified module could not be found.
According to this github issue https://github.com/hmmlearn/hmmlearn/issues/87
"The solution is to install mkl."
conda install mkl
General advice in case like this is to google last two lines of the stack trace, usually you will find a github or similar thread about it.
In my case (this is one of the dependencies used by orange3), I had to follow one of the other suggestions in https://github.com/hmmlearn/hmmlearn/issues/87, which is to install numpy+mkl:
pip install "numpy-1.15.4+mkl-cp37-cp37m-win_amd64.whl"

Seaborn import error

I have been trying to import Seaborn in Python 3.6 but I always get an error:
ImportError: DLL load failed: The specified module could not be found.
I tried to install 2 DLLs (msvcp71 and msvcr71) but that did not help. I am using Windows 10.
The full error is:
import seaborn
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python36\lib\site-packages\seaborn\__init__.py", line 6, in <module>
from .rcmod import *
File "C:\Python36\lib\site-packages\seaborn\rcmod.py", line 8, in <module>
from . import palettes, _orig_rc_params
File "C:\Python36\lib\site-packages\seaborn\palettes.py", line 12, in <module>
from .utils import desaturate, set_hls_values, get_color_cycle
File "C:\Python36\lib\site-packages\seaborn\utils.py", line 7, in <module>
from scipy import stats
File "C:\Python36\lib\site-packages\scipy\stats\__init__.py", line 343, in <module>
from .stats import *
File "C:\Python36\lib\site-packages\scipy\stats\stats.py", line 169, in <module>
import scipy.special as special
File "C:\Python36\lib\site-packages\scipy\special\__init__.py", line 640, in <module>
from ._ufuncs import *
ImportError: DLL load failed: The specified module could not be found.
The problem was in Scipy so I uninstalled (pip uninstall) it and then reinstalled Scipy. Also reinstalled seaborn. That worked.
Trying to install from .whl didn't work but pip worked.

ndimage is not in SciPy

I tried to import ndimage package from SciPy to use the maximum filter in it. However, it seems SciPy is missing this part. I got this error:
from scipy.linalg import _fblas
ImportError: DLL load failed: The specified module could not be found.
I even tried these as well (separately):
import scipy.ndimage
from scipy.ndimage.filters import maximum_filter
import ndimage form scipy
But I still get the same error.
The complete error is:
Traceback (most recent call last):
File "C:\Users\Programs\PyCharm\PyCharm Community Edition 2017.2.4\helpers\pydev\pydevd.py", line 1599, in <module>
globals = debugger.run(setup['file'], None, None, is_module)
File "C:\Users\Programs\PyCharm\PyCharm Community Edition 2017.2.4\helpers\pydev\pydevd.py", line 1026, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "C:\Users\Programs\PyCharm\PyCharm Community Edition 2017.2.4\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "C:/Users/Desktop/Test_2/test.py", line 2, in <module>
import scipy.ndimage
File "C:\Users\Programs\Python 3.6\lib\site-packages\scipy\ndimage\__init__.py", line 161, in <module>
from .filters import *
File "C:\Users\Programs\Python 3.6\lib\site-packages\scipy\ndimage\filters.py", line 37, in <module>
from scipy.misc import doccer
File "C:\Users\Programs\Python 3.6\lib\site-packages\scipy\misc\__init__.py", line 67, in <module>
from scipy.interpolate._pade import pade as _pade
File "C:\Users\Programs\Python 3.6\lib\site-packages\scipy\interpolate\__init__.py", line 175, in <module>
from .interpolate import *
File "C:\Users\Programs\Python 3.6\lib\site-packages\scipy\interpolate\interpolate.py", line 20, in <module>
import scipy.linalg
File "C:\Users\Programs\Python 3.6\lib\site-packages\scipy\linalg\__init__.py", line 186, in <module>
from .misc import *
File "C:\Users\Programs\Python 3.6\lib\site-packages\scipy\linalg\misc.py", line 5, in <module>
from .blas import get_blas_funcs
File "C:\Users\Programs\Python 3.6\lib\site-packages\scipy\linalg\blas.py", line 196, in <module>
from scipy.linalg import _fblas
ImportError: DLL load failed: The specified module could not be found.
I tried two methods and they helped me to solve this problem:
1- Uninstall SciPy and NumPy and reinstall them again,
2- If you are using SciPy 1.0.0, downgrade it to a previous version (e.g. I downgraded it to SciPy 0.19.1). This one was suggested by #Brad Solomon
I'm sure one of these is the solution!

Python import error invalid ELF header

When I try to use this command line to run this python code:
~/Tools/find_differential_primers/utils python stitch_six_frame_stops.py seq.fa
Error code will be displayed as followed. could you help me solve this problem.
Traceback (most recent call last):
File "stitch_six_frame_stops.py", line 55, in <module>
import matplotlib
File "/usr/local/lib/python2.7/dist-packages/matplotlib-1.3.x-py2.7-macosx-10.8 intel.egg/matplotlib/__init__.py", line 129, in <module>
from matplotlib.cbook import is_string_like
File "/usr/local/lib/python2.7/dist-packages/matplotlib-1.3.x-py2.7-macosx-10.8-intel.egg/matplotlib/cbook.py", line 28, in <module>
import numpy as np
File "/usr/local/lib/python2.7/dist-packages/numpy-1.8.0.dev_3084618_20130514-py2.7-macosx-10.8-intel.egg/numpy/__init__.py", line 140, in <module>
from . import add_newdocs
File "/usr/local/lib/python2.7/dist-packages/numpy-1.8.0.dev_3084618_20130514-py2.7-macosx-10.8-intel.egg/numpy/add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "/usr/local/lib/python2.7/dist-packages/numpy-1.8.0.dev_3084618_20130514-py2.7-macosx-10.8-intel.egg/numpy/lib/__init__.py", line 6, in <module>
from .type_check import *
File "/usr/local/lib/python2.7/dist-packages/numpy-1.8.0.dev_3084618_20130514-py2.7-macosx-10.8-intel.egg/numpy/lib/type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "/usr/local/lib/python2.7/dist-packages/numpy-1.8.0.dev_3084618_20130514-py2.7-macosx-10.8-intel.egg/numpy/core/__init__.py", line 6, in <module>
from . import multiarray
ImportError: /usr/local/lib/python2.7/dist-packages/numpy-1.8.0.dev_3084618_20130514-py2.7-macosx-10.8-intel.egg/numpy/core/multiarray.so: invalid ELF header
You are trying to use a .so file in Mac OSX! .so files work on Linux; Mac OSX works with .dynld files. You probably may want to verify your NumPy Installation.
Assuming you are using OSX Lion, please see here for how to install NumPy on the OSX.

Categories

Resources