- Python: Модуль установлен, но ImportError: DLL load failed: Не найден указанный модуль
- sdl2 — ImportError: DLL load failed: The specified module could not be found and [CRITICAL] [App] Unable to get a Window, abort
- Kivy Installation Method
- Description
- Code and Logs
- 5 Answers 5
- How to fix “ImportError: DLL load failed” while importing win32api
- 13 Answers 13
- How to find which DLL failed in “ImportError: DLL load failed while importing” in python?
- Question
- Can’t import cv2; “DLL load failed”
Python: Модуль установлен, но ImportError: DLL load failed: Не найден указанный модуль
Пытаюсь установить библиотеку DLIB http://dlib.net/.
отлично устанавливается и работает, но как я понял не использует технологию CUDA. Не один день я потратил на эту компиляцию и установку, поэтому покажу последовательность установки, вдруг кто с тем же столкнется:
Когда устанавливал со всеми этими зависимостями, то в лог писалось что версия моей VS не подходит, то до этого где-то вычитал что такое бывает и можно подредактировать чтоб обойти это ограничение.
Поэтому пошел сюда
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\include\crt\host_config.h
И на 131 строчки, не помню что там было, что-то типо если версия не ниже и не выше, то сделал не ниже и все, а точнее заменил на эту строку:
Теперь распишу последовательность действий:
Здесь все отлично собралось без ошибок, и в логе было видно что CUDA Enabling, в отличие если бы устанавливал по официальной документации.
Далее устанавливаю в Python:
После не быстрой и сильно загружающей систему компиляции, было видно что так же CUDA Enabling и в конце зеленым Успешно установлено и библиотека скопирована в директорию:
После не большой радости что наконец-то установил, вылезло вот что:
sdl2 — ImportError: DLL load failed: The specified module could not be found and [CRITICAL] [App] Unable to get a Window, abort
Kivy Installation Method
Description
Hi, I am trying to run the example code from the install Kivy. The following is the error I receive back. Any help would be great. I have tried looking at previous enquiries about similar problems, but nothing suggested on them has worked so far.
Code and Logs
Code that I am trying to run:
5 Answers 5
I had the same problem. I solved this by removing Kivy and its dependencies first.
Now reinstalling everything except gstreamer.
It solved the error. Credits to Ben R’s Answer.
I had the very same problem, and for me the solution was to make use of virtualenv instead of venv. This forces Kivy to use a specific installation of Python.
Download and install Python 3.7, since 3.8 doesn’t seem to be supported yet (https://www.python.org/downloads/release/python-376/)
Install virtualenv if not already installed
pip install virtualenv
Create a virtual environment, specifying the path to the newly installed Python version
virtualenv —python=C:\path\to\Python37\python.exe my_venv
Activate the new virtual environment
Install kivy according to Javapocalypse’s answer
How to fix “ImportError: DLL load failed” while importing win32api
I’m setting up an autoclicker in Python 3.8 and I need win32api for GetAsyncKeyState but it always gives me this error:
I’m on Windows 10 Home 64x. I’ve already tried
and it successfully installs but nothing changes. I tried uninstalling and re-installing python as well. I also tried installing ‘django’ in the same way and it actually works when I import django , so i think it’s a win32api issue only.
I expect the output to be none, but the actual output is always that error ^^
13 Answers 13
Run Scripts\pywin32_postinstall.py -install in an Admin command prompt
edit: User @JoyfulPanda gave a warning:
Running this script with admin rights will also copy pythoncom37.dll, pywintypes37.dll (corresponding to the pywin32 version), into C:\WINDOWS\system32 , which effectively overwrites the corresponding DLL versions from Anaconda already there. This later causes problem when openning (on Windows) «Start Menu > Anaconda3 (64-bit) > Anaconda Prompt (a_virtual_env_name)». At least Anaconda 2019.07 has pywin32 223 installed by default. Pywin32 224 may work, but 225-228 causes problem for Anaconda (2019.07)
For my case, install and reinstall pywin32 doesn’t help. After copied the two files from [installation directory of Anaconda]\Lib\site-packages\pywin32_system32 to C:\Windows\System32 , it works.
My environment is python 3.8 in miniconda. The two files are pythoncom38.dll and pywintypes38.dll .
Solved
If you are working in a miniconda on conda environment. You could just install pywin32 using conda instead of pip.
This solved my problem
conda install pywin32
For me, it worked by downgrading my pywin32 from version 227 to version 224. Just type the following command on any shell in administrator mode:
conda install pywin32 worked for me. I am using conda distribution and my virtual env is using Python 3.8
This happens when Lib\site-packages\pywin32_system32 is not in the list of directories to search for DLL (PATH environment variable).
pywin32 (or one of its dependencies) adds this path at runtime to the PATH variable. If this is failing, or another component is overriding the PATH after it’s been set by pywin32, you will get the given error (ImportError: DLL load failed while importing win32api).
You can try to extend the PATH variable in the shell before starting Python.
On Unix like systems:
If that doesn’t work, then the PATH maybe overridden within the Python program at runtime. Add the following line to your program just before pywin32 is used to verify its value:
As a last resort, you can extend the PATH variable before pywin32 is loaded:
How to find which DLL failed in “ImportError: DLL load failed while importing” in python?
Are there commands to enhance the error message that is received such that python displays which .dll file it cannot find?
I would like to determine which .dll file is actually not being found. To do so, I downloaded and run DependenciesGui.exe from this repository.. Next I fed the DependenciesGui.exe the cv2.cp38-win_amd64.pyd which indicates api-ms-win-core-wow64-l1-1-1.dll is missing, amongst others.
I currently do not have a way to verify that the .dll files that are reported missing by dependenciesGUI.exe are also the files that python 3.8 is not finding in the anaconda environment.
A way to implicitly verify that the python 3.8 missing .dll files are the same as the same files reported missing by dependenciesGUI.exe would be to download and paste all the missing .dll files into ../system32/ . Followed by inspecting if the error message dissapears/changes. However one of the .dll files reported missing is: api-ms-win-core-wow64-l1-1-1.dll which I am not yet able to find (online). Also I tried to cheat to copy and rename api-ms-win-core-wow64-l1-1-0.dll to api-ms-win-core-wow64-l1-1-1.dll but that (luckily) doesn’t enable the dpendenciesGUI.exe to recognize the .dll file as found.
Question
How can I make the error message/traceback of python explicitly mention which .dll file is (the first .dll file that is) not found?
This is not about solving the xy-problem of installing opencv .
Can’t import cv2; “DLL load failed”
I really didn’t want to start my own question with this because it seems to be a common error here. However, having wasted hours on this now and having followed every thread I could find, none of the given answers have sorted this for me.
So my only option is to provide all the information I can about my set up and hope one of you lot can recognise the problem.
I’m running on windows 10(x64) and have installed the following prebuilt binaries from the collection here.
- python 3.5.0-win32 (installed from python website)
- numpy 1.10-cp35-win32
- matplotlib 1.4.3-cp35-win32
- opencv 3.0.0-cp35-win32
Everything was installed using «pip install file_name.whl» with no error messages. However the difference is open cv will not import and I get the following error:
cv2.cp35-win32.pyd plus many .dll files are installed to C:\Python35\Lib\site-packages
I’ve tried renaming cv2.cp35-win32.pyd to cv2.pyd and copying the .dll files to C:\Python35\DLLs
I’ve tried using another python opencv package downloaded from the site, adding the bin directory to my PATH environment and moving the cv2.pyd file to C:\Python35\Lib\site-packages
The same error appears every time. Any help would be appreciated!