openCV DLL load failed: %1 - python

>>> import cv2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: DLL load failed: %1 er ikke et gyldigt Win32-program.
>>>
I downloaded the newest version of openCV from https://sourceforge.net/projects/opencvlibrary/files/opencv-win/
Then copied the x64.pyd from folder C:\opencv\build\python\2.7 to C:\Anaconda3\Lib\site-packages but it still complaints.
Python 3.5.1 |Anaconda 4.0.0 (64-bit)[MSC v.1900 64 bit (AMD64)] on win32
I saw an answer from another post here: ImportError: DLL load failed: %1 is not a valid Win32 application I found 2 dll files in my C:\opencv\build\bin and sat that path to my system variables. But did not result in success.

The Python OpenCV DLL must be made for your version of Python and your system architecture.
You could try each of these steps:
Download OpenCV for your Python version (2/3)
Try replacing the x64 version with the x86 version, AFAIK if you have installed the more common Python 32bit on a x64 system, you'll still need the x86/32bit version of OpenCV
There are a lot of different binaries here: http://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv. Try to get the one exactly matching your Python version and System architecture and install it via pip (cp35 means CPython version 3.5 etc.).
If you have the OpenCV .whl file matching your system configuration, do
pip install file.whl
At least the last one should definitively work!

Related

Importing .pyd file error "%1 is not a valid Win32 application."

I'm trying to import .pyd file into python code
the following error is thrown:
"ImportError: DLL load failed while importing _MY_PYD: %1 is not a valid Win32 application."
using python 3.10(64bit) / pyscripter4.1 64bits
I have downloaded and upgraded almost all suggested packages, numpy,winpy32 etc..
What else the issue could be ?
Downloaded and upgraded Python packages
Reinstall of Python and Pyscripter

Installing pymssql on Windows server [duplicate]

This question already has answers here:
"ImportError: DLL load failed" when trying to import pymssql on Windows
(3 answers)
Closed 6 years ago.
I need to run Python with the pymssql library to query SQL server and I spent a day installing and compiling stuff on Windows.
Installation of pymssql was very painful, until I developed this procedure:
install python
update pip
download OpenSSL from http://www.npcglib.org/~stathis/blog/precompiled-openssl/
add bin folder to Path environment variable
download FreeTDS from https://github.com/ramiro/freetds/releases
add lib folder to Path environment variable
pip install pymssql
I even created the .exe package, so I won't have to install all this on live machine. It worked OK. Executable also worked on some other Windows machine.
But, when I tried it on the server it didn't work for some reason. The error didn't make sense and I started to cry:
WindowsError: [Error -2146893795] Provider DLL failed to initialize correctly
Could not help myself with links like this one:
"Windows Error: provider DLL failed to initialize correctly" on import of cgi module in frozen wxpython app
I have hundreds of tabs opened in my browser and I think I've searched the entire Internet.
I decided I'd try the Python and pymssql installation on the server, which I wanted to avoid, but let's go. And of course my frustration didn't end here. After successful installation I still can't load pymssql:
C:\Users\Me>C:\Python27\python.exe
Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec 5 2015, 20:40:30) [MSC v.1500 64 bit (
AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import time
>>> import sys
>>> import pymssql
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: DLL load failed: %1 is not a valid Win32 application.
Can anyone point out where I went wrong?
When setting up pymssql version 2.1.2 and later on Windows, be careful to ensure that:
You download the builds of FreeTDS and OpenSSL that correspond to the Python version (e.g., 2.7, 3.4, 3.5, ...) that you are using.
You download the build of FreeTDS with the same "bitness" of Python that you are using (32-bit or 64-bit).
When adding folders to the Windows PATH, you must
i. specify the folders in which the required DLL files reside, and
ii. choose the OpenSSL folder that corresponds to the "bitness" of Python that you are using: bin for 32-bit, or bin64 for 64-bit.
For more information, see the related question:
"ImportError: DLL load failed" when trying to import pymssql on Windows

Lost module while installing opencv 2.4.9 for python in Windows

I try to install opencv from source. I use Visual studio 2010, python 2.7.8 and make steps like here.
The problem is that when importing cv2 I get error:
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import cv2
ImportError: DLL load failed: The specified module could not be found.
There are following cv-files in the C:\Python27\Lib\site-packages:
cv2.pyd
cv.py
cv.pyc
I also have Python 3.4.1 but CMake doesn't see that, so I think it is not the reason.
But CMake has just two lines in the PYTHON group:
PYTHON_NUMPY_INCLUDE_DIR C:/Python27/lib/site-packages/numpy/core/include
PYTHON_PACKAGES_PATH C:/Python27/Lib/site-packages
Here's what my install of OpenCV for Windows, built with MinGW for C++ includes.
It's not actually an install - the folder can be zipped and put on any computer, provided you specify to CMake the paths.

Pygame help 2.7

I have installed pygame for python 2.7 but this come up if I type import pygame
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import pygame
File "C:\Python27\lib\site-packages\pygame\__init__.py", line 95, in <module>
from pygame.base import *
ImportError: DLL load failed: %1 is not a valid Win32 application.
Please help me
According to pygame download page NOTE:
windows 64bit users note: use the 32bit python with this 32bit pygame.
Make sure you're using 32bit version of Python.
I have had this problem recently, i have found that if you are using a 64 bit machine, then you need the 64 bit version of python and the 64 bit version of pygame. The 64 bit version of pygame is not available on the main website but you can download it from here: http://www.lfd.uci.edu/~gohlke/pythonlibs/
I would suggest uninstalling python 2.7 and reinstall the 64 bit version of it from the python download page. when you install pygame, use the file called "pygame‑1.9.2a0.win‑amd64‑py2.7.exe" (without the quotes) on http://www.lfd.uci.edu/~gohlke/pythonlibs/
Good luck.
I had this problem and solved it. I found a 64 bit pygame version at http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame
Select pygame-1.9.2a0-cp27-none-win_amd64.whl (for python 2.7) from the list of options available.
Copy the downloaded file to path/to/python27/Scripts
Then use pip installer.
Install wheel package first if you don't have it already. It is used to extract and install whl files.
Open cmd.
cd path/to/python27/Scripts
pip install wheel
pip install pygame-1.9.2a0-cp27-none-win_amd64.whl
Hope that solves it.

how to install the 'pysparse' package using Enthought python, Windows XP SP3?

I am running on a Windows XP SP3 and currently have fresh installations of the following:
Enthought python Dist. version 7.1-2 (32-bit)
--> which set up a Python 2.7.2
pysparse-1.1.1.win32-py2.7.exe downloaded from - http://www.lfd.uci.edu/~gohlke/pythonlibs/#pysparse
microsoft visual studio 2010
I need pysparse inorder to install and use 'fipy'.
From some reason any attempt include a .pyd file from pysparse e.g :
>>> from pysparse import jdsym
ends with the following :
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: DLL load failed: The specified module could not be found.
I should point out that installing other packages from the same link and including .pyd files worked fine.
Any help would be incredibly great.
You can download the compiled Pysparse library for Windows system from the following website:
http://www.lfd.uci.edu/~gohlke/pythonlibs/
Then just by running the related EXE file you can install the pysparse and import to your code.

Categories