HDF5 ImportError with PyTables for Windows - python

I have installed the HDF5.dll and HDF5dll.dll in every directory I can think of--PYTHONPATH, USERPROFILE, within the PyTables site-packages folder--and I still return the following error:
ImportError: Could not load any of ['hdf5.dll', 'hdf5dll.dll'], please ensure that it can be found in the system path
Both of these are definitely within the system path and I still can't test PyTables without this message. Does anyone know how to solve this? Thank you!

I have the same error in Python 3.6.0 (x64) under Windows 10. Anecdotally, based on Google searches, there are reports that tables is broken for Python 3 since June 2017, and apparently not fixed yet.
However, I can import tables in Python 2.7.13 (x64) under Windows 10. So see if you can run your script under Python 2.7.

I installed PyTables 3.5.2 from PyPI and got
"Fail: ImportError: HDFStore requires PyTables, "Could not load any of ['hdf5.dll', 'hdf5dll.dll'], please ensure that it can be found in the system path"
when trying to pandas.read_hdf(). Then I followed a link on https://www.pytables.org/usersguide/installation.html to Christoph Gohlkes page https://www.lfd.uci.edu/~gohlke/pythonlibs/ and downloaded tables‑3.5.2‑cp37‑cp37m‑win_amd64.whl from there. After a pip uninstall/install everything is working fine now. I still don't have a hdf5*.dll in my path ...

I had no luck with the documentation and every single post I went thru. I kept getting:
LINK : fatal error LNK1181: cannot open input file 'hdf5.lib'
* Using Python 3.9.0 (tags/v3.9.0:9cf6752, Oct 5 2020, 15:34:40) [MSC v.1927 64 bit (AMD64)]
* USE_PKGCONFIG: False
* Found HDF5 using system PATH ('C:\Users\<user>\AppData\Roaming\Python\Python39\site-packages\h5py')
.. ERROR:: Could not find a local HDF5 installation.
This did the trick, though:
Copy hdf5.dll to
C:\Users<user>\AppData\Roaming\Python\Python39\site-packages\tables
Latest dll can be found here: https://pypi.org/project/h5py/#files:
pip install -U C:\downloads\h5py-3.1.0-cp39-cp39-win_amd64.whl
I did add h5py to my Windows Path at some stage.
Ex: C:\Users<user>\AppData\Roaming\Python\Python39\site-packages\h5py
But I can't confirm the impact of that.

Related

Unable to install library due to error with hdf5

I tried installing python library tables through: pip install tables
This results in an error
Collecting tables Using cached https://files.pythonhosted.org/packages/4d/53/8f34ce887c2a2ad80518980419a5f6f41defc85a287a355987e559ce9385/tables-3.4.4.tar.gz
Complete output from command python setup.py egg_info:
H5closeplbq5iz8.c
C:\Users\tkim1\AppData\Local\Temp\H5closeplbq5iz8.c(2): warning C4013: 'H5close' undefined; assuming extern returning int
LINK : fatal error LNK1181: cannot open input file 'hdf5.lib'
* Using Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)]
* USE_PKGCONFIG: False
.. ERROR:: Could not find a local HDF5 installation.
You may need to explicitly state where your local HDF5 headers and
library can be found by setting the ``HDF5_DIR`` environment
variable or by using the ``--hdf5`` command-line option.
This issue with HDF5 not being found seems to be a common one: https://github.com/PyTables/PyTables/issues/219, https://github.com/PyTables/PyTables/issues/385. But as a newcomer to coding, I am having a hard time following the discussion.
One of the most baffling thing I have encountered in trying to fix this is many of the terminal codes that are being discussed is just not taken by my terminal.
sudo python setup.py build_ext --inplace --hdf5=/opt/local --lzo=/opt/local --bzip2==opt/local
output: 'sudo' is not recognized as an internal or external command,operable program or batch file.
env HDF5_DIR=$PWD pip install tables
output:'env' is not recognized as an internal or external command,operable program or batch file.
Any help in regard to fixing this installation issue or regarding how I can apply these different terminal commands will be super appreciated. Thanks everyone.
I found a solution works on Windows 10 with Visual Studio 2019 Community and Python 3.9.1.
Download HDF5 and install.
Set two environment variables, change the version if necessary.
HDF5_DIR=C:\Program Files\HDF_Group\HDF5\1.12.0
LIB=C:\Program Files\HDF_Group\HDF5\1.12.0\lib
The HDF5_DIR is not equale to the HDF5's README, it tells you to set it to C:\Program Files\HDF_Group\HDF5\1.12.0\cmake to working with Cmake, but it is not compatiable with pyTables setup.py.
LIB environment variable tells the link.exe where to find hdf5.lib, if this variable is not set, it shows a link error complain it can't find hdf5.lib on my system.
After the two environment variables set, I can install pyTables via pip install tables.
You can verify these settings in powershell by $env:HDF5_DIR and $env:LIB.
As hinted in this duplicate question, if using conda is an option, conda install pytables will most likely fix the issue in a Windows environment (tested on Windows 10, python 3.9, tables 3.6.1)

