scipy.linalg DLL load failed (Python 3.4, Windows 8.1) [duplicate] - python

I have been trying to install Scipy onto my Python 3.5 (32-bit) install on my Windows 7 machine using the pre-built binaries from:
http://www.lfd.uci.edu/~gohlke/pythonlibs
I have, in order, installed the following libraries
numpy‑1.10.1+mkl‑cp35‑none‑win32.whl
scipy‑0.16.1‑cp35‑none‑win32.whl
Then, when trying to use the installed packages I get the following erros
from scipy import sparse
< ... Complete error trace ommitted ... >
packages\scipy\sparse\csr.py", line 13, in <module>
from ._sparsetools import csr_tocsc, csr_tobsr, csr_count_blocks, \
ImportError: DLL load failed: The specified module could not be found.
However, if i follow the same process for Python 3.4 replacing the installers with:
numpy‑1.10.1+mkl‑cp35‑none‑win32.whl
scipy‑0.16.1‑cp35‑none‑win32.whl
Everything seems to work. Are there additional dependencies or install packages that I am missing for the Python 3.5 install?

Make sure you pay attention to this line from the link you provided:
Many binaries depend on NumPy-1.9+MKL and the Microsoft Visual C++
2008 (x64, x86, and SP1 for CPython 2.6 and 2.7), Visual C++ 2010
(x64, x86, for CPython 3.3 and 3.4), or the Visual C++ 2015 (x64 and
x86 for CPython 3.5) redistributable packages.
Download the corresponding Microsoft Visual C++ Redistributable Package which should be this one based on your description.
I had a similar problem, can't recall the exact issue, and I download the one for my system and it worked fine. Let me know otherwise.

