Which XML library is used for PyBrain? - python

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.

Related

importing h5py for python Python 2.7.3

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.

"R6034 An application has made an attempt to load the C runtime library incorrectly" after pygtk being installed

I'm using python 2.7.9 and encountered a problem when installing pygtk.
It displayed "Runtime error!...R6034 An application has made an attempt to load the C runtime library incorrectly" when installing numpy/scipy after pygtk being installed.
I tried to figure it out by searching it in stackoverflow and found two similar questions: Runtime error R6034 in embedded Python application and An application has made an attempt to load the C runtime library incorrectly.
So following the first one, I deleted the path corresponding to msvcr90.dll, however, it still cannot work. Then I chose to simply delete msvcr90.dll; at this time, this error wasn't presented when installing numpy/scipy, however, these two modules cannot work when simply typing "importing numpy/scipy".
I also renamed gtk-2.0 following the second one. Then numpy and scipy can be successfully installed. But it displayed "Error processing line 3 of C:\Python27\lib\site-packages\pygtk.pth" when installing matplotlib using pip.
I'm really confused about it. Can anybody provide some methods to fix it?
I've installed Python and PyGTK on 5+ machines, at least two of them brand new, clean builds of Win 7.
I've got the An application has made an attempt to load the C runtime library incorrectly error whenever I install a Python package as a windows installer (rather than using pip) on all these machines. It's annoying, but has never made a jot of difference, both Python and Gtk function correctly.
You've deleted msvcr90.dll, and that is why you get your Error processing line 3... If you look at this file, you'll see that line 3 is import runtime, and if you look further into the 'runtime' package, you'll see that this then tries to find the missing dll.
I think your best bet is to try to restore the missing file. If it's still in your recycle bin - great!
If not, the best thing to do is reinstall the Visual C++ runtime library
I made this video to show my way: https://www.youtube.com/watch?v=s6jhR1VBfeU. I use Anaconda to embedded Python in my C++ application. I simply changed "msvcr90.dll" to "msvcr90.dll_hihi" in 3 folders:
C:\Users\your user\Anaconda2\Library\bin, C:\Users\your user\Anaconda2 and C:\Program Files\Intel\iCLS Client (for x64)

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.

Can't install networkx for python 3.4

After 3 days of trying to install networkx for python 3.4, I am on the verge of giving up and I've decided to seek for help from some of you people who had some experience with this perhaps.
I managed to install networkx with easy_install or pip_install (I don't even remember anymore of how many times I've tried to install it all), but when I try to compile the very first, most basic piece of code (found in a tutorial):
import networkx as nx;
Test = nx.Graph();
Test.add_node("Test");
nx.draw(Test, node_size=900, node_color="blue");
I get an error: ImportError: No module named 'numpy'
When I try to install numpy with easy_install numpy it starts the download and installation process normally but then it shows this error:
Microsoft Visual C++ 10 is required
Is this referred to MV C++ 1- redistributable? I've downloaded it and tried to install it but it shouts out an error that I already have a newer version of it so I don't need it...
So my questions would be:
1.Can networkx module be installed for python 3.4 at all?
2.If so, do I need anything else besides networkx zip/installer and python 3.4 for it to work? (I've literally found 4 sources that all claim different requirement information about networkx!)
I would really appreciate any help, as I feel completely lost and discouraged about any further use of python.
You didn't say which operating system you are using but by referencing Microsoft Visual C++ I'm going to say Windows. In that case the simplest way to get a functioning scientific Python computing environment is to install one of the packaged distributions. Two good choices are Anaconda https://store.continuum.io/cshop/anaconda/ and Enthought Canopy https://www.enthought.com/products/canopy/
NetworkX definitely works with Python3.4 https://travis-ci.org/networkx/networkx

How to make downloaded Python libs work on Windows?

I got this simple problem and I can't find the answer anywhere, I'm wasting a lot of time!
I did a Python programm on Linux (which works OK), but when I try to run it on Windows, there are too problems with libs...
I have installed the libs I need (dateutil, lxml, xmlrpclib...) in C:\Python34\Lib\site-packages. But then, they don't work as they do on Linux. For example:
from dateutil.tz import tzlocal
Gives me next error:
File "C:\Python34\lib\site-packages\dateutil\tz.py", line 9, in module
from six import string_types, PY3 ImportError: No module named 'six'
That is, they are not finding the other modules... why???
Have you try this ?
http://www.instructables.com/id/How-to-install-Python-packages-on-Windows-7/
Maybe it can help
It looks like you're using Python 3.4 which comes with pip. pip is a tool for installing packages and any dependencies they might have (like the srting_types module from your error message). I'd suggest learning how to use it because it resolves most of the packaging problems with you needing to moving things around yourself. See an answer from a different question to learn more about pip.
There are some packages that need to be compiled. This can be difficult on Windows 7 if you don't have the proper toolchain set up to compile packages. I'd recommend Christoph Gohlke's wonderful collection of installable packages for Windows. You just need to make sure to grab the right version. Since 3.4 is still relatively new, some packages may not be available, so be warned.

Categories

Resources