Howdy, Stranger!

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

Supported by

Runtime Error

Hey,

I am using opensesame for collecting picture data. For the last three days, it has started to give the following error:

RuntimeError: module compiled against API version 0xe but this version of numpy is 0xd

I continued the experiment. How can I fix this problem? Will there be a problem with the data I collected? I am not sure if the data is collected accurately. Please help.


Best,

İpek Çelik

Comments

  • Hi @ipekcelik ,

    I am aware of this error message. I don't know where it comes from, but I guess it's a subtle compatibility issue in one of the libraries used by OpenSesame. It's harmless though, so you can ignore it!

    -- Sebastiaan

  • Hi Sebastian,

    Thank you for your reply. You are the best.

    İpek

  • pbepbe
    edited April 2023

    Hi @sebastiaan,

    I would like to ask you for help. My experiment is freezing when the RuntimeError above happens.

    The error happens when the following inline script is present, and does not happen otherwise.


    Prepare tab

    # The present code is partially based on a tutorial by Kate Stone,
    # available at https://stonekate.github.io/blog/opensesame.
    
    # import the python libraries we will use
    from psychopy import parallel
    
    # set test mode to yes or no 
    var.test_mode = "yes" 
    
    # test mode function
    # if we are not in test mode...
    if(var.test_mode != "yes"):
      port = parallel.ParallelPort(address='0x3FD8')
      port.setData(4)
      port.readPin(2)
      port.setPin(2,1)
      # send triggers to the port
      def send_trigger(trigger):
        port.setData(trigger)
        return;
       
    # otherwise, just print triggers
    else:
      def send_trigger(trigger):
        print(trigger)
        return;
    


    Run tab

    # The present code is partially based on a tutorial by Kate Stone,
    # available at https://stonekate.github.io/blog/opensesame.
    
    if(var.test_mode == "yes"):
      test_canvas = Canvas(color = 'red',font_size = 38, font_family = 'sans')
       
      # Fill it with the word:
      test_canvas.text("The experiment is running in test mode.No triggers will be sent. (Change test_mode to 'n' in trigger_settings for sending triggers through the parallel port.")
      test_canvas.show()
      my_keyboard = Keyboard()
      key, end_time = my_keyboard.get_key()
    


    Thank you very much for your attention,

    Pablo

  • pbepbe
    edited April 2023

    Issue solved after enabling the inprocess kernel (as suggested at https://forum.cogsci.nl/discussion/comment/20053/#Comment_20053).

  • pbepbe
    edited April 2023

    @sebastiaan,

    Also in this regard, I think it could be useful for beginners like myself to see a note in the beginner tutorial or/and in the GUI regarding two settings in Tools --> Preferences; namely, 'Run experiments in a separate process (multiprocess)' (which by default is 'inprocess') and 'Start inprocess kernel'.

    After setting both these options, I no longer see the above error or others that I used to see, like the following one:

    item-stack: experiment[run].select_language[run]
    time: Wed Apr 5 15:53:44 2023
    exception type: AttributeError
    exception message: Can't pickle local object 'CDLL.__init__.<locals>._FuncPtr'
    
    Traceback:
     File "C:\Program Files (x86)\OpenSesame\Lib\site-packages\libqtopensesame\extensions\_extension_manager.py", line 181, in fire
      ext.fire(event, **kwdict)
     File "C:\Program Files (x86)\OpenSesame\Lib\site-packages\libqtopensesame\misc\base_subcomponent.py", line 62, in fire
      getattr(self, u'event_%s' % event)(**kwdict)
     File "C:\Program Files (x86)\OpenSesame\share\opensesame_extensions\JupyterConsole\JupyterConsole.py", line 148, in event_set_workspace_globals
      self._jupyter_console.current.set_workspace_globals(global_dict)
     File "C:\Program Files (x86)\OpenSesame\share\opensesame_extensions\JupyterConsole\jupyter_tabwidget\jupyter_console.py", line 225, in set_workspace_globals
      self._jupyter_widget.set_workspace_globals(global_dict)
     File "C:\Program Files (x86)\OpenSesame\share\opensesame_extensions\JupyterConsole\jupyter_tabwidget\transparent_jupyter_widget.py", line 249, in set_workspace_globals
      blob = pickle.dumps(val)
    AttributeError: Can't pickle local object 'CDLL.__init__.<locals>._FuncPtr'
    


    In case it's relevant, I provide my session info below.

    System

    System: Windows-10-10.0.22621-SP0
    Architecture: win64
    

    Modules and packages

    OpenSesame 3.3.14
    Python 3.7.6 | packaged by conda-forge | (default, Jan 7 2020, 21:48:41) [MSC v.1916 64 bit (AMD64)]
    datamatrix 0.15.3
    qdatamatrix 0.1.31
    pseudorandom 0.2.2
    fileinspector 1.0.2
    QNotifications 2.0.6
    QOpenScienceFramework 1.3.1
    opencv 4.2.0
    expyriment 0.10.0+opensesame2
    IPython 7.12.0
    numpy 1.18.1
    scipy 1.3.1
    PIL/ PILLOW [version unknown]
    psychopy 2022.1.4
    pygame 1.9.6
    pygaze 0.7.5a5
    pyglet 1.5.0
    PyQt 5.12.3
    serial 3.4
    markdown 3.2.1
    yaml 5.3
    


    Thank you and best regards,

    Pablo

  • Hi @pbe ,

    There are a few separate topics intermixed here:

    RuntimeError: module compiled against API version 0xe but this version of numpy is 0xd

    This error is harmless. When an experiment crashes and you see this error, it is tempting to draw a causal link. But trust me, there is none!

    Also in this regard, I think it could be useful for beginners like myself to see a note in the beginner tutorial or/and in the GUI regarding two settings in Tools --> Preferences; namely, 'Run experiments in a separate process (multiprocess)' (which by default is 'inprocess')

    This refers to whether an experiment is started in the same process as the GUI (inprocess) or a separate process (multiprocess). The default is actually multiprocess (not inprocess), and this is also preferred. The inprocess runner is mainly there for debugging purposes and historical reasons.

    and 'Start inprocess kernel'.

    This refers to whether the Jupyter/ IPython console connects to the same process as the GUI. This is only useful for developers, because it allows you to programmatically interact with the insides of OpenSesame.

    After setting both these options, I no longer see the above error or others that I used to see, like the following one:

    This seems like a bug in OpenSesame; it hass something to do with transferring objects from one process to the next, but the details aren't clear from the error message. Could you provide a minimal example that triggers the issue, plus a clear description of the circumstances under which it happens?

    — Sebastiaan

  • Hi @sebastiaan,

    Thank you very much for the clarifications.

    I've unchecked the Start inprocess kernel box. The two errors I mentioned—i.e., RuntimeError and AttributeError—are not appearing anymore. Although I don't know the reason for this great change, my only guess is my recent switch from inprocess to multiprocess in the Running experiments section in Preferences. For some reason, I had inprocess activated (perhaps after scrolling through the dropdown).

    Even though these errors are gone, I attach the experiment.

    The AttributeError I pasted above was related to a selection of a stimulus file based on an input in a form called 'select_language'. That is, at the beginning of the experiment, a form appears that allows the selection of a value, which is then used to select a stimulus file with the code: stimuli/Norway study, [language], Session1_Experiment_gender_number_agreement, [list].csv. The AttributeError did not appear every time but only sometimes. Fortunately, I've now had several runs without a glitch.

    Thanks a lot for your help


Sign In or Register to comment.