Adding external python modules in psychopy 2022 vs. 2021

OS (e.g. Win10): win10
PsychoPy version (e.g. 1.84.x): 2022.2.4
Standard Standalone? (y/n) Yes

Hi,

I have an experiment running under psychopy version 2021.2.1 where I grab data from a Luxonis USB camera using a python library they provide called depthai. My way of making this library available in myPsychoPy (Builder) experiment is to create a local python environment (using anaconda) that matches the python version used by psychopy 2021.1.2 (which is 3.6), importing depthai into that conda environment using pip, and then adding the site-packages directory to psychopy’s python search path via Preferences:General:paths. This has worked fine. I would now like to do the same thing with the latest standalone psychopy (2022.2.4), which has python 3.8. So I followed the same process as before - creating a python 3.8 environment in anaconda, installing depthai to it, and adding the new site-packages path to Preferences:General:paths. But now, when I import depthai from within a code object in the Builder, I get an error message saying “ImportError: DLL load failed while importing depthai: The specified procedure could not be found”. I am able to import depthai from the anaconda python environment without error, so it appears it was installed properly.

My questions: do you have any idea why I might now be getting this error message with the latest PsychoPy Builder (and python 3.8)? I wonder if the way DLLs are searched and accessed in 3.8 might be different, and the depthai library is looking for specific libraries but either not finding them, or finding wrong versions of them (or something like this). And regardless of whether there’s a clear explanation for the error: is there another way you might recommend adding this library to my psychopy builder experiment?

Thanks very much - John

1 Like

Hi,

Just bumping this post from November. Thanks very much - John