python theano Optimization failure due to: local_dot_to_dot22 - python

I just pip installed theano and tried to run theano.test(). It produced a very long log of errors and I copied the first part. I also tried a couple other examples - I have seen
"local_dot_to_dot22"
and
"ValueError: invalid token "Files\Enthought\Canopy\App\appdata\canopy1.5.2.2785.win-x86_64\Scripts" in ldflags_str: "-LC:\Program Files\Enthought\Canopy\App\appdata\canopy-1.5.2.2785.win-x86_64\Scripts -lmk2_core -lmk2_intel_thread -lmk2_rt"
several times.
I'm using python 2.7 (canopy), scipy 0.15.1-2 and numpy 1.9.2-1. I am very new to theano. I appreciate if you can point me to the right direction. Thanks!
EEEEEERROR (theano.gof.opt): Optimization failure due to: local_dot_to_dot22
ERROR:theano.gof.opt:Optimization failure due to: local_dot_to_dot22
ERROR (theano.gof.opt): TRACEBACK:
ERROR:theano.gof.opt:TRACEBACK:
ERROR (theano.gof.opt): Traceback (most recent call last):
File "c:\theano\theano\gof\opt.py", line 1737, in process_node
replacements = lopt.transform(node)
File "c:\theano\theano\tensor\blas.py", line 1776, in local_dot_to_dot22
return [_dot22(x.dimshuffle('x', 0), y).dimshuffle(1)]
File "c:\theano\theano\gof\op.py", line 647, in __call__
no_recycling=[])
File "c:\theano\theano\gof\op.py", line 918, in make_thunk
no_recycling)
File "c:\theano\theano\gof\op.py", line 836, in make_c_thunk
output_storage=node_output_storage)
File "c:\theano\theano\gof\cc.py", line 1175, in make_thunk
keep_lock=keep_lock)
File "c:\theano\theano\gof\cc.py", line 1113, in __compile__
keep_lock=keep_lock)
File "c:\theano\theano\gof\cc.py", line 1541, in cthunk_factory
key = self.cmodule_key()
File "c:\theano\theano\gof\cc.py", line 1257, in cmodule_key
compile_args=self.compile_args(),
File "c:\theano\theano\gof\cc.py", line 936, in compile_args
ret += x.c_compile_args()
File "c:\theano\theano\tensor\blas.py", line 652, in c_compile_args
return ldflags(libs=False, flags=True)
File "c:\theano\theano\tensor\blas.py", line 537, in ldflags
include_dir=include_dir)
File "c:\theano\theano\gof\utils.py", line 182, in rval
val = f(*args, **kwargs)
File "c:\theano\theano\tensor\blas.py", line 597, in _ldflags
% (t, ldflags_str))
ValueError: invalid token "Files\Enthought\Canopy\App\appdata\canopy- 1.5.2.2785.win-x86_64\Scripts" in ldflags_str: "-LC:\Program Files\Enthought\Canopy\App\appdata\canopy-1.5.2.2785.win-x86_64\Scripts -lmk2_core -lmk2_intel_thread -lmk2_rt"

The problem here is problem caused by having spaces in your path, i.e. Canopy is installed in C:\Program Files\Enthought\Canopy but the Theano scripts don't work well with the space between Program and Files. Try uninstalling Canopy and reinstall in a directory with no space in the path.
You should also follow the other instructions for installing Theano on Windows. Unfortunately it's not as simple as just pip install theano.

In case you don't want to reinstall things, if they're heavy programs, for instance, affecting Window's registry and so, you can try symbolic links.
A symbolic link will create something similar to a shortcut to a folder, but seen as an actual folder by other applications.
So, you can do something like this:
Run cmd as administrator
User this command: mklink /D "C:\LinkToProgramFiles" "C:\Program Files"
And then, you start using "C:\LinkToProgramFiles" in your ldflags var.

Related

Issues Opening Spyder via Anaconda

