failed to import psycho backend
Dear all,
Running experiments with the 'psycho' backend seems difficult on the current computer I am working on, and I was wondering if anyone had experienced something similar. The error that pops up is the following:
"failed to import psychopy because it is not (correctly) installed. For installation instructions, please visit [...] etc"
importing psychopy from the debugger works, but importing individual modules leads to strange errors that look red herring-ish (see end of this post).
The environment variables are the same as for a system where the backend is working correctly
C:\Python27;C:\Python27\DLLs;C:\Python27\Scripts;
C:\Python27\gnuplot\binary;C:\Python27\Lib\site-packages\vtk;
C:\Program Files (x86)\PsychoPy2;
C:\Program Files (x86)\PsychoPy2\DLLs;
C:\Program Files (x86)\pythonxy\SciTE-3.3.2-3;
C:\Program Files (x86)\pythonxy\console;
C:\Python27\Lib\site-packages\PyQt4;
the OS is windows 7, and the errors come from stand-alone opensesame version 3.1.9 and are the same in version 3.0.5, the backend works fine in opensesame 2.8 and 2.9.
any suggestions are welcome,
Roelof
Python 2.7.12
* Type "help()", "copyright()", "credits()" or "license()" for more information.
* Use the "print([msg])" function in inline_script items to print to this debug window.
* Inspect inline_script variables when an experiment is finished.
import psychopy
from psychopy import visual
ImportErrorTraceback (most recent call last)
<ipython-input-2-f798aaf28897> in <module>()
----> 1 from psychopy import visual
C:\Program Files (x86)\_PortableOpenSesameS\opensesame_3.1.9-py2.7-win32-1\lib\site-packages\psychopy\visual\__init__.py in <module>()
13
14 # window, should always be loaded first
---> 15 from psychopy.visual.window import Window, getMsPerFrame, openWindows
16
17 # non-private helpers
C:\Program Files (x86)\_PortableOpenSesameS\opensesame_3.1.9-py2.7-win32-1\lib\site-packages\psychopy\visual\window.py in <module>()
55
56 import psychopy # so we can get the __path__
---> 57 from psychopy import core, platform_specific, logging, prefs, monitors, event
58 import psychopy.event
59
C:\Program Files (x86)\_PortableOpenSesameS\opensesame_3.1.9-py2.7-win32-1\lib\site-packages\psychopy\monitors\__init__.py in <module>()
4
5 import os, sys
----> 6 import calibTools
7 from calibTools import *
8
C:\Program Files (x86)\_PortableOpenSesameS\opensesame_3.1.9-py2.7-win32-1\lib\site-packages\psychopy\monitors\calibTools.py in <module>()
18
19 import numpy
---> 20 import scipy.optimize as optim
21 from scipy import interpolate
22
C:\Program Files (x86)\_PortableOpenSesameS\opensesame_3.1.9-py2.7-win32-1\lib\site-packages\scipy\optimize\__init__.py in <module>()
231
232 from .optimize import *
--> 233 from ._minimize import *
234 from ._root import *
235 from .minpack import *
C:\Program Files (x86)\_PortableOpenSesameS\opensesame_3.1.9-py2.7-win32-1\lib\site-packages\scipy\optimize\_minimize.py in <module>()
28
29 # constrained minimization
---> 30 from .lbfgsb import _minimize_lbfgsb
31 from .tnc import _minimize_tnc
32 from .cobyla import _minimize_cobyla
C:\Program Files (x86)\_PortableOpenSesameS\opensesame_3.1.9-py2.7-win32-1\lib\site-packages\scipy\optimize\lbfgsb.py in <module>()
42 _check_unknown_options, wrap_function,
43 _approx_fprime_helper)
---> 44 from scipy.sparse.linalg import LinearOperator
45
46 __all__ = ['fmin_l_bfgs_b', 'LbfgsInvHessProduct']
C:\Program Files (x86)\_PortableOpenSesameS\opensesame_3.1.9-py2.7-win32-1\lib\site-packages\scipy\sparse\linalg\__init__.py in <module>()
114 from .interface import *
115 from .eigen import *
--> 116 from .matfuncs import *
117 from ._onenormest import *
118 from ._norm import *
C:\Program Files (x86)\_PortableOpenSesameS\opensesame_3.1.9-py2.7-win32-1\lib\site-packages\scipy\sparse\linalg\matfuncs.py in <module>()
17 import numpy as np
18
---> 19 import scipy.misc
20 from scipy.linalg.basic import solve, solve_triangular
21
C:\Program Files (x86)\_PortableOpenSesameS\opensesame_3.1.9-py2.7-win32-1\lib\site-packages\scipy\misc\__init__.py in <module>()
49 from .common import *
50 from numpy import who, source, info as _info
---> 51 from scipy.special import comb, factorial, factorial2, factorialk
52
53 import sys
C:\Program Files (x86)\_PortableOpenSesameS\opensesame_3.1.9-py2.7-win32-1\lib\site-packages\scipy\special\__init__.py in <module>()
625 from __future__ import division, print_function, absolute_import
626
--> 627 from ._ufuncs import *
628
629 from .basic import *
ImportError: DLL load failed: The specified procedure could not be found.`
![](https://forum.cogsci.nl/uploads/editor/zy/3a1ift2c5mhq.png "")
Comments
Hi Roelof,
The error seems to come from scipy, more specifically the
scipy.optimize
module. If you import this module on its own, do you get the same error?Cheers,
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Hi Sebastiaan,
Thank you for the response and suggestion, importing the module on its own (
import scipy
) gives no errors, but importing the specific module gives:This last line (
ImportError: cannot import name _lbfgs
) also occurs for importing packages from psychopy such as visual or tools,Perhaps also of importance: the error occurs only on a specific desktop, the same standalone opensesame version (ran from usb) works fine on my own laptop
Hi Roelof,
That's a strange error. Two things come to mind:
lbfgsb
uses some functionality that is not supported by your system. If so, then upgrading or downgradingscipy
might resolve the issue. But it's groping in the dark, because it's unclear where the issue originates from.Cheers!
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Hi Sebastian,
Thanks for the advice, I tried upgrading scipy to version 0.12 or version .19, but to no avail.
I did discover that python was executing in 64 bit, which I changed to 32, but it did not solved the problem, although the systems on which the same standalone version was working was 32 bit as well.
Furthermore when scipy is not installed in my standard python folder ('C:\Python27') I get the following error:
DLL load failed: The specified procedure could not be found.
If I install scipy, I get the following:
"cache deserialization failed"
and then in opensesame we are back to the lgbsf error:
cannot import name _lbfgsb
This seems at least as if opensesame is looking for scipy package in the C:\Python27 folder, which might not be desireable, not sure how to change the priority for where to look for packages though
When I completely remove my local python installation, opensesame also does not run psychopy and says:
DLL load failed: %1 is not a valid Win32 application.
Not sure if this is any help, I'll keep looking what the issue might be,
Roelof
Hi Roelof,
This is going to be tricky to resolve, but it will be helpful to know the following: Python environments are completely separate, and don't share libraries, except in two cases (that I can think of):
PYTHON_PATH
set as an environment variable. In that case, the Python path will be used by all Python environments.dll
that is not in the Python environment per se, but somewhere else in the system.I don't know if either of these is going on in your case. The fact that removing your local installation has any effect on OpenSesame at all (which is odd) suggests that it may be.
Cheers,
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
update:
when upgrading scipy to latest version (1.1.0) the experiment runs psycho backend fine, in both opensesame versions 3.1.9 and 3.2.5, the exact change that lead to the solution is still obscure, but it is working atm