configuring theano in windows ? ' where to put the .theanorc.txt - python

I've followed this installation tutorial :
http://deeplearning.net/software/theano/install_windows.html#install-windows
As described in the tutorial, I've put the .theanorc.txt file in :
c:\scisoft\WinPython-64bit-2.7.9.4\settings
I was able to run the test program from the shell created by env.bat and to see the it uses the GPU.
Now I want to develop from pycharm not the "cmd", but there is get:
WARNING (theano.configdefaults): g++ not detected !
Theano will be unable to execute optimized C-implementations
(for both CPU and GPU) and will default to Python implementations.
Performance will be severely degraded.
To remove this warning, set Theano flags cxx to an empty string.
I assume because he can't find the .theanorc.txt
So I found this tutorial:
http://deeplearning.net/software/theano/library/config.html
He says to put the file in $HOME, but i don't have such environment variable.
I've tried to add it, but it didn't helped.
Any ideas ? I red tens of questions regarding it in stack overflow, but couldn't find an answer to this

I did this myself just recently... nearly the exact situation!
If you running an external IDE (i.e., not WinPython/Spyder), you need to put .theanorc in your Windows Users folder.
For example: C:\Users[Your Name]\
Note, I also recommend using the filename .theanorc not .theanorc.txt. I read that either works, but I seem to recall only one of them working for me.

Related

Config variable 'Py_DEBUG' is unset

I tried installing matplotlib whl file in python 3.6 on windows but I all I got was this error:
C:\Python36\lib\site-packages\wheel\pep425tags.py:77: RuntimeWarning: Config variable 'Py_DEBUG' is unset, Python ABI tag may be incorrect warn=(impl == 'cp')):
I tried debugging it but it seems to be a real issue here:
https://github.com/pypa/pip/issues/3383
Could someone please let me know how do I solve this error?
Any help would be appreciated.
Thanks.
Although this answer is irrelevant (and outdated) to the original question, people come here after Googling for this very error.
At the end of the day, it usually turn out to be some kind of package compilation error when using pip install . and build related installs. Most likely because the build config was made primarily for a unix OS and not windows. Who knows. So try to use a different compiler or make sure you have installed all the required compiler components. I.e. for Windows that is a >7 GB of Visual Studio C/C++ development/tools install. You may also try the 1 GB MinGW install.
However, the following official documentation clearly state the use for Py_DEBUG.
Compiling the interpreter with the Py_DEBUG macro defined produces what is generally meant by a debug build of Python. Py_DEBUG is enabled in the Unix build by adding --with-pydebug to the ./configure command. It is also implied by the presence of the not-Python-specific _DEBUG macro. When Py_DEBUG is enabled in the Unix build, compiler optimization is disabled.
Further info can be found here:
https://docs.python.org/3/using/configure.html#debug-build

Saving figures with matplotlib on NFS filesystem

I am using ipython notebook through Anaconda on RHEL 6.7. The machine is set up with an NFS storage; that is, df -P -T /home/USERNAME | tail -n +2 | awk '{print $2}' prints 'nfs'.
So I want to save matplotlib figures created in ipython notebooks. Calling the savefig function, however, gives me this error (I have suppressed most of it):
RuntimeError: dvipng was not able to process the following file:
/home/USERNAME/.cache/matplotlib/tex.cache/3007d273a0b2642aa3abce6d3d640283.dvi
Here is the full report generated by dvipng:
No dvipng error report available.
My suspicion is that this has to do with NFS (since it has given me other problems in the past) but otherwise I don't really know where to go from here. Any help greatly appreciated, and please let me know if I can provide more information.
The same problem occurs here in an up-to-date OpenSuse Leap VM with an also up-to-date stack of Anaconda. To my dismay it is not deterministic: batch generating plots fails at very different datasets. It helped to insert a
time.sleep(5)
and now the problem occurs much less frequently. Still a PITA though.
This may not strictly be a problem of NFS.
Looking at its source in this line and this line (note that here is an error: It should have said "dvips failed", not "dvipng"), it seems that the external command with dvipng or dvips failed.
So there are many possibilities. First you need to figure out which external program was being system()ed. Then, maybe you need to check whether this command could be found in PATH environment variable at all, or whether the file itself is crashing that command. Try running dvip(ng|s) manually on that file and see if you can get an error report.
BTW, from the linked source, if I read the source correctly (IIRTSC), I don't think the matplotlib library is doing the right thing to catch an error report by capturing the stdout of dvip(ng|s) command. And we know os.system() is evil ...
Without properly maintained LateX packages, matplotlib (at least running through a Jupyter notebook) apparently is unable to save LateX-formatted plots, even if they display correctly.