I was forced into some software updates on my laptop (ThinkPad) and after the update when I tried to open Spyder (via Anaconda) and it won't open. I don't have any experience in errors like this or fixing this stuff (and I am aware this may be something that is super simple). Please help. This is the application launch error I am getting:
Traceback (most recent call last):
File "C:\Users\cyrra\anaconda3\Scripts\spyder-script.py", line 10, in
sys.exit(main())
File "C:\Users\cyrra\anaconda3\lib\site-packages\spyder\app\start.py", line 205, in main
mainwindow.main()
File "C:\Users\cyrra\anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 3651, in main
mainwindow = run_spyder(app, options, args)
File "C:\Users\cyrra\anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 3526, in run_spyder
main.setup()
File "C:\Users\cyrra\anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 871, in setup
self.help = Help(self, css_path=css_path)
File "C:\Users\cyrra\anaconda3\lib\site-packages\spyder\plugins\help\plugin.py", line 68, in __init__
color_scheme = self.get_color_scheme()
File "C:\Users\cyrra\anaconda3\lib\site-packages\spyder\api\plugins.py", line 347, in get_color_scheme
return super(BasePluginWidget, self)._get_color_scheme()
File "C:\Users\cyrra\anaconda3\lib\site-packages\spyder\plugins\base.py", line 446, in _get_color_scheme
return get_color_scheme(CONF.get('appearance', 'selected'))
File "C:\Users\cyrra\anaconda3\lib\site-packages\spyder\config\gui.py", line 114, in get_color_scheme
color_scheme[key] = CONF.get("appearance", "%s/%s" % (name, key))
File "C:\Users\cyrra\anaconda3\lib\site-packages\spyder\config\manager.py", line 228, in get
return config.get(section=section, option=option, default=default)
File "C:\Users\cyrra\anaconda3\lib\site-packages\spyder\config\user.py", line 976, in get
return config.get(section=section, option=option, default=default)
File "C:\Users\cyrra\anaconda3\lib\site-packages\spyder\config\user.py", line 513, in get
raise cp.NoOptionError(option, section)
configparser.NoOptionError: No option 'custom-1/background' in section: 'appearance'
Thanks,
Rachel
Did you try to run spyder on the terminal?
It should be prebuild in Anaconda.
Your Spyder config file should contain but is missing 'custom-1/background' in section: 'appearance'. If you have no experience, the easiest thing for you to do is uninstall and install Spyder (via Anaconda). Your other option is to find the config file called in line 513 of C:\Users\cyrra\anaconda3\lib\site-packages\spyder\config\user.py". Then open the config file (if it exists) and correct it. If the file is not found, search for that config file and place it in the expected location.

flake8 internal error in regular expression engine

