I have an algorithm written in C++ that I want to use in ArcGIS. Arc supports python scripting, so I figured I'd write a python wrapper. I built python on my development PC and then built a module (called "delaunay", to calculate Delaunay triangulations) to wrap the algorithm. On that PC I was using cygwin with mingw g++ and put the .dll that I built into /usr/local/lib/python2.6/site-packages. Works fine.
So now I'm trying to get it to work on the PC that I run GIS on. ArcGIS installs python as part of its own installation, so I put the .dll in /Python26/ArcGIS10.0/Lib/site-packages (which is in the sys.path) and tried to import it. I got the following error:
ImportError: No module named delaunay
Renamed delaunay.dll to delaunay.pyd and got this error:
ImportError: DLL load failed: The specified module could not be found.
I have a feeling it'd work if I put the source on the GIS machine and built and installed it with distutils, but I don't really want to install cygwin or Visual Studio on that machine.
Anyway, I have no idea why I get different messages, what the significance of the messages is, or whether this will work at all (i.e. is the ArcGIS distro of Python incompatible with mine 'cause we used different compilers?)
Also, the dev machine has a Jun 12, 2010 revision of Python 2.6.5 and the GIS machine has a Mar 19, 2010 revision. Maybe that is significant?
Help?
Run python -vvv and you'll see import debug info.
You are probably mixing 32-bit and 64-bit binaries. Binaries from different Python builds are incompatible.
Renamed delaunay.dll to delaunay.pyd and got this error:
ImportError: DLL load failed: The specified module could not be found.
This sounds like delaunay.pyd depends on some other dll that is not found.
Related
I have installed opencv 3.4.0 and python 3.6.4 and pycharm. In pycharm I installed the numpy package. To add the python to pycharm, I copied the cv2.pyd file from the opencv to the python directory (in the DLLs folder and the site-packages folder). I get this error for the import cv2 line when I run the project: ImportError: DLL load failed: The specified module could not be found.
In the opencv folder, under python there is only a folder for 2.7, If this is the problem what could I do? I need to use a 3.+ version of python.
This can happen if you are using windows 10 N distribution, the N distributions does not come pre installed with windows media feature pack, which is required after OpenCV version 3.4 and onwards.
The preferred solution is to install the feature pack at : https://www.microsoft.com/en-us/software-download/mediafeaturepack
Be careful to choose the version that works with your current version of windows.
If that is not an option, fall back to an earlier version of OpenCV that does not have dll dependencies, you can do that by:pip install opencv-python=3.3.0.9
If the problem still persists try using Dependency walker to find out where specifically your problems stem from and then try fixing them individually.
Since windows rolled out it's N version this problem has been seen at many places, and has many impacts across the windows environment, the fastest way to identify if you have this problem is open youtube in Edge browser, if it says HTML5 media plugin not found, this is the problem.
That should sort the problem, if it doesn't feel free to comment and maybe I can help more.
I'm trying to run a python script that uses a custom module written by someone else. I created that module by running CMake according to the creator's instructions. Running my python script, I get the error: ImportError: libopencv_imgproc.so.3.1: cannot open shared object file: No such file or directory. This error is caused by the module I created earlier.
There is no file of that name since I have OpenCV 3.2.0 installed, so in usr/local/lib there's libopencv_imgproc.so.3.2.0. I don't know how to fix this or where to start looking. The CMakeLists.txt of the module has a line
find_package(OpenCV 3 COMPONENTS core highgui imgproc REQUIRED).
I tried changing it to
find_package(OpenCV 3.2.0 COMPONENTS core highgui imgproc REQUIRED),
without success.
The problem was an old version of the module lurking an a different folder where the python script was actually looking. This must have been created in the past with an OpenCV 3.1 environment.
Since my Macbook with an i7 CPU is currently with AppleCare, I am now working on an older Mac mini with a core duo CPU. I simply connected the Macbook's internal disk via USB to the Mac mini.
Now back at my Python scripts, I ran into a problem which I don't fully understand and do not know how to debug. When I import pandas in Python 2.7.9, Python crashes completely and I get the error Illegal instruction: 4. After some googling I assume, that some packages are compiled for the wrong architecture. But I don't know which ones.
I installed Python, numpy and scipy with homebrew and pandas, etc. with pip into a virtual environment. My system is OS X 10.10.5.
The output of python -vc "import pandas" is very long and given here.
I tried re-installing Python, pandas, numpy, and scipy.
How can I find out which package is causing the error?
Do I need to set an architecture flag or something?
How can I fix this?
Removing the .pyc files might work too.
Since it happens right after the call to
dlopen("/usr/local/lib/python2.7/site-packages/matplotlib/_pabc.so", 2);,
you can try checking the arch type that file was built for with:
file /usr/local/lib/python2.7/site-packages/matplotlib/_pabc.so
then check the arch type of your hardward:
uname -a
If the shared object file (_pabc.so) was not built for that machine you may need to re compile/install/whatever, matplotlib or one of its dependancies.
In my recent experience, this was indeed caused by a linked library being of the wrong architecture as the module's library (as chown suggested).
In particular, a C-compiled python library as part of the python module you're importing (the _mymodule.so file in the module directory) calling a linked system library (eg. libgfortran.dylib), and there being an architecture mismatch between the two.
As aforementioned, you can check the architecture of your system with uname -a and check the arch of an offending dylib via the file /path/to/lib.dylib command.
I've been trying to install mapnik on my computer for hours but what i always get when I import mapnik is ImportError: DLL load failed: The specified procedure could not be found.
I'm using Windows 7. The currently installed software is Geoserver from Opengeo suite.
Here is my path
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\WIDCOMM\Bluetooth Software\;C:\Program Files\Java\jre7\bin;C:\Program Files\Java\jdk1.7.0_45\bin;C:\Python27;C:\mapnik-v2.2.0\lib
My python path:
C:\Python27;C:\Python27\Lib;C:\Python27\DLLs;C:\Python27\Lib\lib-tk;C:\Program Files\ArcGIS\bin;C:\\mapnik-v2.2.0\python\2.7\site-packages\;C:\mapnik-v2.2.0\bin\;
Follow the install instructions
First ensure you have 32 bit python 27 installed.
You can do this by typing the following into a python shell
>>> import platform
>>> platform.architecture()
('32bit', 'WindowsPE')
If you see '64bit', try reinstalling python with the 32bit version (look for the "Python 2.7.5 Windows Installer" link).
After that,
Download the mapnik package (I tested it with the full SDK version)
Extract the archive to C:\mapnik-v2.2.0
Add C:\mapnik-v2.2.0\lib; and C:\mapnik-v2.2.0\bin; to your PATH
Add C:\mapnik-v2.2.0\python\2.7\site-packages; to your PYTHONPATH
import mapnik
I had the same issue on WinServewr 2008 R2. The solution I found is to install Microsoft Visual C++(x86) redistributable package 10.0.40219, because mapnik depends on it. This package comes with postgreSQL 9.3 x86, so when you install only Postgre x64 version you can have this error.
I had this problem as well, even after I installed a 32-bit Python. I was getting the same error:
ImportError: DLL load failed: The specified procedure could not be found.
What fixed it in the end was copying all the DLLs to my python executable directory. I assume there was some DLL-hell type action going on and it was linking to a DLL somewhere with the same name but without that entrypoint. What entrypoint it was looking for I do not know.
In the end it was all useless though because it turns out that there is no OSM (OpenStreetMaps) plugin for the 2.2.0 version, so I decided to do this on Linux instead.
See the table at https://github.com/mapnik/mapnik/wiki/WindowsInstallation for the reference of a missing OSM plugin - execution results in a runtime error indicating the plugin could not be loaded.
I think Windows binary support for mapnik has been dropped so I don't expect much change here.
For a schoolproject I need to make use of the aubio library. However, I have a problem compiling it for Windows.
I downloaded the latest source from his git (0.4.0 alpha). Then I compiled it using Cygwin, using the --with-target-platform=win32 to cross-compile it for Windows. It uses waf by the way.
This works without any errors.
Next step is copying the compiled file (libaubio.dll.a) to MinGW library folder. Then I want to compile the Python wrapper for the module, but it shows up the ld.exe cannot find -laubio error. Renaming the libaubio.dll.a to libaubio.a resolves this and compiling succeeds succesfully.
Installing it into the Python folder works perfectly too. But here starts the problem. When trying to import aubio, I get this error: ImportError: DLL load failed: Invalid access to memory location.
I have no clue on how to solve this problem. Can anybody help? Or explain the error to me?
Thanks in advance!
Xander
PS. It compiles perfectly on both OSX and Ubuntu.
Well, this may not be the right solution for you, just a hint. ImportError: DLL load failed: Invalid access to memory location. I encountered the same error when trying to make my own extension of Python programmed in C. Platform: Windows 32bits.
It was a real pain because this error appeared randomly in interactive as well as in non-interactive mode in all Python environments (Spyder, Notebook, plain console...). I compiled my code using MinGW and Python's distutils (command python setup.py install). The compilation gave no warnings or errors and produced pyd file to the correct directory. But when trying to import this module import example pro my Python code it irregularly crashed (usually only one out of five attempts to import the module succeeded).
Strange was that on another computer it worked just fine... Well, finally I found workaround - I downloaded a newer version of MinGW (before I had used the version that comes packed in Qt SDK distribution) and compiled the module again. Then it worked with no more crashes. However I did not find any systematic solution or explanation. So I might have something to do with the compiler (maybe absence of its DLLs? I do not know exactly) that was used to generate the pyd file.