PyUnicodeUCS2_* error while importing VTK

I've run into a strange problem.
I built VTK with python wrappings on cent os 6.5.
On importing vtk it gives me PyUnicodeUCS2_* error. I checked python used for the build for unicode setting with sys.maxunicode. It is UCS4. I searched for this error and found that the error occurs when the VTK is built using UCS2 python. But, This is not the case in my case. What could be the reason for error?
The python that I'm using is picked from some other machine . If I run maxunicode on original previous machine it shows USC2. The same python (I copied the whole folder python2.6) on the other machine where I'm building VTK, shows maxunicode as UCS4. I think this has something to do with the problem.
Please help.
This error is caused by using an extension built by a UCS2-based Python interpreter with a UCS4-based interpreter (or vice-versus).
If you built it using the same Python interpreter then something is confusing in your build environment.
I tried to compile VTK with my python build several times. Checked the various paths in CMAKE to avoid conflict with system python. Still couldn't get rid of the error. Finally, I built the python with --enable-unicoe=ucs2. That solved the problem. Thanks for the help though.

Installing Boost Python on Windows 8.1, Setting up the toolchain correctly

I am trying to install Boost Python, however http://www.boost.org/doc/libs/1_55_0/libs/python/doc/tutorial/doc/html/python/hello.html is too compressed for me. I am switchig to Windows from Linux, setting up all the technical stuff drives me crazy :)
So when I follow the instructions http://www.boost.org/doc/libs/1_55_0/more/getting_started/windows.html#prepare-to-use-a-boost-library-binary and try to execute bootstrap.bat it complains about a missing VCVARS32.BAT and it does not recognice the "cl" command - I have however both MS VS Express 2012 and 2013 installed, both boost versions (32, 64) are installed in C:/local/, documentations says that both should work. So why does it not find the compiler?
Update: So http://msdn.microsoft.com/en-us/library/9s7c9wdw%28v=vs.110%29.aspx says that you cannot use the compiler from the command line... how do I build my bjam then? This must be something totally trivial and stupid... :/
Update: Okay, one step further. vcvars32.bat actually sets all environment variables to go, so i can invoke the command line compiler now! Also there are actually prebuild binaries of bjam from the official boost site http://sourceforge.net/projects/boost/files/, I got it and copied it to by boost_xxx/tools folder and added the site to the path, so i can invoke bjam from command line as well.
Next I put a user-config.jam in my home folder, it only says:
# MSVC configuration
using msvc : 11.0 ;
# Python configuration
using python : : C:/Users/me/Anaconda ;
In the Jamroot file provided with C:\local\boost_1_55_0\libs\python\example\tutorial, I only edited
use-project boost
: C:/local/boost_1_55_0 ;
then I call bjam from the very same directory which gives my some cryptic output
C:\local\boost_1_55_0\libs\python\example\tutorial>bjam
warning: mismatched versions of Boost.Build engine and core
warning: Boost.Build engine (bjam) is 03.1.18
warning: Boost.Build core (at C:/local/boost_1_55_0/tools/build/v2) is 2011.12-s
vn
link.jam: No such file or directory
C:/local/boost_1_55_0/tools/build/v2/util\path.jam:458: in path.makedirs
rule MAKEDIR unknown in module path.
C:/local/boost_1_55_0/tools/build/v2/build\configure.jam:233: in configure.set-l
og-file
C:/local/boost_1_55_0/tools/build/v2\build-system.jam:695: in load
C:\local\boost_1_55_0\libs\python\example\..\..\..\tools\build\v2/kernel\modules
.jam:289: in import
C:\local\boost_1_55_0\libs\python\example\..\..\..\tools\build\v2\kernel\bootstr
ap.jam:139: in boost-build
C:\local\boost_1_55_0\libs\python\example\boost-build.jam:7: in module scope
C:\local\boost_1_55_0\libs\python\example\tutorial>
Now, can you give me any hints as to what went wrong and where to go from here? I really want a stable, robust working copy of boost.python - it doesn't make sense to me if I need to hack something together. I thought it was quite standard/reliable, isn't there something like "boost.python for guys who did not study computer science"? Can I ignore the warnings?
Perhaps you can use the binary from http://www.lfd.uci.edu/~gohlke/pythonlibs/#boost.python
Regarding your compiler problems: there is a bunch of questions on this on SO already. Basically, the compiler you need depends on your version of python. You will probably need to install some Windows SDK and setup some stuff manually. It has always been a pain in the ass for me and in the end you might be better of with using some python distribution like Canopy (there are a few others out there).

