Neupy LevenbergMarquardt optimiser algorithm won’t compile (scan_perform)

  neupy, python, theano

I am trying to build a simple feedforward network with the Levenberg-Marquardt optimiser algorithm using the Neupy python library, but it won’t compile as it seems to be missing the scan_perform module. If I change the optimiser algorithm to GradientDescent, then it works fine.

The code needed to reproduce the error is:

from neupy import algorithms
from neupy.layers import *

net = Input(2) >> Sigmoid(2) >> Linear(1)
opt = algorithms.LevenbergMarquardt(net)

and the error I get is:

You can find the C code in this temporary file: /tmp/theano_compilation_error_8yf9iyd4
library owlatency-x86_64-with-glibc2.10-x86_64-3.8.3-64/scan_perform/mod.cpp: is not found.
library owlatency-x86_64-with-glibc2.10-x86_64-3.8.3-64/scan_perform/mod.cpp:11860:69: is not found.
library owlatency-x86_64-with-glibc2.10-x86_64-3.8.3-64/scan_perform/mod.cpp: is not found.
library owlatency-x86_64-with-glibc2.10-x86_64-3.8.3-64/scan_perform/mod.cpp:12617:21: is not found.
library owlatency-x86_64-with-glibc2.10-x86_64-3.8.3-64/scan_perform/mod.cpp:12618:22: is not found.
library owlatency-x86_64-with-glibc2.10-x86_64-3.8.3-64/scan_perform/mod.cpp:12619:19: is not found.
library owlatency-x86_64-with-glibc2.10-x86_64-3.8.3-64/scan_perform/mod.cpp: is not found.
library owlatency-x86_64-with-glibc2.10-x86_64-3.8.3-64/scan_perform/mod.cpp:12626:24: is not found.
library owlatency-x86_64-with-glibc2.10-x86_64-3.8.3-64/scan_perform/mod.cpp:12627:25: is not found.
library owlatency-x86_64-with-glibc2.10-x86_64-3.8.3-64/scan_perform/mod.cpp:12628:22: is not found.
library owlatency-x86_64-with-glibc2.10-x86_64-3.8.3-64/scan_perform/mod.cpp:12629:13: is not found.
library owlatency-x86_64-with-glibc2.10-x86_64-3.8.3-64/scan_perform/mod.cpp:12630:13: is not found.
library owlatency-x86_64-with-glibc2.10-x86_64-3.8.3-64/scan_perform/mod.cpp:12631:13: is not found.
library owlatency-x86_64-with-glibc2.10-x86_64-3.8.3-64/scan_perform/mod.cpp: is not found.
library owlatency-x86_64-with-glibc2.10-x86_64-3.8.3-64/scan_perform/mod.cpp:12686:24: is not found.
library owlatency-x86_64-with-glibc2.10-x86_64-3.8.3-64/scan_perform/mod.cpp:12687:25: is not found.
library owlatency-x86_64-with-glibc2.10-x86_64-3.8.3-64/scan_perform/mod.cpp:12688:22: is not found.
library owlatency-x86_64-with-glibc2.10-x86_64-3.8.3-64/scan_perform/mod.cpp:12689:13: is not found.
library owlatency-x86_64-with-glibc2.10-x86_64-3.8.3-64/scan_perform/mod.cpp:12690:13: is not found.
library owlatency-x86_64-with-glibc2.10-x86_64-3.8.3-64/scan_perform/mod.cpp:12691:13: is not found.
Traceback (most recent call last):
  File "/home/gus/anaconda3/lib/python3.8/site-packages/theano/scan_module/scan_perform_ext.py", line 48, in <module>
    raise ImportError()
ImportError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/gus/anaconda3/lib/python3.8/site-packages/theano/scan_module/scan_perform_ext.py", line 63, in <module>
    raise ImportError()
