| Reference | Downloads | Github

Compiling PsychoPy Experiments with something like Nuitka

Hello All,

I was wondering if anyone had been able to compile a psychopy experiment using a python compiler such as Nuitka. Ultimately, I would like to be able to send an experiment in a single executable file that does not rely on the new host computer having all of the dependencies installed. I have played around a bit with Nuitka this holiday season, and get quite a few warnings like the following:

Nuitka:WARNING:/Users/USERNAME/anaconda/envs/py27/lib/python2.7/site-packages/bs4/builder/ Cannot find 'html5lib.constants' in package 'bs4.builder' as relative or absolute import.

Before it ultimately fails with an assert error:

AssertionError: <Node COMPILED_PYTHON_MODULE <'COMPILED_PYTHON_MODULE' with 'package': 'statsmodels', 'name': '__init__', 'filename': '/Users/xkrieg/anaconda/envs/py27/lib/python2.7/site-packages/statsmodels/'> 'package': 'statsmodels', 'name': '__init__', 'filename': '/Users/xkrieg/anaconda/envs/py27/lib/python2.7/site-packages/statsmodels/'>

Has anyone had any better luck with this type of project? I would be very interested in hearing any and all suggestions/solutions.

Wishing you the best,


I haven’t ever tried with nuitka. I have some experience compiling with py2exe and py2app and my experience is that, although these work well for simple things, they need a fair bit of effort for substantial projects with lots of dependencies (like PsychoPy). That’s why with the OSX Standalone PsychoPy there are lots of explicit dependent frameworks (that weren’t fully detected by py2app autodetection).

I keep recommending that people don’t try to compile the software into the experiment, just as you don’t try to package a word processor into each Word document.

1 Like

Hello Jon,

Thank you for the clarification. I was reading another thread (!topic/psychopy-users/2LnaxvV-xfM) from the old site that discussed having the standalone version on a USB with a shortcut that directs that version of psychopy to run the experiment file. I think that this solution would work just as well.