Everyone is welcome here (except, of course, those who have borrowed books from me for and have not returned them yet 😉)

Installing a Linux workstation with psychtoolbox, psychopy, expyriment

Posted on novembre 05, 2021 in computer-science

These instructions have been tested on Ubuntu 20.04 LTS focal

install basic packages

sudo apt update
sudo apt upgrade -y
sudo apt-get install linux-lowlatency
sudo apt install vim emacs git mc tmux openssh-server htop
sudo apt install build-essential
sudo apt install octave
sudo apt install libportaudio2 libportmidi-dev
sudo apt install  libsdl2* libsdl1.2* libfreetype6-dev


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
conda update -n base -c defaults conda

Expyriment environment

sudo apt-get install build-essential libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libsdl1.2-dev libsmpeg-dev libportmidi-dev ffmpeg libswscale-dev libavformat-dev libavcodec-dev libfreetype6-dev
conda create -n expyriment python=3.8
conda activate expyriment
conda install ipython numpy pyopengl
pip install mediadecoder
pip install sounddevice
pip install expyriment[all]

If pip install experiment[all] fails, try:

mkdir ~/git
cd ~/git
git clone https://github.com/expyriment/expyriment.git
cd expyriment/
python setup.py install

Checking expyriment

conda activate expyriment
cd ~/git
git clone https://github.com/chrplr/PCBS.git
cd PCBS/experiments/expyriment/parity_decision
python parity.py

Setup blocking on vertical synchro for AMD RADEON gpu

sudo apt install xvattr
echo "export vblank_mode=3" > /etc/profile.d/radeon.sh
cd ~/git/PCBS/experiments/expyriment
python tearing-test.py

Note: for nvidia GPU, see https://learn.foundry.com/hiero/current/content/timeline_environment/usingviewer/synching_vblank.html


sudo apt-get install libusb-1.0-0-dev portaudio19-dev libasound2-dev
sudo add-apt-repository 'deb http://archive.ubuntu.com/ubuntu bionic main universe'
sudo apt install -t bionic libwebkitgtk-1.0-0
wget https://raw.githubusercontent.com/psychopy/psychopy/master/conda/psychopy-env.yml
conda env create -n psychopy -f psychopy-env.yml
conda activate psychopy
conda install ipython numpy




Add Neurodebian repository

Select the neurodebian repository on Neurodebian, and copy the command lines, e.g.:

wget -O- http://neuro.debian.net/lists/focal.de-m.full | sudo tee /etc/apt/sources.list.d/neurodebian.sources.list
sudo apt-key adv --recv-keys --keyserver hkps://keyserver.ubuntu.com 0xA5D32F012649A5A9

activate sources and install required packages

sudo sed -Ei 's/^# deb-src /deb-src /' /etc/apt/sources.list
sudo apt update

sudo apt build-dep octave-psychtoolbox-3
sudo apt install subversion libdc1394-22-dev libfreenect* libgstreamer1.0-dev libgstreamer-plugins-*

download psychtoolbox

wget https://raw.github.com/Psychtoolbox-3/Psychtoolbox-3/master/Psychtoolbox/DownloadPsychtoolbox.m.zip
unzip DownloadPsychtoolbox.m.zip

mkdir ~/PTB3

> DownloadPsychtoolbox('/home/neurostim/PTB3')
> PsychLinuxConfiguration()

> # test 
> DrawingSpeedTest()