when i try to
import Pillow.selftest
no problem.
but, as you can see,
import Pillow._imaging
raises a importerror. i have been trying to rename the c-module, move it to the Lib folder, importing other (.py) modules in same folder, which works. nothing seems to work, any idea why?
as you can see, im using windows 7, python 3.3 and the pillow fork of PIL
Which version of Pillow are you using? Neither the 1.1.7 or 2.0.0 have import Pillow._imaging as core within image.py.
It looks like you have copied the contents of the source archive into Lib without running setup.py, which will be necessary to compile the C modules. Try using the Windows installer available on PyPi
Related
A Python script starts with:
from pathlib import Path
import sqlite3
which I read as an initialization of Libraries needed to run the rest of the script. However if the following error is returned in the terminal:
ImportError: No module named pathlib
I am uncertain how to interpret this. One assumption is that the pathlib library is uninstalled. However on the local system Python 2.7 and Python 3.4 are installed (I believe one was system pre-installed).
How can a library be asserted to exist? In case it is missing, how can it be installed?
You have to install it first
pip install pathlib
And with that your code should work.
I'm trying to embed a C++ application with Python. I downloaded the minimum zip file from python.org for embedding, installed pip and installed numpy. But when executing a simple test with PyRun_SimpleString("import numpy"); it returns an error ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'.
I tried to install other libs with pip and tried to import them, they all work, except numpy. I have the paths to my python36, Lib and DLLs folder. Upon debbugging with ProcessMonitor I see _multiarray_umath.cp36-win_amd64.pyd in the numpy/core folder is never used when I run it with my C++ application.
If I use the normal command line python.exe import numpy approach with the same python folders it works and _multiarray_umath.cp36-win_amd64.pyd is used.
I tried adding the site-packages path or even the full numpy path, but still it doesn't use the .pyd file like the command line python.exe. I tried adding libopenblas.PYQHXLVVQ7VESDPUVUADXEVJOBGHJPAY.gfortran-win_amd64.dll and python36.dll to the numpy/core folder as suggested by other posts, but it didn't have any impact.
What else can be the problem?
Thank you very much in advance.
Recently, I have installed a current version of Python(x,y) package (2.7.6.0) and now when I run my python code, it shows an error:
Traceback (most recent call last):
File "D:\Projects\comparison\Lagebestimmung\main.py", line 11, in <module>
import cv2
ImportError: DLL load failed: The specified procedure could not be found.
I correctly selected opencv module during the installation.
Also, I use to have an older version of Python(x,y) before in my computer which I uninstalled before installing the new version. In that version, there was no such problem.
Use Dependency Walker (http://www.dependencywalker.com/) on your cv2.pyd from 'site-packages'.
Look at the higher-left corner, where the library tree is.
Normal libraries have blue or gray icons, find libraries with red icons on the left, like this: http://i.stack.imgur.com/YiEuD.png.
Find API's having a red flag and remember parent library names of the libraries with red icon. Red flag means that parent library requires some API, which is absent in the underlying library. In my case a library with the red icon is 'kernel32.dll', and it's parent libraries are msvcr90.dll, tbb.dll and the library from 'winsxs', which name's is obscured.
Usually a problem can be solved by obtaining correct versions of the parent libraries.
For example, you are trying to use a DLL, which is compiled for Windows Vista, on Windows XP. This DLL imports a 'InitializeCriticalSectionEx' API, which is absent in Windows XP's 'kernel32.dll'. Obtaining the XP version of your DLL or recompiling it with 'InitializeCriticalSection' instead of 'Ex' will solve the problem.
Another example: you are using OpenCV compiled for use with Qt 4.8.4 and PyQt4, which contains Qt version 4.7. cv2.pyd (which is a DLL, by the way) will refuse to import because certain Qt API's required in your OpenCV are not available in 4.7's DLL's. The solution is to put Qt libraries version 4.8.4 into your '%PYTHONHOME%\Lib\site-packages\PyQt4' folder or PATH. I encountered this problem myself when building my own version of OpenCV from git repo.
For programmers using python 3, download a wheel package in order to install OpenCV.
You will need to make sure that NumPy is already installed. Anaconda is a nice package to handle dependencies. You would get numpy out of the box with it.
Then, download the OpenCV version corresponding to your Python installation version from : http://www.lfd.uci.edu/~gohlke/pythonlibs/
You can find the version of your Python interpreter by running:
python --version
In my case as I run C-Python 3.5, I chose :
opencv_python‑3.2.0‑cp35‑cp35m‑win_amd64.whl
Finally, in the directory you have downloaded the wheel package, run:
pip install opencv_python-3.X.X-cpXX-cpXXm-xxxx.whl
Try this:
Install opencv for windows. download it at here :
http://sourceforge.net/projects/opencvlibrary/files/opencv-win/2.4.1/OpenCV-2.4.1.exe/download
Then
Copy cv2.pyd from C:\opencv\build\python\x86\2.7\ and paste it in the folder python site-packages folder . restart your IDE.
Make sure numpy is installed. If not , get it from here ..
http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy
I had the same problem and when i use ipython [just write ipython at cmd if you have ipython installed] it works.
the following worked for me. Assuming that Python(X,Y) is installed (and the option for OpenCV was checked at the beginning of the installation), I did the following steps:
Download opencv-2.4.13, and extract file in a given folder.
Copy file "cv2.pyd" (which is a file of 10MB)
Replace the file cv2.pyd in the "...\Lib\site-packages" folder. You will notice that the original "cv2.pyc" file size is below 2MB.
Start Python(x,y) and the Spyder. Type "cv2.version" in the Python console. You may get >>> cv2.version -> '2.4.13'
OpenCV is now working!
Greetings!
So I'm creating a Python script that will when finished be compiled with Shedskin. Currently we do a little FTP work in this script so we import the ftplib module. When I attempt to compile it with Shedskin we get the error back saying that there is no '_socket' file in our Python2.6 installation on Ubuntu. I've checked myself in the '/usr/lib/python2.6/lib-dynload' dir to confirm that yes there isn't any file entitled '_socket.so' present in that folder.
I've tried reinstalling the python2.6 package in Synaptic but to no avail.
What should I do?
Look for shdeskin supported library modules in
/usr/lib/python2.6/site-packages/shedskin/lib/.
My Fedora installation of shdeskin 0.7 does not include ftplib.
I'm trying to use the win32gui module included with pywin32 but I can't get it working.
I have downloaded it, built it and everything seem to be located under site-packages, I've found win32gui.pyd at site-packages/win32/win32gui.pyd but when I try to import it I get:
import pyHook, win32gui
ImportError: DLL load failed: The specified module could not be found.
Do I need to move a dll somewhere? and if so, which one?
This works:
import pywintypes
#import pythoncom # Uncomment this if some other DLL load will fail
import win32gui
I had the same issue. I added the path where pywintypes34.dll to system path and it worked.
In my case it was C:\Python34\Lib\site-packages\pywin32_system32
My guess is that win32gui depends on some DLL that is not on your system. You can download depends and see what you're missing.
However my first attempt will be try installing pywin32 from the installer, not by building it.
First check that "pywin32" module is installed in your system or not. If not installed then install it first. http://www.lfd.uci.edu/~gohlke/pythonlibs/#pywin32
If the issue still persists then now for the /Lib/site-packages/pywin32_system32 and add this path to system library or add pythoncom35.dll and pywintypes35.dll to the directory which is added to a system path.
I tried to only "copy" pywin32 package once instead of installing it and it works well.
what i've done is :
Copy over all the related packages to site-packages folder
Copy pythoncom25.dll & pywintypes25.dll to c:\windows\system32 folder (you might need to change to version&system path)
Hope it helps
Oddly, this is still an issue 12 years later. I suddenly had the same problem - got a DLL not found error importing win32gui with pywin32 v303.
The answer by DSblizzard from 2011 solved the issue for me, and everything worked once I imported pywintypes prior to win32gui:
import pywintypes # Not used, but need it for win32gui to import correctly
import win32gui
Same problem, I installed from sourceforge and then I run the .exe as administrator.
I wanted a win32gui module for which I installed the pywin32 module still error " DLL load failed while importing win32gui: The specified module could not be found", I went to folder pywin32_system32 folder in my virtual environment and copied DLLs and pasted inside win32 folder.
worked for me
This seemed to be the missing piece for me:
python.exe Scripts/pywin32_postinstall.py -install
That should be run after doing a:
pip install pywin32
After running those two things, import win32gui started working for me.