Python-camelot (Error: GhostscriptNotFound while it is installed)

I am trying to extract tabular data from pdf using camelot and I am getting the following error.
Code:
tables = camelot.read_pdf(file_name)
Error:
GhostscriptNotFound: Please make sure that Ghostscript is installed and available on the PATH environment variable
I have already installed Ghostscript and I have it available on the PATH environment variable.
Please find below version details:
Windows-10-10.0.17134-SP0
Python 3.6.5 |Anaconda, Inc.| (default, Mar 29 2018, 13:32:41) [MSC v.1900 64 bit (AMD64)]
NumPy 1.14.3
openCV 3.4.3
Camelot 0.3.2
Please help resolve this issue.
Adding both the "bin" and "lib" paths for Ghostscript to the PATH worked for me:
C:\Program Files\gs\gs9.26\bin
C:\Program Files\gs\gs9.26\lib
I unistalled the 64bit and
Install the 32bit version
Add the following two paths on Windows Environment Variables:
C:\Program Files(x86)\gs\gs9.26\bin
C:\Program Files(x86)\gs\gs9.26\lib
and now it works
Download Ghostscript from here https://www.ghostscript.com/download/gsdnld.html and add it to the path if required
For me using brew link -f --overwrite ghostscript solved the issue.
I would recommend checking the suggested solutions on https://github.com/atlanhq/camelot/issues/282. That's where I also found my fix.
Tried all the solutions. The only option that works is to use 32 bit ghostscript.
I had the same problem. I solved it by uninstalling the 64 bit version and installing the 32 bit version.
I realized that. If you are using the Python 64bit you need install ghostcript64 bit, else 32 bit.
Also set path for 64bit:
C:\Program Files\gs\gs9.26\bin
C:\Program Files\gs\gs9.26\lib
or for below for 32bit
C:\Program Files(x86)\gs\gs9.26\bin
C:\Program Files(x86)\gs\gs9.26\lib
Here is my solution (Windows OS (11, 64 BIT)):
Download and install the desired ghost version you wish (32,64 - does not matter)
Using "dir /x" command, get the short version of the path of your installation (c:\progra~1\blahbla...). My location (I love altering the default suggestion) is "C:\Program Files\gs\GPLGhostScript" and the short name is "c:\progra~1\gs\GPLGhostScript"
Add this to the path together with \bin. In my case "c:\progra~1\gs\GPLGhostScript\bin" (no need for lib path as suggested by others)
Restart your PC
Test your installation of GhostScript according to this link.
Good luck :)
This worked for me:
C:\Program Files\gs\gs9.55.0\bin
Just find the path location, copy it, and paste it into user and system variables Path (Environment variables).
I solved this problem.
I downloaded Ghostscript.
Then installed it at C:/programfiles.
Added set path: C:\Program Files\gs\gs9.26\bin + C:\Program Files\gs\gs9.26\lib
Restarted my computer.
After these steps, it worked.
A very simple way is to install Ghostscript from the official website.
Then give the location while set-up the library in the Anaconda script folder. Wait for 10 minutes after closing the Python platforms.
I was facing same issue for 2 days. I found solution at below link.
for windows 10, I used below method
in "search the web and windows" write "under edit environment variable for your account in control panel."
edit path for lib and bin library of Ghostscript here. add ; to separate the path at end also.
set path in environment variable
For more info used below link. It worked fine for me.
https://github.com/atlanhq/camelot/issues/465#issuecomment-975976344
For me, uninstalling camelot and re-installing with
conda install -c conda-forge camelot-py instead of pip solved the problem (as ghostscript is also re-installed)
In case you are fed up with all the errors derived from the usage of Ghostscript and want to find a way to use Camelot without using Ghostscript, here is the fork of it which does not rely on it.
Camelot fork without Ghostscript
Installation guide is similar, but this time from the github repo itself.
First, install these dependencies:
!pip install pdf2image
!pip install python-dateutil
!apt-get install poppler-utils
Then clone the repo
$ git clone https://www.github.com/h2oai/camelot
Finally, go to the repo directory and install camelot from there.
$ cd camelot
$ pip install ".[base]"
Import camelot and happily use it :)
This is how I solved for this error on a Windows computer, similar to what Alexander Garzo posted:
Went to File Explorer -> C drive -> Program Files -> gs -> gs9.55.0 -> shift-clicked on bin folder -> copied as path ("C:\Program Files\gs\gs9.55.0\bin")
Then went to environmental variables -> Path -> Edit -> New -> pasted above -> OK -> restarted computer.
I then ran the following code in Python:
import ctypes
from ctypes.util import find_library
find_library("".join(("gsdll", str(ctypes.sizeof(ctypes.c_voidp) * 8), ".dll")))
The output was "C:\Program Files\gs\gs9.55.0\bin\gsdll64.dll" which means the solution worked. I was then able to install and use Camelot with no problems.
I was getting this Error (OSError: Ghostscript is not installed. You can install it using the instructions here: https://camelot-py.readthedocs.io/en/master/user/install-deps.html)
I tried everything mentioned here and also in Github.
but after installing Ghostscript from here and then adding to the PATH.
I keep trying methods to solve it.
BUT the solution is to just Restart your computer and everything Works.
so Restart is Must.

Installing the Python cx_Oracle module in Windows and connecting to an Oracle database

I've been trying to get this installed and setup, and despite there been several links describing how to do this, I'm just not getting this to work. I'll describe first the setup:
My PC: Windows 8.1 Enterprise (62 Bit)
Remote Server: Oracle DB Version 12.1.0.2
C:\Users\Pymat\Oracle\instantclient_12_1
Here is where oraocci12.dll is located, as well as other folders and files
C:\Users\Pymat\AppData\Local\Continuum\Anaconda3
Here is where the python.exe is located (i.e. os.path.dirname(sys.executable))
In a script, I have print (sys.version) which gives:
3.6.0 |Anaconda 4.3.0 (64-bit)| (default, Dec 23 2016, 11:57:41) [MSC v.1900 64 bit (AMD64)]
I have been referring to instructions from here and here and here and here and here.
Question 1: Which is the correct download for cx_Oracle?
I went to cx_Oracle 5.2.1 from here
and downloaded:
cx_Oracle-5.2.1-12c.win-amd64-py3.5.exe (md5)
cx_Oracle-5.2.1-12c.win32-py3.5.exe (md5)
It's not clear which of these is the correct .exe to download (or maybe both is correct). In any case, I use 12c to keep the versions consistent with the Oracle DB Version, although through this entire process there is no interaction with the Oracle DB on the remote server in any case, it seems.
Question 2: Is cx_Oracle correctly downloaded or actually missing?
Under the following path:
C:\Users\Pymat\AppData\Local\Continuum\Anaconda3\Lib\site-packages
I find:
cx_Oracle.cp35-win_amd64.pyd
cx_Oracle.cp35-win32.pyd
However I don't find under this directory (or any other) the cx_Oracle, like for example Verion-5.1.2-11g.win32-py2.7, as per here. I suspect there is an issue with locating the cx_Oracle module. See also Question 5
Question 3: Are my environment variables configured correctly?
(i) When I use the GUI in Windows to check the variables like here I see:
ORACLE_HOME
C:\Users\Pymat\Oracle\instantclient_12_1;
C:\Users\Pymat\Oracle\instantclient_12_1\vc12
PATH
C:\Users\Pymat\AppData\Local\Continuum\Anaconda3;
C:\Users\Pymat\AppData\Local\Continuum\Anaconda3\Scripts;
C:\Users\Pymat\AppData\Local\Continuum\Anaconda3\Library\bin;
C:\Users\Pymat\Oracle\instantclient_12_1;
NB: The semi-colon is missing at the end of ORACLE_HOME. Is that correct?
(ii) When I use C:\Users\Pymat>echo %PATH% in Command:
C:\ProgramData\Oracle\Java\javapath;
C:\WINDOWS\system32;
C:\WINDOWS;
C:\WINDOWS\System32\Wbem;
C:\WINDOWS\System32\WindowsPowerShell\v1.0\;
C:\Users\Pymat\.dnx\bin;
C:\Program Files\Microsoft DNX\Dnvm\;
C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;
C:\Users\Pymat\AppData\Local\Continuum\Anaconda3;
C:\Users\Pymat\AppData\Local\Continuum\Anaconda3\Scripts;
C:\Users\Pymat\AppData\Local\Continuum\Anaconda3\Library\bin;
C:\Users\Pymat\Oracle\instantclient_12_1;
(iii) When I go into the Python shell and use sys.path:
'C:\\Users\\Pymat\\AppData\\Local\\Continuum\\Anaconda3\\python36.zip',
'C:\\Users\\Pymat\\AppData\\Local\\Continuum\\Anaconda3\\DLLs',
'C:\\Users\\Pymat\\AppData\\Local\\Continuum\\Anaconda3\\lib',
'C:\\Users\\Pymat\\AppData\\Local\\Continuum\\Anaconda3',
'C:\\Users\\Pymat\\AppData\\Local\\Continuum\\Anaconda3\\lib\\site-packages',
'C:\\Users\\Pymat\\AppData\\Local\\Continuum\\Anaconda3\\lib\\site-packages\\Sphinx-1.5.1-py3.6.egg',
'C:\\Users\\Pymat\\AppData\\Local\\Continuum\\Anaconda3\\lib\\site-packages\\win32',
'C:\\Users\\Pymat\\AppData\\Local\\Continuum\\Anaconda3\\lib\\site-packages\\win32\\lib',
'C:\\Users\\Pymat\\AppData\\Local\\Continuum\\Anaconda3\\lib\\site-packages\\Pythonwin',
'C:\\Users\\Pymat\\AppData\\Local\\Continuum\\Anaconda3\\lib\\site-packages\\setuptools-27.2.0-py3.6.egg'
Question 4: Instant Client Downloads, which downloads are actually essential?
After registering on Oracle, I download from here under Version 12.1.0.2 the "Instant Client Package - Basic" and "Instant Client Package - SDK". Some sites don't mention the SDK package, but I downloaded it anyway.
These are downloaded to my PC (not where the Oracle DB resides).
Question 5: In order to test for a successful installation, I go into the Python shell and use:
import os
os.chdir("C:\\Users\\Pymat\\Oracle\\instantclient_12_1")
import cx_Oracle
But then I get:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'cx_Oracle'
Why is this step not working?
Question 6: I cannot use Console correctly in Eclipse, but the Python shell in Command works, why?
When I click on "PyDev Console", then "Python Console", I then get:
'Create Interactive Console' has encountered a problem
Error initializing console
This is becoming a bit of a headache, and although I'm still a Python novice, I think this installation process could be a lot easier. Any advice welcome.
Long story short: Downgrade to Python 3.5 for now, binaries for Python 3.6 will be built with the next cx_Oracle release.
Long version:
In a script, I have print (sys.version) which gives: 3.6.0 [...]
I find:
cx_Oracle-5.2.1-12c.win-amd64-py3.5.exe (md5)
cx_Oracle-5.2.1-12c.win32-py3.5.exe (md5)
These installers are for Python 3.5 (see py3.5 in their name). Binary Python modules aren't necessarily API-compatible between major Python releases, that's why their filenames are version-specific.
There are no official cx_Oracle binaries for Windows for Python 3.6 yet. Once cx_Oracle 5.3 is released, it will include Windows installers for Python 3.6 as well (issue #45).
There won't be official Python 3.6 installers for current cx_Oracle version 5.2.1 (see issue #50).
Meanwhile, according to Jani Tiainen from the mailing lists, it shouldn't be difficult to build the binaries yourself -- but I've never tried this myself:
I think you only need to download Visual C++ 14 (2015) from Microsoft
[1] and Instant Client libs from Oracle [2]. Then you should be able to
compile it yourself.
Note that you need also SDK libs as well for Instant Client.
[1] http://landinghub.visualstudio.com/visual-cpp-build-tools
[2] http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html
Thank you, I beleive on my way now. I installed Visuakl C++, and downgrading the Python version helped somewhat, but there were some further issues.
Using pip install cx_Oracle initially gave:
Requirement already satisfied: cx_Oracle in c:\users\Pymat\appdata\local\programs\python\python35\lib\site-packages
however after using the following in my script, the problem went away:
os.chdir("C:\\Oracle\\instantclient_12_1")
import cx_Oracle
The only minor issue was the import was underlined in red, despite it now working.
I use in my script:
print ("Python version: " + platform.python_version())
print ("cx_Oracle version: " + cx_Oracle.version)
print ("Oracle client: " + str(cx_Oracle.clientversion()).replace(', ','.'))
print ("Oracle DB version: " + connection.version)
print ("Oracle client encoding: " + connection.encoding)
Resulting in:
Python version: 3.5.3
cx_Oracle version: 5.2.1
Oracle client: (12.1.0.2.0)
Oracle DB version: 12.1.0.2.0
Oracle client encoding: US-ASCII
Further points, I deinstalled anaconda in the end. I may need some of the libraries in Anaconda, so not sure if reinstalling and using the Python there may help, at a future point. For now, it works without it.

Installing OpenCV - DLL load failed: %1 is not a valid Win32 application [duplicate]

I have a situation very much like the one at Error "ImportError: DLL load failed: %1 is not a valid Win32 application", but the answer there isn't working for me.
My Python code says:
import cv2
But that line throws the error shown in the title of this question.
I have OpenCV installed in C:\lib\opencv on this 64-bit machine. I'm using 64-bit Python.
My PYTHONPATH variable: PYTHONPATH=C:\lib\opencv\build\python\2.7. This folder contains cv2.pyd and that's all.
My PATH variable: Path=%OPENCV_DIR%\bin;... This folder contains 39 DLL files such as opencv_core246d.dll.
OPENCV_DIR has this value: OPENCV_DIR=C:\lib\opencv\build\x64\vc11.
The solution at Error "ImportError: DLL load failed: %1 is not a valid Win32 application" says to add "the new opencv binaries path (C:\opencv\build\bin\Release) to the Windows PATH environment variable". But as shown above, I already have the OpenCV binaries folder (C:\lib\opencv\build\x64\vc11\bin) in my PATH. And my OpenCV installation doesn't have any Release folders (except for an empty one under build/java).
What's going wrong? Can I tell Python to verbosely trace the loading process? Exactly what DLL files is it looking for?
I noticed that, according to http://www.dependencywalker.com/, the cv2.pyd in C:\lib\opencv\build\python\2.7 is 32-bit, whereas the machine and the Python I'm running are 64-bit. Could that be the problem? And if so, where can I find a 64-bit version of cv2.pyd?
Unofficial Windows Binaries for Python Extension Packages
You can find any Python libraries from here.
Please check if the Python version you are using is also 64 bit. If not then that could be the issue. You would be using a 32-bit Python version and would have installed a 64 bit binaries for the OpenCV library.
Wow, I found yet another case for this problem. None of the above worked. Eventually I used python's ability to introspect what was being loaded. For Python 2.7, this means:
import imp
imp.find_module("cv2")
This turned up a completely unexpected "cv2.pyd" file in an Anaconda DLL directory that wasn't touched by multiple uninstall/install attempts. Python was looking there first and not finding my good installation. I deleted that cv2.pyd file and tried imp.find_module("cv2") again and python immediately found the right file and cv2 started working.
So if none of the other solutions work for you, make sure you use Python introspection to see what file Python is trying to load.
In my case, I have 64-bit Python, and it was lxml that was the wrong version--I should have been using the x64 version of that as well. I solved this by downloading the 64-bit version of lxml here:
https://pypi.python.org/pypi/lxml/3.4.1
lxml-3.4.1.win-amd64-py2.7.exe
This was the simplest answer to a frustrating issue.
I just had this problem. It turns out it was just because I was using an 64-bit version of the OpenCV file. I tried the x86 and it worked.
I had the same problem. Here's what I did:
I downloaded the pywin32 wheel file from here, then
I uninstalled the pywin32 module. To uninstall, execute the following command in a command prompt.
pip uninstall pywin32
Then, I reinstalled pywin32. To install it, open the command prompt in the same directory where the pywin32 wheel file lies. Then execute the following command.
pip install <Name of the wheel file with extension>
Wheel file will be like: piwin32-XXX-cpXX-none-win32.whl
It solves the problem for me.
I copied cv2.pyd file from /opencv/build/python/2.7/x86 folder instead of from /x64 folder to C:/Python27/Lib/site-packeges. I followed rest of the instructions provided here.
Added by someone else, not verified: I also copy file cv2.pyd to folder C:/Python27/Lib/site-packages/cv2. It works.
For me the problem was that I was using different versions of Python in the same Eclipse project. My setup was not consistent with the Project Properties and the Run Configuration Python versions.
In menu Project → Properties → PyDev, I had the Interpreter set to Python 2.7.11.
In Run Configurations → Interpreter, I was using the Default Interpreter. Changing it to Python 2.7.11 fixed the problem.
If your build system (CMake in my case) copies the file from <name>.dll to <name>.pyd, you will get this error if the original file wasn't actually a DLL file. In my case, building shared libraries got switched off, so the underlying file was actually a *.lib.
I discovered this error by loading the pyd file in Dependency Walker and finding that it wasn't valid.
Update NumPy.
pip install numpy --upgrade
It works for me!
This one worked for me:
pip install -- pywin32==227
I faced the same issue when I uninstalled and reinstalled a different version of 2.7.x of Python on my system using a 32-bit Windows Installer. I got the same error on most of my import statements.
I uninstalled the newly installed Python, downloaded a 64-bit Windows installer, reinstalled Python again, and it worked.
So I had problems installing vtk under Windows (as I use Python 3.7, there isn't any binary available so far. Just for older Python versions pip install vtk is not working)
I did wrote Python in my cmd:
Python 3.7.3 on win32
So I now know I have Python 3.7.3 running on a 32 bit.
I then downloaded the correct wheel at VTK‑8.2.0‑cp37‑cp37m‑win32.whl
Next I installed that wheel:
pip install VTK-8.2.0-cp37-cp37m-win32.whl
Then I tested it and it worked:
python
import vtk
I experienced the same problem while trying to write code concerning speech-to-text.
The solution was very simple. Uninstall the previous pywin32 using the pip method:
pip uninstall pywin32
The above will remove the existing one which is by default for 32 bit computers. And install it again using
pip install pywin32
This will install the one for the 64 bit computer which you are using.
I had a similar issue while trying to run uvicorn,
Creating a new virtual environment and reinstalling the python packages worked
You can install opencv from official or unofficial sites.
Refer to this question and this issue if you are using Anaconda.
It has a very simple solution.
After installing opencv
place
cv2.pyd from C:\opencv\build\python\2.7\ **x64** to C:\Python27\Lib\site-packages
instead of, place cv2.pyd from C:\opencv\build\python\2.7\ **x86** to C:\Python27\Lib\site-packages
I got this error when trying to import MySQLdb.
What worked for me was to uninstall Python and then reinstall it.
I got the error after installing npm (https://www.npmjs.com/get-npm). One thing it did was install Python even though I already had it.
First I copied cv2.pyd from /opencv/build/python/2.7/x86 to C:/Python27/Lib/site-packeges. The error was
"RuntimeError: module compiled against API version 9 but this version of numpy is 7"
Then I installed numpy-1.8.0-win32-superpack-python2.7.exe and OpenCV works fine.
>>> import cv2
>>> print cv2.__version__
2.4.13
Please make sure that you have installed a Python 2.7.12 or below version. Otherwise you will definitely get this error.
Make sure the Oracle client is 64 bit installed if the OS is 64 bit.
Make sure the Microsoft Visual C++ compiler for Python 2.7 is 64 for bit for a 64 bit OS or 32 bit for 32 bit.
Note: If your OS is 64 bit, install all packages of 64 bit or if the OS is 32 bit, install the 32-bit package.
This has worked for me. I have tried different methods, but this was my best solution.
Open a command prompt and type the following;
pip install opencv-python
(Make sure your Internet connection is on.)
After that, try importing it again.
It could also be that your Anaconda version is 32 bit when it should be 64 bit.
If you are using pycharm I go to settings -> python interpretation and click the + button and search for the name on the list of python packages there
An image showing where to go when you want to install something
I found the solution. Maybe you can try to use the cmd window rather than the Anaconda prompt window to start your first Scrapy test.

Installing Mapnik 2.2.0 in windows 7 with Python 2.7

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.

Categories