Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

[open] Failed to import PsychoPy

edited April 2014 in OpenSesame

I have been running my experiment on the same computer with the psycho backend. I haven't had any problems with the backend untill now. Somehow I get this error message when trying to run my experiment:

"Failed to import PsychoPy, probably because it is not (correctly) installed. For installation instructions, please visit http://www.psychopy.org/."

I tried updating PsychoPy, Downgrading PsychoPy and even deinstalled opensesame and reinstalled the older version (the 2.8.0 version that still uses PsychoPy 1.79). All this didn't change anything. I keep getting the same error message.

There might have been some changes on this computer I am not aware off (semi public experiment computer from my University) but I can't figure out how to resolve this issue.

Comments

  • edited 6:04AM

    Hi,

    As a first step, I would try to import PsychoPy from the OpenSesame debug window. This will show you the full error message (please post if any). Try to see what happens if you execute the following commands:

    import psychopy
    from psychopy import core
    from psychopy import visual
    from psychopy import logging
    

    I tried updating PsychoPy, Downgrading PsychoPy

    Do you mean that you updated/ downgraded the standalone PsychoPy installation? That wouldn't have any effect on OpenSesame, which comes bundled with its Python environment and its own set of modules (one of which is PsychoPy).

    Cheers!
    Sebastiaan

  • edited April 2014

    I did up/down-graded the standalone version yes. Also tried different versions of opensesame but that didn't have any different results.

    When I enter the import commands they all give no response except the "from psychopy import visual" command:

    Traceback (most recent call last):
      File "<console", line 1, in <module
      File "dist\psychopy\visual\__init__.py", line 26, in "<module
      File "dist\psychopy\visual\ratingscale.py", line 13, in "<module
    ImportError: cannot import name isValidColor
    
  • edited 6:04AM

    When I run opensesame with the python package or the no installation package, so basically without using the registry, psychopy works. I'd say something broke in the registry right?

    Small note, the opensesame.bat file from the portable installation should be updated. The version number isn't correct atm.

  • edited 6:04AM

    When I run opensesame with the python package or the no installation package, so basically without using the registry, psychopy works. I'd say something broke in the registry right?

    To the extent that the registry is used (just for basic config), this is shared by all versions of OpenSesame. So that is unlikely to be the issue. Looking at the error message, I think it is more likely that there is a problem with the psychopy.colors module, but I'm not sure what it could be. What do you see when you execute the commands below in the debug window?

    from psychopy import colors
    print colors.__file__
    print colors.isValidColor
    

    Small note, the opensesame.bat file from the portable installation should be updated. The version number isn't correct atm.

    Ow right. Would you mind dropping a note in this discussion, including a more detailed description of the problem and what version you are using at the moment?

    Cheers,
    Sebastiaan

  • edited 6:04AM

    Woops! Thanks for noticing the .bat in the portable version, I'm on it!

  • edited 6:04AM

    Hi guys,

    is there a solution for this? I have the same problem. Yesterday and early in the morning everything worked fine, I added one line to my experiment, tried to run it and all of a sudden it says it can't load psychopy.

    Starting experiment as ExperimentProcess-5
    Unexpected error loading library avbin: [Error 998] Invalid access to memory location
    Unexpected error loading library avbin: [Error 998] Invalid access to memory location
    An Exception occurred during exp.end(): 
    Failed to import PsychoPy, probably because it is not (correctly) installed. For installation instructions, please visit http://www.psychopy.org/.'
    

    I followed the steps suggested above giving me the following results.

    >>> from psychopy import core
    >>> from psychopy import visual
    Unexpected error loading library avbin: [Error 998] Invalid access to memory location
    Traceback (most recent call last):
      File "<console>", line 1, in <module>
      File "dist\psychopy\visual\__init__.py", line 13, in <module>
      File "dist\psychopy\visual\window.py", line 32, in <module>
      File "dist\pyglet\media\__init__.py", line 1354, in <module>
      File "dist\pyglet\media\avbin.py", line 53, in <module>
      File "dist\psychopy\visual\_pygletLibOverload.py", line 113, in load_library
      File "ctypes\__init__.pyo", line 443, in LoadLibrary
      File "ctypes\__init__.pyo", line 365, in __init__
    WindowsError: [Error 998] Invalid access to memory location
    

    and

    >>> from psychopy import logging
    >>> from psychopy import colors
    >>> print colors.__file__
    C:\Program Files (x86)\OpenSesame\psychopy\colors.pyo
    >>> print colors.isValidColor
    <function isValidColor at 0x10A139F0>
    

    Thought I'd post it here, maybe it'll help to figure out what's wrong. Please let me know if there is a workaround or if any more information is needed.

    Cheers,

    Michel

  • edited May 2014

    Hi Michel,

    What kind of version of PsychoPy are you running, and what is the line of script that started the trouble? You can get all version information by typing modules() in the debug window. It sounds like a bug in PsychoPy to me, but it might already have been resolved in the most recent release.

    Edit: Sorry, I see now that you already posted the troublesome line: from psychopy import visual

    Cheers!
    Sebasiaan

  • edited 6:04AM

    Hi Sebastiaan,

    De version of psychopy I'm running is the one included in opensesame 2.8.1. Which is psychopy 1.80.00.

    >>> modules()
    OpenSesame 2.8.1
    Python 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)]
    OpenCV is not available
    OpenCV2 2.4.7
    QProgedit 1.2.2
    Expyriment 0.7.0 (Revision 7a6b73d; Python 2.7.6)
    NumPy 1.8.0
    PIL is available (version is unknown)
    PsychoPy 1.80.00
    PyAudio 0.2.7
    PyGame 1.9.1release
    Pyglet 1.1.4
    PyOpenGL 3.0.2
    PyQt 4.10.4
    PySerial 2.7
    python-bidi 0.3.4
    python-markdown 2.3.1
    SciPy 0.13.3
    

    There is a newer version of psychopy, 1.80.04. I downloaded the zip file but I'm a bit unsure on how to proceed in getting this new version in opensesame.

    Is there a folder that I need to copy into opensesame?
    Do I need to install the psychopy standalone version?
    Do I need to do something else?

    Thanks in advance :)

    Michel

  • edited 6:04AM

    Is there a folder that I need to copy into opensesame? Do I need to install the psychopy standalone version? Do I need to do something else?

    You can simply replace the psychopy folder in the OpenSesame program folder by the psychopy folder from the download.

    Cheers!
    Sebastiaan

  • edited 6:04AM

    Glad to say it worked :) Thanks!

    I think the whole "psychopy not working anymore all of a sudden' issue might have been because of windows updates?

  • edited 6:04AM

    Glad to say it worked :-) Thanks!

    Good!

    I think the whole "psychopy not working anymore all of a sudden' issue might have been because of windows updates?

    It might have been, I have no clue. Did you hear the same problem from other people as well? The memory error that you got is kind of unclear and obscure, and I imagine it might well be specific to your machine.

Sign In or Register to comment.