ImportError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/gus/Documents/UNSW_work/code/python/latent_variables/nn_test_neupy2.py", line 12, in <module>
    opt = algorithms.LevenbergMarquardt(net)
  File "/home/gus/anaconda3/lib/python3.8/site-packages/neupy/algorithms/gd/base.py", line 113, in __init__
    super(GradientDescent, self).__init__(connection, **options)
  File "/home/gus/anaconda3/lib/python3.8/site-packages/neupy/algorithms/constructor.py", line 291, in __init__
    super(ConstructibleNetwork, self).__init__(*args, **kwargs)
  File "/home/gus/anaconda3/lib/python3.8/site-packages/neupy/algorithms/constructor.py", line 163, in __init__
    self.init_methods()
  File "/home/gus/anaconda3/lib/python3.8/site-packages/neupy/algorithms/constructor.py", line 338, in init_methods
    train_epoch=theano.function(
  File "/home/gus/anaconda3/lib/python3.8/site-packages/theano/compile/function.py", line 306, in function
    fn = pfunc(params=inputs,
  File "/home/gus/anaconda3/lib/python3.8/site-packages/theano/compile/pfunc.py", line 483, in pfunc
    return orig_function(inputs, cloned_outputs, mode,
  File "/home/gus/anaconda3/lib/python3.8/site-packages/theano/compile/function_module.py", line 1841, in orig_function
    fn = m.create(defaults)
  File "/home/gus/anaconda3/lib/python3.8/site-packages/theano/compile/function_module.py", line 1714, in create
    _fn, _i, _o = self.linker.make_thunk(
  File "/home/gus/anaconda3/lib/python3.8/site-packages/theano/gof/link.py", line 697, in make_thunk
    return self.make_all(input_storage=input_storage,
  File "/home/gus/anaconda3/lib/python3.8/site-packages/theano/gof/vm.py", line 1087, in make_all
    thunks.append(node.op.make_thunk(node,
  File "/home/gus/anaconda3/lib/python3.8/site-packages/theano/scan_module/scan_op.py", line 925, in make_thunk
    from . import scan_perform_ext
  File "/home/gus/anaconda3/lib/python3.8/site-packages/theano/scan_module/scan_perform_ext.py", line 120, in <module>
    cmodule.GCC_compiler.compile_str(dirname, code, location=loc,
  File "/home/gus/anaconda3/lib/python3.8/site-packages/theano/gof/cmodule.py", line 2398, in compile_str
    raise Exception('Compilation failed (return status=%s): %s' %
Exception: ('The following error happened while compiling the node', for{cpu,scan_fn}(Elemwise{Mul}[(0, 0)].0, Subtensor{int64:int64:int8}.0, Elemwise{Mul}[(0, 0)].0, Elemwise{Mul}[(0, 0)].0, Elemwise{Mul}[(0, 0)].0, Elemwise{Mul}[(0, 0)].0, Reshape{1}.0, Elemwise{sub,no_inplace}.0, Elemwise{Composite{scalar_sigmoid((i0 + i1))}}[(0, 0)].0, InplaceDimShuffle{1,0}.0, Elemwise{sub,no_inplace}.0, MakeVector{dtype='int64'}.0, Alloc.0, InplaceDimShuffle{1,0}.0, InplaceDimShuffle{1,0}.0), 'n', 'Compilation failed (return status=1): /home/gus/.theano/compiledir_Linux-5.4--lowlatency-x86_64-with-glibc2.10-x86_64-3.8.3-64/scan_perform/mod.cpp: In function ‘PyObject* __Pyx_PyCFunction_FastCall(PyObject*, PyObject**, Py_ssize_t)’:. /home/gus/.theano/compiledir_Linux-5.4--lowlatency-x86_64-with-glibc2.10-x86_64-3.8.3-64/scan_perform/mod.cpp:11860:69: error: too many arguments to function. 11860 |     return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs, NULL);.       |                                                                     ^. /home/gus/.theano/compiledir_Linux-5.4--lowlatency-x86_64-with-glibc2.10-x86_64-3.8.3-64/scan_perform/mod.cpp: In function ‘void __Pyx__ExceptionSave(PyThreadState*, PyObject**, PyObject**, PyObject**)’:. /home/gus/.theano/compiledir_Linux-5.4--lowlatency-x86_64-with-glibc2.10-x86_64-3.8.3-64/scan_perform/mod.cpp:12617:21: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?. 12617 |     *type = tstate->exc_type;.       |                     ^~~~~~~~.       |                     curexc_type. /home/gus/.theano/compiledir_Linux-5.4--lowlatency-x86_64-with-glibc2.10-x86_64-3.8.3-64/scan_perform/mod.cpp:12618:22: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?. 12618 |     *value = tstate->exc_value;.       |                      ^~~~~~~~~.       |                      curexc_value. /home/gus/.theano/compiledir_Linux-5.4--lowlatency-x86_64-with-glibc2.10-x86_64-3.8.3-64/scan_perform/mod.cpp:12619:19: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?. 12619 |     *tb = tstate->exc_traceback;.       |                   ^~~~~~~~~~~~~.       |                   curexc_traceback. /home/gus/.theano/compiledir_Linux-5.4--lowlatency-x86_64-with-glibc2.10-x86_64-3.8.3-64/scan_perform/mod.cpp: In function ‘void __Pyx__ExceptionReset(PyThreadState*, PyObject*, PyObject*, PyObject*)’:. /home/gus/.theano/compiledir_Linux-5.4--lowlatency-x86_64-with-glibc2.10-x86_64-3.8.3-64/scan_perform/mod.cpp:12626:24: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?. 12626 |     tmp_type = tstate->exc_type;.       |                        ^~~~~~~~.       |                        curexc_type. /home/gus/.theano/compiledir_Linux-5.4--lowlatency-x86_64-with-glibc2.10-x86_64-3.8.3-64/scan_perform/mod.cpp:12627:25: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?. 12627 |     tmp_value = tstate->exc_value;.       |                         ^~~~~~~~~.       |                         curexc_value. /home/gus/.theano/compiledir_Linux-5.4--lowlatency-x86_64-with-glibc2.10-x86_64-3.8.3-64/scan_perform/mod.cpp:12628:22: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?. 12628 |     tmp_tb = tstate->exc_traceback;.       |                      ^~~~~~~~~~~~~.       |                      curexc_traceback. /home/gus/.theano/compiledir_Linux-5.4--lowlatency-x86_64-with-glibc2.10-x86_64-3.8.3-64/scan_perform/mod.cpp:12629:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?. 12629 |     tstate->exc_type = type;.       |             ^~~~~~~~.       |             curexc_type. /home/gus/.theano/compiledir_Linux-5.4--lowlatency-x86_64-with-glibc2.10-x86_64-3.8.3-64/scan_perform/mod.cpp:12630:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?. 12630 |     tstate->exc_value = value;.       |             ^~~~~~~~~.       |             curexc_value. /home/gus/.theano/compiledir_Linux-5.4--lowlatency-x86_64-with-glibc2.10-x86_64-3.8.3-64/scan_perform/mod.cpp:12631:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?. 12631 |     tstate->exc_traceback = tb;.       |             ^~~~~~~~~~~~~.       |             curexc_traceback. /home/gus/.theano/compiledir_Linux-5.4--lowlatency-x86_64-with-glibc2.10-x86_64-3.8.3-64/scan_perform/mod.cpp: In function ‘int __Pyx__GetException(PyThreadState*, PyObject**, PyObject**, PyObject**)’:. /home/gus/.theano/compiledir_Linux-5.4--lowlatency-x86_64-with-glibc2.10-x86_64-3.8.3-64/scan_perform/mod.cpp:12686:24: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?. 12686 |     tmp_type = tstate->exc_type;.       |                        ^~~~~~~~.       |                        curexc_type. /home/gus/.theano/compiledir_Linux-5.4--lowlatency-x86_64-with-glibc2.10-x86_64-3.8.3-64/scan_perform/mod.cpp:12687:25: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?. 12687 |     tmp_value = tstate->exc_value;.       |                         ^~~~~~~~~.       |                         curexc_value. /home/gus/.theano/compiledir_Linux-5.4--lowlatency-x86_64-with-glibc2.10-x86_64-3.8.3-64/scan_perform/mod.cpp:12688:22: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?. 12688 |     tmp_tb = tstate->exc_traceback;.       |                      ^~~~~~~~~~~~~.       |                      curexc_traceback. /home/gus/.theano/compiledir_Linux-5.4--lowlatency-x86_64-with-glibc2.10-x86_64-3.8.3-64/scan_perform/mod.cpp:12689:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?. 12689 |     tstate->exc_type = local_type;.       |             ^~~~~~~~.       |             curexc_type. /home/gus/.theano/compiledir_Linux-5.4--lowlatency-x86_64-with-glibc2.10-x86_64-3.8.3-64/scan_perform/mod.cpp:12690:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?. 12690 |     tstate->exc_value = local_value;.       |             ^~~~~~~~~.       |             curexc_value. /home/gus/.theano/compiledir_Linux-5.4--lowlatency-x86_64-with-glibc2.10-x86_64-3.8.3-64/scan_perform/mod.cpp:12691:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?. 12691 |     tstate->exc_traceback = local_tb;.       |             ^~~~~~~~~~~~~.       |             curexc_traceback. ')

As I said above, if I change the bottom line to opt = algorithms.GradientDescent(net), it works fine, its just LevenbergMarquardt and Hessian and the other Newton’s method-based ones.

Any idea how I can fix this?

Source: Python Questions

LEAVE A COMMENT