Installing PsychoPy on Windows and macOS is pretty straightforward, because there are standalone installers for these platforms. However, installing PsychoPy on Linux has been rather difficult, and this topic has been brought up several times here and on GitHub. I just wanted to mention that Flatpak could very well be the solution to all Linux installation-related problems. PsychoPy could be installed on dozens of Linux distributions and would “just work”.
Note that I am aware that creating a Flatpak is probably a decent amount of work, so someone needs to find the time to do it. But given that Linux has many advantages over Windows (such as being open-source, more lightweight, having control over background processes, etc.), maybe this could be a worthwile undertaking (the official Python building guide could be a good starting point).
Thanks for the headsup @cbrnr
With similar hopes, thoughts and desires we tried (and failed) with Snap. My recollection of the issue was to do with snap packaging particular versions of the libs (notably those used by wxpython) and these were often not compatible with the system on which the snap was installed.
So I guess the question is how far Flatpack differs from Snap. And the biggest issue is likely to be getting wxpython to package correctly
In the meantime, the good news for linux users is that
- PsychoPy code is now fully operational with Py 3.10 (which is what ubuntu now packages) so all you need to do is create a venv and the python is ready
- wxpython does ship with wheels for Py3.10 and most flavours of linux (but you need to fetch it from the URL before installing)
- we moved a fair amount of functionality out to plugins so that the “required” dependency list is shorter (if I recall that’s something you wanted)
I don’t have any experience with Flatpak, but from what I’m hearing it’s what all distributions (except Ubuntu) have adopted, and it seems to be working pretty great. I’d expect that different versions should be supported via runtimes, but someone would have to actually try that.
It’s great to hear that PsychoPy works with pip, and BTW, I’ve also had success running it on Python 3.11 (the default Python in many distributions). And yes, I was strongly in favor of outsourcing functionality - very nice !
I’ve actually found a way to avoid having to download and install the appropriate wxpython wheel if you use
--system-site-packages when creating the venv. I think this makes the whole process even easier, because system wxpython (installed via apt/dnf/pacman/…) will automatically be picked up by the venv:
- Install wxpython with system package manager
- Create venv with
- Inside venv,
pip install psychopy
Optionally, some systems might need specific packages like
libX11-devel on Fedora, but this is not too hard to find out (and in many cases, all packages are already installed).
In any case, a Flatpak app would be equivalent to the Windows and macOS stand-alone installers, so maybe still worth a try, because it will work without any additional steps by the user.
I just tried installing on an ubuntu VM with
sudo apt install python3-wxgtk4.0. One issue is that this is out of date (wxpython is now v 4.2.1) and also it seems not to have support for the wx.html2 module which we need.
It feels like downloading the wheel manually for the specific linux flavour, and installing that, is the better approach for now
Yeah, I don’t use Ubuntu. Arch and Fedora have current packages which also support
wx.html2 support for Ubuntu is available in
libwebkit2gtk (or some similar name, not entirely sure). But yes, pip installing the wheels from wx is also pretty easy!