Possibly helpful: trying to pip install scipy-0.18.0rc2-cp35-cp35m-win_amd64.whl (downloaded from http://www.lfd.uci.edu/~gohlke/pythonlibs/) on 64-bit windows 7 with Python 3.5 failed with a "file does not exist/not a valid wheel filename" error.
From various hints obtained from here and elsewhere I found that renaming the file to: scipy-0.16.1-cp35-none-win_amd64.whl allowed it to install.

Pull up the command window (search for it in the start button), then enter
pip install numpy
and
pip install scipy‑0.16.1‑cp35‑none‑win32.whl
then it should let you know in the command window if it was successfully downloaded, if you have python 3.5.

I had a question that turned out to be a duplicate of this one here:
ImportError: DLL load failed: when importing statsmodels
I actually solved this and other issues related to installing packages (such as statsmodels) by using Anaconda installer for Python 3.5.

Related

Could not import cufflinks

Problem
I am trying to install both plotly and cufflinks. However I had a problem.
The installation of both plotly and cufflinks were successful. Although, I can't import cufflinks.
Below is a picture of the problem. It seems to be a dependency error:
I tried manually downloading and installing "talib" but I keep getting failures. (Shown below).
talib\common.c(240): fatal error C1083: Cannot open include file: 'ta_libc.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2
Any Ideas? I tried re-installing both modules and Anaconda. Nothing So far.
Other infos:
Cufflinks version: 0.11.0
Plotly version: 2.0.10
Anaconda version: 3-4.4.0 (But I don't think it have anything to do with it)
Python version: 3.6.1
try installing this version of cufflinks, it eliminated the error for me.
pip install cufflinks==0.8.2
From this link: github.com/mrjbq7/ta-lib#troubleshooting
Troubleshooting
Sometimes installation will produce build errors like this:
func.c:256:28: fatal error: ta-lib/ta_libc.h: No such file or directory
compilation terminated.
This typically means that it can't find the underlying TA-Lib library, a dependency which needs to be installed. On Windows, this could be caused by installing the 32-bit binary distribution of the underlying TA-Lib library, but trying to use it with 64-bit Python.
Windows
Download ta-lib-0.4.0-msvc.zip and unzip to C:\ta-lib
This is a 32-bit release. If you want to use 64-bit Python, you will need to build a 64-bit version of the library.
My Fix
So, for windows, we need a 64-bit version of the library? Luckly I found a lot of modules built for 32 and 64 bits python:
http://www.lfd.uci.edu/~gohlke/pythonlibs/
search for "ta-lib" and click on the module you need (In my case cp36 64 bits).
Then, open the command prompt.
Change to where you downloaded the file: cd path/to/file
Type: pip install NameOfFile (in my case pip install TA_Lib‑0.4.10‑cp36‑cp36m‑win_amd64.whl )
Now the 64-bits Ta-Lib module should be installed in your machine. I tested the previous line of codes and it worked!
Thanks for the help :)
I have now removed all dependencies on talib. All studies are pure python based now and you should not face any of this errors.

Geopandas import error [duplicate]

I have installed Python 2.5.4, Numpy 1.5.0 win32, Matplotlib 1.0.0 win32, pywin32 218. Still not able to plot graphs in Python. Here is the error I am getting :
import pylab
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 216, in <module>
from matplotlib import mpl # pulls in most modules
File "C:\Python25\lib\site-packages\matplotlib\mpl.py", line 1, in <module>
from matplotlib import artist
File "C:\Python25\lib\site-packages\matplotlib\artist.py", line 6, in <module>
from transforms import Bbox, IdentityTransform, TransformedBbox, TransformedPath
File "C:\Python25\lib\site-packages\matplotlib\transforms.py", line 34, in <module>
from matplotlib._path import affine_transform
ImportError: DLL load failed: The specified module could not be found.
Please kindly help..
(I found this answer from a video: http://www.youtube.com/watch?v=xmvRF7koJ5E)
Download msvcp71.dll and msvcr71.dll from the web.
Save them to your C:\Windows\System32 folder.
Save them to your C:\Windows\SysWOW64 folder as well (if you have a 64-bit operating system).
Now try running your code file in Python and it will load the graph in couple of seconds.
I had the same issue with importing matplotlib.pylab with Python 3.5.1 on Win 64. Installing the Visual C++ Redistributable für Visual Studio 2015 from this links: https://www.microsoft.com/en-us/download/details.aspx?id=48145 fixed the missing DLLs.
I find it better and easier than downloading and pasting DLLs.
For Windows 10 x64 and Python:
Open a Visual Studio x64 command prompt, and use dumpbin:
dumpbin /dependents [Python Module DLL or PYD file]
If you do not have Visual Studio installed, it is possible to download dumpbin elsewhere, or use another utility such as Dependency Walker.
Note that all other answers (to date) are simply random stabs in the dark, whereas this method is closer to a sniper rifle with night vision.
Case study 1
I switched on Address Sanitizer for a Python module that I wrote using C++ using MSVC and CMake.
It was giving this error: ImportError: DLL load failed: The specified module could not be found
Opened a Visual Studio x64 command prompt.
Under Windows, a .pyd file is a .dll file in disguise, so we want to run dumpbin on this file.
cd MyLibrary\build\lib.win-amd64-3.7\Debug
dumpbin /dependents MyLibrary.cp37-win_amd64.pyd which prints this:
Microsoft (R) COFF/PE Dumper Version 14.27.29112.0
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file MyLibrary.cp37-win_amd64.pyd
File Type: DLL
Image has the following dependencies:
clang_rt.asan_dbg_dynamic-x86_64.dll
gtestd.dll
tbb_debug.dll
python37.dll
KERNEL32.dll
MSVCP140D.dll
VCOMP140D.DLL
VCRUNTIME140D.dll
VCRUNTIME140_1D.dll
ucrtbased.dll
Summary
1000 .00cfg
D6000 .data
7000 .idata
46000 .pdata
341000 .rdata
23000 .reloc
1000 .rsrc
856000 .text
Searched for clang_rt.asan_dbg_dynamic-x86_64.dll, copied it into the same directory, problem solved.
Alternatively, could update the environment variable PATH to point to the directory with the missing .dll.
Please feel free to add your own case studies here! I've made it a community wiki answer.
Installing the Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017 and 2019 worked for me with a similar problem, and helped with another (slightly different) driver issue.
Since Python 3.8, it is possible that Dependencies or dumpbin /dependents reports no dependency issue, but one still gets the error "The specified module could not be found". This is because the PATH variable is no longer used for resolving DLLs of binary modules!
The solution is to use os.add_dll_directory:
import os
os.add_dll_directory(r"C:\path\to\your\dll\directory")
import your_module
Quick note:
Check if you have other Python versions, if you have removed them, make sure you did that right. If you have Miniconda on your system then Python will not be removed easily.
What worked for me: removed other Python versions and the Miniconda, reinstalled Python and the matplotlib library and everything worked great.
I installed vc++ which solved this problem.
Reinstall the related packages.
I have the same issue with numpy. I first uninstalled it:
pip uninstall numpy
and then installed again
pip install numpy==1.20.1
I needed that specific version. If you want to install other numpy versions, you may ignore ==1.20.1.
Also, during the installation, I received errors such as
statsmodels 0.12.2 requires patsy>=0.5, which is not installed.
I installed those missing prerequisites as well. e.g.,
pip install patsy
I just uninstalled my current numpy and installed a wheel numpy from this link.
This has solved my issue. I guess we shoudn't use dll from random source.
This might be issue of missing Microsoft Visual C++ Redistributable packages for Visual Studio 2015, 2017, 2019, and 2022 in your machine. Use the following link to download the distributable and install it in your machine.
VC_redist.x64.exe
For more: Microsoft Visual C++ Redistributable Latest Supported Downloads
I've been through this error and what I found after a lot of investigation:-
issue was in Opencv==4.5.1 build from source with cuda and flag cuda_with_fast_math=on
I just rebuild OpenCV and disable
cuda_with_fast_math
make sure that the shared library builded with cv version matched your current version
and it works for me.

Python: Broken toolchain error while installing numpy

I am using Python 2.7.3 and trying to install the package numpy on my windows machine but I am getting a Runtime error that says Broken toolchain: cannot link to a simple C program. I read the solution here but it was specific to Mac OS. I tried installing numpy with pip as well as the setup.py install option but both the methods give the same error.
I recently installed Visual Studio 2008 and Microsoft Windows SDK for Windows 7 and .NET Framework 3.5 SP1 (this is necessary as VS 2008 does not provide a 64 bit compiler) to remove the "vcvarsall.bat not found" error. Are these two error related or am I missing something in the process? Please help!
Also, after installing VS 2008, I have VS90COMNTOOLS in the system variable. What can be the problem for Broken toolchain error?

Installation issue pycrypto-2.6 on Windows 8

Not sure what I'm doing wrong but when I run pycrypto-2.6.win-amd64-py3.3.exe I get Python 3.3 is required, which I have just installed before I tried to install the crypto. I should also note that I have VS 2013 installed, as I'm reading that I may need to compile the whole thing or something.
Anyway, as an option I have a Fedora installed on a Virtual Box, not sure how use it though but if it is "easier" on Fedora I can try to install it there.
I'm actively searching for a solution but am short on time and would like some help. Thanks.
You probably installed 32bit version of Python - install 64bit version.
pycrypto-2.6.win-amd64-py3.3.exe is binary package which means it's already compiled so you don't need compiler to install it. If compilation were needed you would have to have the same version of Visual C++ which was used to build Python itself; in case of the official Python 3.3 that's Visual C++ 2010 not 2013. See What version of Visual Studio and/or MinGW do I need to build extension modules for a given version of Python? question for more details.

Is there an M2Crypto installer for Windows 7 64-bit?

Is there an M2Crypto Windows installer for Python 2.7 64-bit? If not is there a reason why one cannot be built?
M2Crypto-0.21.1.win-amd64-py2.7 is available as part of the ActivePython Business Edition. M2Crypto is easy to build from the source distribution using Visual Studio 2008 but there are legal reasons why the binaries cannot be freely distributed.
You can try my Windows 64 build for Python 2.7:
http://brabenec.net/misc/packages/M2Crypto-0.21.1.win-amd64-py2.7.exe
http://brabenec.net/misc/packages/M2Crypto-0.21.1-py2.7-win-amd64.egg
Install via pip: pip install M2CryptoWin64 (for 64-bit Win) or pip install M2CryptoWin32 (for 32-bit). See this blog
It needs to install openssl-1.0.1b to get rid of issue
ImportError: DLL load failed: The specified module could not be found.

Categories