I'm trying to run flake8 on a docker django built like described here (tutorial page)
when building the docker image I get an error from flake8 which is run in an docker-compose file with like so
$ flake8 --ignore=E501,F401 .
multiprocessing.pool.RemoteTraceback:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/multiprocessing/pool.py", line 125, in worker
result = (True, func(*args, **
File "/usr/local/lib/python3.8/multiprocessing/pool.py", line 48, in
return list(map(*
File "/usr/local/lib/python3.8/site-packages/flake8/checker.py", line 666, in
return checker.run_checks()
File "/usr/local/lib/python3.8/site-packages/flake8/checker.py", line 598, in run_checks
self.run_ast_checks()
File "/usr/local/lib/python3.8/site-packages/flake8/checker.py", line 495, in run_ast_checks
checker = self.run_check(plugin, tree=ast)
File "/usr/local/lib/python3.8/site-packages/flake8/checker.py", line 426, in run_check
self.processor.keyword_arguments_for( File "/usr/local/lib/python3.8/site-packages/flake8/processor.py", line 241, in keyword_arguments_for arguments[param] = getattr(self, param)
File "/usr/local/lib/python3.8/site-packages/flake8/processor.py", line 119, in file_tokens
self._file_tokens = list(
File "/usr/local/lib/python3.8/tokenize.py", line 525, in _tokenize
pseudomatch = _compile(PseudoToken).match(line, pos)
RuntimeError: internal error in regular expression engine
The above exception was the direct cause of the following exception: Traceback (most recent call last):
File "/usr/local/bin/flake8", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.8/site-packages/flake8/main/cli.py", line 18, in main
app.run(argv)
File "/usr/local/lib/python3.8/site-packages/flake8/main/application.py", line 393, in run
self._run(argv)
File "/usr/local/lib/python3.8/site-packages/flake8/main/application.py", line 381, in _run
self.run_checks()
File "/usr/local/lib/python3.8/site-packages/flake8/main/application.py", line 300, in run_checks
self.file_checker_manager.run()
File "/usr/local/lib/python3.8/site-packages/flake8/checker.py", line 329, in run
self.run_parallel()
File "/usr/local/lib/python3.8/site-packages/flake8/checker.py", line 293, in run_parallel
for ret in pool_map:
File "/usr/local/lib/python3.8/multiprocessing/pool.py", line 448, in <genexpr>
return (item for chunk in result for item in chunk)
File "/usr/local/lib/python3.8/multiprocessing/pool.py", line 865, in next
raise value
RuntimeError: internal error in regular expression engine
When I run flake8 with the --verbose flag, I get an error like this:
Fatal Python error: deletion of interned string failed
Python runtime state: initialized
KeyError: 'FILENAME_RE'
from the tokenizer.py
Does anyone know how to solve this?
Additional Data:
running docker-compose v1.25.4 on an raspberry 3 with buster lite.
Installed and compiled Python 3.8.2 from source with the flag --enableloadable-sqlite
Thanks for helping!
If you don't care for flake8, then just delete that line. It will work. I had the same problem.
I know this isn't an answer. I would add a comment instead if I could.
I encountered a very similar error profile when I had refactored and left a lot of data which formerly had been in the top of the project down in what became the package folder. There were 33621 files including .venv, .nox, .pytest_cache, .coverage.
File "/usr/lib/python3.8/multiprocessing/pool.py", line 448, in <genexpr>
return (item for chunk in result for item in chunk)
File "/usr/lib/python3.8/multiprocessing/pool.py", line 868, in next
raise value
IndexError: string index out of range
If you see a similar signature (the parallel processing engine being overwhelmed in some way and throwing an exception), you may want to review your project directory structure and make sure that you did not put this kind of data in your sources directories.

Python, theano Runtimeerror: could not initialize elemwise support

Sorry if this happens to be trivial as I happen to be new with these stuff. I setup theano to use my gpu for computations on ubuntu trusty tahr. I have AMD Radeon HD 7670M gpu. When I try to run the test script to check the functioning of the theano with gpu, I get the following error:
Mapped name None to device opencl0:0: Turks
Traceback (most recent call last):
File "test.py", line 11, in <module>
f = function([], T.exp(x))
File "/home/sachu/git/Theano/theano/compile/function.py", line 322, in function
output_keys=output_keys)
File "/home/sachu/git/Theano/theano/compile/pfunc.py", line 480, in pfunc
output_keys=output_keys)
File "/home/sachu/git/Theano/theano/compile/function_module.py", line 1784, in orig_function
defaults)
File "/home/sachu/git/Theano/theano/compile/function_module.py", line 1648, in create
input_storage=input_storage_lists, storage_map=storage_map)
File "/home/sachu/git/Theano/theano/gof/link.py", line 699, in make_thunk
storage_map=storage_map)[:3]
File "/home/sachu/git/Theano/theano/gof/vm.py", line 1042, in make_all
no_recycling))
File "/home/sachu/git/Theano/theano/gof/op.py", line 975, in make_thunk
no_recycling)
File "/home/sachu/git/Theano/theano/gof/op.py", line 875, in make_c_thunk
output_storage=node_output_storage)
File "/home/sachu/git/Theano/theano/gof/cc.py", line 1189, in make_thunk
keep_lock=keep_lock)
File "/home/sachu/git/Theano/theano/gof/cc.py", line 1130, in __compile__
keep_lock=keep_lock)
File "/home/sachu/git/Theano/theano/gof/cc.py", line 1602, in cthunk_factory
*(in_storage + out_storage + orphd))
RuntimeError: ('The following error happened while compiling the node', GpuElemwise{exp,no_inplace}(<GpuArrayType<None>(float64, (False,))>), '\n', 'Could not initialize elemwise support')
The script I ran was the one available on the website: http://deeplearning.net/software/theano/tutorial/using_gpu.html
Is it something wrong with the config? I believe all dependencies are set properly, but I could have made some mistake, but then I would probably something other than runtime-error. I searched a lot on the github for info related to this, but found nothing. Same was the result after searching on stackoverflow, heance I am posting this here. Any help is appreciated.
Thanks
Additional Info: python3.4, theano bleeding edge version. Libgpuarray, clblas, openblas are all built from the git source master branch. 64bit architecture.
Theano support for OpenCL is just not ready yet and it does not seem to be a priority for the development team to get this working (see this issue). So either you will need some patience or an nvidia GPU on which you could run CUDA.

List index out of range Error in Python in MGLTOOLS

