Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Unable to run "sdl-config"" during Linux installation (e.g. Ubuntu 20.04+) #178

Open
lindemann09 opened this issue Sep 17, 2021 · 16 comments
Labels

Comments

@lindemann09
Copy link
Member

Installing Expyriment (i.e. Pygame<1.9) requires under Debian also the manual installation of the package: libfreetype6-dev .

Documentation should be updated.

@fladd
Copy link
Member

fladd commented Sep 17, 2021

We should see if we can easily switch to Pygame 2. I intended to make that switch only as part of the next major version (i.e. 1.0), but we might want to release a 0.11.0 that supports it already sooner.

@lindemann09
Copy link
Member Author

lindemann09 commented Nov 7, 2021

We should do that soon, because Expyriment is currently broken for Linux user. That is really bad.

@chrplr
Copy link
Contributor

chrplr commented Nov 7, 2021

My current workaround, for Ubuntu 20.04 LTS (using setup.py install from source, rather than pip install)
Expyriment seems to be working fine with pygame2.0.3, but I have not checked extensively to be able to confirm that it does not break anoything.

# install basic packages
sudo apt install git 
sudo apt install build-essential
sudo apt install libportaudio2 libportmidi-dev
sudo apt install  libsdl2-* 

# Expyriment

## Download and install Anaconda Python
wget https://repo.anaconda.com/archive/Anaconda3-2021.05-Linux-x86_64.sh
chmod +x Anaconda3-2021.05-Linux-x86_64.sh
./Anaconda3-2021.05-Linux-x86_64.sh 
conda update -n base -c defaults conda

## Expyriment environment
conda create -n expyriment python=3.8
conda activate expyriment
conda install ipython numpy pyopengl
pip install mediadecoder
pip install sounddevice
pip install pygame
mkdir git
cd git
git clone https://github.com/expyriment/expyriment.git
cd expyriment/
python setup.py install

# Checking expyriment
conda activate epxyriment
cd $HOME/git
git clone https://github.com/chrplr/PCBS.git
cd PCBS/experiments/expyriment/parity_decision
python parity.py

From my gist: https://gist.github.com/chrplr/61ec2de7f0e001ebf65aec89e6f6ddc9
(On MacOSX: we temporally install pygame1.9.6 to satisfy pip install expyriment, then force upgrade to pygame2 (https://pcbs.readthhttps://pcbs.readthedocs.io/en/latest/software-installation.html#the-pygame-and-expyriment-python-modulesedocs.io/en/latest/software-installation.html#the-pygame-and-expyriment-python-modules)

@chrplr
Copy link
Contributor

chrplr commented Nov 8, 2021

Coming back to the issue with sdl-config. It is due to the installation of pygame missing the libsdl*1.2-dev packages.

@chrplr
Copy link
Contributor

chrplr commented Nov 8, 2021

Pygame2 relies on sdl2, where everything under the hood is using opengl. Maybe the pyopengl code in expyriment would no longer be necessary to achieve the same performance (?)

@fladd
Copy link
Member

fladd commented Nov 8, 2021

It might be possible. I have not looked at Pygame/SDL 2 yet. We mainly need OpenGL for blocking on the vertical retrace. If this is now possible in Pygame 2 natively, then indeed we might be able to drop OpenGL.

@lindemann09
Copy link
Member Author

@fladd Have you had a look into it already? Would be great, if Exypriment is running again on Linux out of the box.

@chrplr
Copy link
Contributor

chrplr commented Mar 27, 2022 via email

@chrplr
Copy link
Contributor

chrplr commented Mar 27, 2022 via email

@lindemann09
Copy link
Member Author

@chrplr thanks a lot for your comments.

Yes, you are right we cannot say "expyriment is broken under Linux", just the pip installation is broken. It's just difficult to work with virtual environments, if you have to install pygame via apt. The upcoming version 0.11 should however solve all this issues.

@chrplr
Copy link
Contributor

chrplr commented Mar 28, 2022 via email

@fladd
Copy link
Member

fladd commented Mar 28, 2022

To be more precise, it seems to me that under Ubuntu, the issue occurs if one installs pygame with "pip install pygame" (which installs pygame2). Then one has the wrong libraries for SDL,... and dependency hell occurs ... Yet if one installs pygame with "apt install python3-pygame", 1.9.6 is installed with all the correct dependencies and "pip expyriment" works like a charm. (I have just installed it without problem on a pristine Ubuntu 20.04 distrib, following my own instructions at https://pcbs.readthedocs.io/en/latest/software-installation.html#instructions-for-linux-ubuntu-20-04 )

-- Christophe Pallier (http://www.pallier.org) INSERM Cognitive Neuroimaging Lab (http://www.unicog.org)
On Mon, Mar 28, 2022 at 3:38 PM Oliver Lindemann @.> wrote: @chrplr https://github.com/chrplr thanks a lot for your comments. Yes, you are right we cannot say "expyriment is broken under Linux", just the pip installation is broken. It's just difficult to work with virtual environments, if you have to install pygame via apt. The upcoming version 0.11 should however solve all this issues. — Reply to this email directly, view it on GitHub <#178 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALVWMVAQC76IEKYNSJEEGLVCGY6XANCNFSM5EG2A3QA . You are receiving this because you were mentioned.Message ID: @.>

While that is true for Debian-based distributions, other more "state-of-the-art" kind of distros (e.g. Arch) will most likely not have 1.9.6 available anymore.

The problem also extends to Windows and MacOS. Under Windows, for example, Pygame versions < 2 are only available for Python <= 3.7. For a recent Python 3.10 there is only Pygame 2 available (at least on PyPi).

@chrplr
Copy link
Contributor

chrplr commented Mar 28, 2022 via email

@chrplr
Copy link
Contributor

chrplr commented May 14, 2022

I am not sure if pygame2 will "save the day". Contrary to what I wrote above, it does not seem to always rely on opengl, and even when it does, it does not necessarily work as expected. The following tests of blocking on displya flip work fine with the current version of expyriment, while, (on my computer at least) the pure pygame version (using pygam 2.1.2) does not block on vsync.

tearing_tests.zip

@fladd
Copy link
Member

fladd commented Jun 14, 2022

Indeed, Pygame will not block on the vertical retrace. I think the idea there is merely to enable vsync (i.e. internally, the video card will only update when it is at the left top corner, so you shouldn't see tearing, but it will not block, i.e. the reported times are meaningless). It should be comparable to our current OpenGL mode 1, and we could think about changing this mode to not use OpenGL.

@fladd
Copy link
Member

fladd commented Jun 14, 2022

@lindemann09 Is the package libfreetype6-dev still needed under Debian with Pygame2?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants