importing h5py for python Python 2.7.3 - python

I have ARCGIS 10.2 . When we install this software, python 2.7.3 (on win32) is also installed which we can develop the software by python and by arcpy module. I want to add h5py to it's library. My windows is 64 bit and I downloaded both hy5py 32 and 64 bit and copied them to the Lib folder. When I open IDLE an try to import it, I encounter with the following error:
"ValueError: numpy.dtype has the wrong size, try recompiling".
I also copied six. and I think the problem is with numpy. I replaced the numpy from anaconda(numpy 1.9) with numpy in ARCGIS python Library. Then I could import h5py but I could not open arcpy.
I really appreciate for your help

It sounds like the NumPy that came with your system was built one way, with one version, then you "installed" (by copying) h5py which was built another way, either with a different version or different options for NumPy.
To fix this, you should try building h5py yourself, which you can do by downloading the Source from here: https://pypi.python.org/pypi/h5py/2.5.0
Or perhaps easier, consider using Pandas. It can also read and write hdf5 files (though perhaps with fewer arcane features), and it's quite likely that someone has already provided a package for Pandas which is compatible with your existing installation.

Related

Numpy not installing, also "Can't find a usable init.tcl in the following directories:"

I am trying to start the newcoder.io data vizualization tutorial but am having a difficult time installing numpy on Windows (8.1, python 2.7).
When I go to install it using pip the process never completes, even if I leave it for an hour or more. It doesn't give me any errors or anything either so I don't know how to track down what is causing this.
Here is what is looks like:
(datavizproj)PS C:\Users\Ray\github\new-coder\dataviz> pip install numpy
Collecting numpy
Using cached numpy-1.9.2.tar.gz
Installing collected packages: numpy
Running setup.py install for numpy
Any thoughts on what to do? Should I delete the cached file and have it redownload it? I looked in Python27/lib/site-packages and didn't even see numpy and I thought that is where the file should be kept after pip finds them.
EDIT: I added "Can't find a usable init.tcl in the following
directories:" to the title to help anyone else who has this separate problem find the solution posted below.
Numpy is implemented in C and thus requires a C compiler to install. To circumvent the issue, use a precompiled installer from the Source Forge page here. Then try to import to verify the installation.
import numpy # see whether it's been installed
I was able to track down my issue (thanks Malik Brahimi, you led me on the right track to figure this out)
My issue was that I installed the 64bit version of Python, and pip can't install a 64 bit version of numpy because there is no official source.
My solution was to remove python and reinstall a 32 bit version as I don't actually need 64bit and apparently there is better compatibility for modules using 32bit.
I came to another problem later on, where the init.tcl file could not be found when I was running a program that use matplotlib. Python was searching for the init.tcl in python27/bin/tcl8.5 but the correct directory is python27/tcl/tcl8.5 . To fix this I added 2 system variables: TCL_LIBRARY, with the path C:/Python27/tcl/tcl8.5 and TK_LIBRARY, with the path C:/Python27/tcl/tk8.5
you may want to retry using easy_install?
Otherwise, try deleting any cached items.

Use both h5py and pytables in the same Python process

The two main Python libraries for HDF5 interaction are h5py and pytables. They don't play nicely together, particularly on windows
>>> import tables
>>> import h5py
ImportError: DLL load failed
>>> import h5py
>>> import tables # works fine
I need to use both in the same application but I'm unable to get full functionality from both libraries when each is imported. Is there a solution to this?
According to this thread on github no, I don't think you can. It seems that h5py cannot do anything about it, so I would start an issue with the pytables github.
Also, could you possibly use two different scripts? That way the import wouldn't bork.
Are you using conda to install packages? If yes, it looks like an issue reported on GitHub. That issue to me seems like an issue with build 0 of version 2.4.0 of h5py. Try downgrading to version 2.3.x. That works just fine for me.

Which XML library is used for PyBrain?

I'm using PyBrain in a project over Windows 7 and I've had not problem with this library until I had to write the trained network to a XML file.
I tried this "from pybrain.tools.xml.networkwriter import NetworkWriter" but I got an importation error.
Can anyone tell me if there's a requirement to get this job done?
I tried installing the library called "lxml", because I have it installed on my linux pc, but it doesn't seem to work along side with pybrain.
PyBrain declares in it's setup.py only one required package scipy.
Scipy is a bit complex stuff and it is best installed from binaries (at least on Windows). So if you manage installing scipy, you shall make PyBrain running.

Difficulty getting Python 3.3 and numpy to work

I'm newer to python, but have seem to screwed things up trying out the new python.
I have an older mac which runs python 2.5 as it's default. I've installed python 3.3. However, when I upgraded numpy my python 2.5 now gives me the:
Error importing numpy: you should not try to import numpy from
its source directory; please exit the numpy source tree, and relaunch
your python intepreter from there.
regardless of the directory I run python from. And python 3.3 can't find the numpy module. Did I miss something? How can I get 2.5 running numpy again and get python 3.3 to find the module?
I also can't get virtualenv to work as it gives me the error that the script needs python2.6, even after I installed virtualenv-2.5 and can't get the python=python3.3 to do anything either. I seem to have tried everything I can find. I'm afraid I've installed too much and have some hidden conflict.
Thanks
download numpy from this site : http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy
In case you want to check the version of numpy on your system , write this following code on your IDE :
import numpy
numpy.version.version
Hope this would help !

Can Python 2.5 and 2.7 coexist along with wxPython, py2exe and comtypes (try to resolve MSVCP90.dll problem)?

I was writing a code which uses wxPython and comtypes. I have python 2.7 installed on my machine (Windows) along with wxPython, comtypes and py2exe. while trying to build it I got the following error:
error: MSVCP90.dll: No such file or directory
So, I did research I came to know about two solutions:
1. Copy Microsoft.VC90.CRT.manifest and msvcp90.dll to your machine and prepare your setup like as follows:
from distutils.core import setup
import py2exe
from glob import glob
data_files=[("Microsoft.VC90.CRT", glob(r'c:\shared_dlls*.*'))]
setup(data_files=data_files, console=['main.pyw'])
2. Use Python 2.5 along with wxPython, comtypes and py2exe
Now, I have following questions:
In first case:
a. Do I need to have Visual Studio license in order to use these files? or that can be used without any worries.
b. What if I compile it using aforementioned method? Does it still require MSVC90.dll on the user machine to execute? I think - No. Please correct me if I'm wrong. I want to remove any dependency and give user an exe which the user can directly execute without any dependency.
In Second case:
As I have Python_2.7 installed on my machine along with aforementioned modules. I would like to know can I install Python 2.5 on the same machine? Can they co-exist? If yes, do I need to install another copy of wxPython, comtypes and py2exe for this.
Please suggest me what is the best solution. How should I proceed? It's kind of blocking me.
Thanks in advance!
Python 2.5 and 2.7 (and all other versions of Python) co-exist very well. You may need to change your path to use the correct version of Python.
You will need to install the Python 2.5 builds of wxPython and py2exe. You will also need to install comtypes for Python 2.5. That installer will detect your Python installations by checking the registry.
I simply downloaded MSVCP90.dll file from here: http://www.dllme.com/dll/files/msvcp90_dll.html
and then pasted it into Python27\DLLs. It worked after that.
Did you try to install Visual C++ redistribuables?
I think you don't need a VS license for this.

Categories

Resources