I'm running a program (MGLTOOLS) by python scripts. When I start the program, I get the following error. I don't know python. I don't understood the error.
C:\Users\Goutham>set MGLPYTHONPATH=C:\Program Files (x86)\MGLTools 1.5.4
C:\Users\Goutham>"C:\Python25\python.exe" "C:\Program Files (x86)\MGLTools 1.5.4
\MGLToolsPckgs\AutoDockTools\bin\runAdt.py"
Run AutoDockTools from C:\Program Files (x86)\MGLTools 1.5.4\MGLToolsPckgs\AutoD
ockTools
Welcome to Python Molecule Viewer!
Visit http://mgltools.scripps.edu/documentation to read latest documentation.
Resource file used to customize PMV: C:\Users\Goutham\.mgltools\1.5.4\Pmv\_pmvrc
Traceback (most recent call last):
File "C:\Program Files (x86)\MGLTools 1.5.4\MGLToolsPckgs\AutoDockTools\__init
__.py", line 373, in runADT
title=title, withShell= not interactive, verbose=False)
File "C:\Program Files (x86)\MGLTools 1.5.4\MGLToolsPckgs\Pmv\moleculeViewer.p
y", line 315, in __init__
verbose=verbose, trapExceptions=trapExceptions)
File "C:\Program Files (x86)\MGLTools 1.5.4\MGLToolsPckgs\ViewerFramework\VF.p
y", line 345, in __init__
verbose=verbose)
File "C:\Program Files (x86)\MGLTools 1.5.4\MGLToolsPckgs\ViewerFramework\VFGU
I.py", line 277, in __init__
cnf = {"addScenarioButton": False})
File "C:\Program Files (x86)\MGLTools 1.5.4\MGLToolsPckgs\DejaVu\Viewer.py", l
ine 675, in __init__
cp = ClippingPlane(self.rootObject, i, self)
File "C:\Program Files (x86)\MGLTools 1.5.4\MGLToolsPckgs\DejaVu\Clip.py", lin
e 42, in __init__
self.id = self.clipPlaneNames[num]
IndexError: list index out of range
hit enter to continue
If this problem is arising as soon as you click on the GUI, you should contact MGL support and post on their forums, as StackOverflow is unlikely to be of any help (this might require a fix from the developers).
Note that the bug you are describing is described in this report:
http://mgldev.scripps.edu/bugs/show_bug.cgi?id=1216
I think it is resolved in the RC3 build. Download it here MGL Tools 1.5.6.

Cannot Import GTK in Ubuntu Python 2.7

I'm trying to import GTK in Ubuntu Python 2.7, and I get the following error. PyGTK imports just fine. When I import gtk, I get the following error:
Exception in Tkinter callback Traceback (most recent call last):
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1413, in __call__
return self.func(*args)
File "/usr/lib/python2.7/idlelib/MultiCall.py", line 167, in handler
r = l[i](event)
File "/usr/lib/python2.7/idlelib/PyShell.py", line 1140, in enter_callback
self.runit()
File "/usr/lib/python2.7/idlelib/PyShell.py", line 1181, in runit
more = self.interp.runsource(line)
File "/usr/lib/python2.7/idlelib/PyShell.py", line 619, in runsource
return InteractiveInterpreter.runsource(self, source, filename)
File "/usr/lib/python2.7/code.py", line 87, in runsource
self.runcode(code)
File "/usr/lib/python2.7/idlelib/PyShell.py", line 759, in runcode
self.tkconsole.endexecuting()
File "/usr/lib/python2.7/idlelib/PyShell.py", line 940, in endexecuting
self.showprompt()
File "/usr/lib/python2.7/idlelib/PyShell.py", line 1205, in showprompt
self.resetoutput()
File "/usr/lib/python2.7/idlelib/PyShell.py", line 1217, in resetoutput
if self.history:
File "/usr/lib/python2.7/idlelib/PyShell.py", line 64, in idle_showwarning
lineno, file=file, line=line))
TypeError: idle_formatwarning() got an unexpected keyword argument 'file'
How do I fix this?
This is a bug in idle. Looking at the last line of that error message:
File "/usr/lib/python2.7/idlelib/PyShell.py", line 64, in idle_showwarning
lineno, file=file, line=line))
TypeError: idle_formatwarning() got an unexpected keyword argument 'file'
This is saying that the warning.idle_showwarning method does not have an argument "file".
Sure enough looking at /usr/lib/python2.7/warnings.py
def formatwarning(message, category, filename, lineno, line=None)
There is no such argument.
This apparently has been resolved in source control but I do not think it has made it into a release yet. I would just hack the /usr/lib/python2.7/idlelib/PyShell.py file and remove the offending argument from line 64.
Then try it again...
Try it outside of IDLE. The error here is in IDLE, not your code.
Create a new script that contains import gtk and save it anywhere.
From the command line, in the directory where your script is located, run python whatever_your_scripts_name_is.py.
See if you get an error. You may not be able to import gtk in IDLE.
Edit: There is apparently a problem with GTK and IDLE in some situations on Ubuntu.
Try a different Python shell; I'd recommend IPython which you can install with Synaptic or sudo apt-get install ipython.

Categories