Installing PyQt4 on Windows - python

I have tried installing the binary from lfd.uci.edu/~gohlke/pythonlibs/#pyqt4 for python 3.5 and 3.6 both. Still it is not working. Now it throws DLL error. How to fix it?
builtins.ImportError: DLL load failed: The specified module could not be found

A quick look inside the .whi for Python 3.6 with dependency walker suggests that the package requires msvcp140.dll and vcruntime140.dll which are part of the Visual C++ Redistributable for Visual Studio 2015

Related

DLL Load Failed (Open cv2)

i tried many solutions for that error but didn't solved
ImportError: DLL load failed while importing cv2: The specified module could not be found.
Make sure you have installed right versions. Follow the below link for the compatible versions installed.
https://www.tensorflow.org/install/source_windows#gpu
https://www.drdataking.com/post/install-gpu-support-to-tensoflow-on-windows/
I was too getting similar issue:
DLL load failed while importing _multiarray_umath: The specified module could not be foundDLL load failed while importing _multiarray_umath: The specified module could not be found
Solution was the environment variable path was not set properly. Please find the image below:
Solution
in python 3.8 i fixed a similar error when compiling with cxfreeze cv2 dll load failed ,
the problem was that i had another version of python 3.6 installed and although environment variable path from python 3.8 was first, cxfreeze still loaded opencv from python 3.6 causing the error in the output file,
I fixed it by moving python 3.6 to another location so not get detected by cxfreeze, be careful with the environments variable path if you have other versions of python installed when compiling.
try miniconda with Python 3.6 is more stable ,
https://repo.continuum.io/miniconda/
Miniconda3-4.5.4 was the last Python 3.6 miniconda package.
Try to Install other versión of opencv
pip install opencv-contrib-python
Install Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017 and 2019
https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads
Install media feature pack only if you use win10
https://www.microsoft.com/en-us/software-download/mediafeaturepack
this article may interest you
DLL load failed error when importing cv2

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.

Can't Install Python Libraries with C Dependencies

I'm currently running Python 3.4 on Windows 8.1 using PyCharm Community 5.0.3 and I've been running into the following error when I try to install libraries with C dependencies (ie pymssql):
error: Microsoft Visual C++ 10.0 is required (Unable to find vcvarsall.bat)
I've gone through various Stack Overflow responses to similar situations but haven't been able to find a viable answer as most of the questions are for Python 2.7. The main response I have found is to re-download Visual Studio 10, which I haven't been able to find at all on the web.
Any insight into this matter would be great.
First of all you can Download Microsoft Visual 2013 Redistributable Packages from this link
You can also use Mingw as a compiler for python 2.x and also for 3.x
check this documentation : https://docs.python.org/2.7/install/#gnu-c-cygwin-mingw
This allows you to have compiler to build your extensions for your python,to use mingw as a compiler for python you have to :
1-install mingw32 to **C:\programs\mingw**
2-Add mingw32's bin directory to your environment variable: append c:\programs\MinGW\bin; to the PATH
3-Edit (create if not existing) distutils.cfg file located at C:\Python2\Lib\distutils\distutils.cfg to be:
[build]
compiler=mingw32
Now run easy_install.exe to install any module using c or c++ extensions :)

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

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.

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?

Categories