LD_LIBRARY_PATH precendence and trouble with compiling

I am trying to install some software on a Linux machine (python's rpy2 package, rpy2.robjects in particular, if it matters). I need the software to look for its shared libraries in my local space, not in the global spaces like /usr/lib64 whatever. I do not have admin privileges on this machine. My problem is that even though I set LD_LIBRARY_PATH to point to my local space, the software still goes to the /usr/lib64/whatever, where it finds libraries that are out of date. These libraries are missing some objects it needs, so it fails. What could be taking precedence over LD_LIBRARY_PATH, and is there a way to change/get rid of it? Thanks.
BTW, someone on this site had a similar question a year or more ago, but his answer involved the env variable RPATH, and changing it with the chrpath utility. It is not clear to me at all that rpy2 is using RPATH, and chrpath seems unavailable on my system.
Addendum: I tried running with LD_DEBUG=libs. Got alot of output that looks like the system is looking for the libs in my LD_LIBRARY_PATH and finding them. Here is where the trouble seems to start:
/usr/local/lib64/R/library/methods/libs/methods.so: error: symbol lookup error:
undefined symbol: Rf_allocS4Object (fatal)
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/usr/local/lib64/R/library/methods/libs/methods.so':
/usr/local/lib64/R/library/methods/libs/methods.so: undefined symbol: Rf_allocS4Object
So my guess is that the trouble is that whatever is in DLLpath is overriding LD_LIBRARY_PATH. I have tried to change this by prepending my directories to os.environ['PATH'], but no do. There is apparently no "DLLPATH", as I thought there would be.
OK, that's progress, I guess. Anybody have anything else? Thanks.
Have a look at a file named $R_HOME/etc/ldpaths (where in your case $R_HOME seems to be /usr/local/lib64/R). It is the commands in this file that set LD_LIBRARY_PATH at R's start-up.
Mine looks like this:
flodel#netbook-samsung-N150:~$ cat /usr/lib/R/etc/ldpaths
: ${JAVA_HOME=/usr/lib/jvm/java-6-openjdk/jre}
: ${R_JAVA_LD_LIBRARY_PATH=${JAVA_HOME}/lib/i386/client:${JAVA_HOME}/lib/i386:/usr/lib/jni}
if test -n ""; then
: ${R_LD_LIBRARY_PATH=${R_HOME}/lib:}
else
: ${R_LD_LIBRARY_PATH=${R_HOME}/lib}
fi
if test -n "${R_JAVA_LD_LIBRARY_PATH}"; then
R_LD_LIBRARY_PATH="${R_LD_LIBRARY_PATH}:${R_JAVA_LD_LIBRARY_PATH}"
fi
if test -z "${LD_LIBRARY_PATH}"; then
LD_LIBRARY_PATH="${R_LD_LIBRARY_PATH}"
else
LD_LIBRARY_PATH="${R_LD_LIBRARY_PATH}:${LD_LIBRARY_PATH}"
fi
export LD_LIBRARY_PATH
If you do not have write access to the file, you can still do this before starting R:
export R_LD_LIBRARY_PATH=/your/custom/path
I tested on my machine that it works by running the following after R is started:
Sys.getenv("LD_LIBRARY_PATH")
#[1] "/your/custom/path:/usr/lib/jvm/java-6-openjdk/jre/lib/i386/client:/usr/lib/jvm/java-6-openjdk/jre/lib/i386:/usr/lib/jni"
If anyone is still reading this, I engaged in some "personnel engineering" to solve the problem, i.e. got the system admins to re-install R so that it had everything I needed. Was certainly nice of them. Thanks very much to everyone who gave suggestions. Would like to keep going on some of them, but I've got to get busy on this project. Much obliged!
RPATH is only useful when compiling (well, linking); it affects the library search path that gets baked into the binary.
Try running with LD_DEBUG=libs, which will show libraries are being loaded from which paths. Is it trying to load from your LD_LIBRARY_PATH but failing, or not searching there in the first place (perhaps rpy2 has its own library path mechanism?), or something else?
Try adding your directory on the left of the LD_LIBRARY_PATH as the precedence goes left to right.
export LD_LIBRARY_PATH=~/your/custom/path:$LD_LIBRARY_PATH

Categories

Resources