Problems installing PTB on Linux

The NeuroDebian site is not working so I cannot install PsychToolbox. The line “After selecting a release the setup code will be shown here.” is not being replaced with the needed commands after selecting the OS release. There is a post about this on the NeuroDebian listserve dated Aug 26th but there has been no response. I guess the maintainer is on vacation or something.

So now I’m trying a manual download of the .zip file and then ran the command SetupPsychtoolbox in the Matlab command window per the PTB instructions. I was able to download the file but it asked for a license even though I’m running it on Ubuntu and not Mac or Windows. Has the licensing requirements changed?

I went ahead and accepted the 14 day trial as I am scheduled to start running experiments Monday. The instructions indicated I needed to use the Terminal command sudo apt build-dep psychtoolbox-3 but I got the error message that “You must put some ‘deb-src’ URIs in your sources.list”.

Any suggestions?

Joe

Joe

The solution posted at apt - Error :: You must put some 'source' URIs in your sources.list - Ask Ubuntu solved the deb-src problem. On Ubuntu, I went to the software updates GUI and clicked on “source code” and closed the GUI. After that the udo apt build-dep psychtoolbox-3 command worked.

1 Like

Ran into new error message of Cannot initiate the connection to in.archive.ubuntu.com:80 when performing sudo apt build-dep psychtoolbox-3. The solution was provided at "Cannot initiate the connection to in.archive.ubuntu.com:80" when trying to run "sudo apt-get update" behind proxy - Ask Ubuntu , which was to change the Software Update setting from “server for the US” to “main server”.

New problem is that Matlab command window now comes up as a blank white square after running the PsychLinuxConfiguration script. Rebooted computer but still blank. Tried several times, no good. Google AI suggested using the Terminal with “matlab -cefdisablegpu”. It worked! I googled and couldn’t even find where it got this idea! Anyway, even more strangely, it fixed the problem. I can start Matlab even from the symbolic link without needing this option any more. No idea what is going on. Yet more funky behavior by Matlab2025a’s new graphics engine I am guessing.

1 Like

I’m also getting error messages from apt about neurodebian’s public key being invalid, so neurodebian seems to be completely off-line, at least for now.

For context, I’m trying to install PTB 3.0.22.1 on Ubuntu 24.04.3 dual boot with Windows 11 with Matlab R2025a Release 1 on a Dell Optiplex 7090 with 16GB RAM and an Nvidia GeForce GTX 1660 SUPER video card (tried a Radeon W5700 video card last year but it didn’t work. hoping it might work this time, once I’ve got everything else working).

Running a PTB test script, received error message about a “Mesa OpenGL software renderer is active” that terminated it. Am changing from the proprietary nvidia proprietary driver to the nouveau open source driver by using the Terminal command apt-get purge nvidia* and rebooting. Terminal commandsudo lshw -c video shows success.

The Matlab command window is blank again and matlab -cefdisablegpu did not help. Following another google AI suggesion, resetting matlab preferences by changing ~/.matlab/R2025a to R2025a_old so that it would create new directory fixes the Matlab problem.

New PTB error with the test script:

PTB-ERROR: You are trying to run a Screen() implementation meant only for a native XOrg X-Server
PTB-ERROR: under a XWayland fake X-Server, on top of a Wayland desktop GUI session. This is not
PTB-ERROR: supported, as XWayland has various bugs which would make Psychtoolbox hang/malfunction!
PTB-ERROR:
PTB-ERROR: Please resolve this issue now, by logging out of your desktop session and then logging in
PTB-ERROR: again while choosing a classic X11/XOrg GUI, which uses a suitable native XOrg X-Server.
PTB-ERROR: On Ubuntu Linux, there is usually a drop-down session chooser on your login screen (e.g.,
PTB-ERROR: reachable by clicking onto a little gear icon in the bottom-right corner of the screen),
PTB-ERROR: which offers options with (X11) or (Xorg) in its name, e.g., “Plasma (X11)” or
PTB-ERROR: “Ubuntu on Xorg” or “GNOME on Xorg”. These would be the right choices.
PTB-ERROR: If you really know what you are doing and absolutely want to force running under XWayland
PTB-ERROR: you could execute “clear all; setenv(‘WAYLAND_DISPLAY’); Screen(‘Preference’,‘ConserveVRAM’, 2^19);”
PTB-ERROR: and then retry. This may malfunction or hang in various ugly ways, you have been warned!

1 Like

Followed these instructions by logging back in with x11 option. Despite still having nouveau driver active according to sudo lshw -c video, got the message again:

PTB-WARNING: Seems that a Mesa OpenGL software renderer is active! This will likely cause miserable
PTB-WARNING: performance, lack of functionality and severe timing and synchronization problems.
PTB-WARNING: Most likely you are running Psychtoolbox on a Matlab version 8.4 (R2014b) or later and
PTB-WARNING: Matlab is causing this problem by overriding your operating systems OpenGL library with
PTB-WARNING: its own outdated software library. Please run the setup script PsychLinuxConfiguration()
PTB-WARNING: now from your Matlab command window and then quit and restart Matlab to fix this problem.

Given that nouveau is in fact an openGL mesa driver, I guess the question is why it seemed to work at one point.

To avoid risk of forgetting to use x11 option when logging in, Changed the default back to x11 by editing the etc/gdm3/custom.conf file to set the wayland flag to false.

https://linuxconfig.org/how-to-enable-disable-wayland-on-ubuntu-20-04-desktop

Matlab window went blank again. Had to reset matlab preferences folder again.

Have been encouraged to try Octave to deal with at least some issues and also because PTB not charging license with Octave.

https://wiki.octave.org/Octave_for_Debian_systems

sudo apt-get install octave sudo apt-get install octave-doc (octave-info and octave-htmldoc and octave-dbg resulted in error messages)

sudo apt-get install octave-control octave-image octave-io octave-optim octave-signal octave-statistics

This resulted in an old version: 8.4.0

AppCenter version is likewise several years out of date.

https://flathub.org/setup/Ubuntu

sudo apt install flatpak

flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo

sudo apt install gnome-software-plugin-flatpak

reboot

Desktop icon at: /usr/share/applications/org.octave.Octave.desktop

The 8.4.0 version is at /usr/bin/octave

simply clicking on the install button at https://flathub.org/en/apps/org.octave.Octave

or download the .flatpakref file did no good.

Clicking on the popup menu button next to the Install button brought up the commands:

flatpak install flathub org.octave.Octave

flatpak run org.octave.Octave --gui

worked! Running octave 10.2.0

edited /usr/share/applications/org.octave.Octave.desktop

that was installed by the 8.4.0 version so that it had the line:

Exec=flatpak run org.octave.Octave –gui

then rebooted. Now runs the 10.2.0 version.

SetupPsychtoolbox

PTB warns 10.2.0 Octave is too new!
Will go back to 8.4.0

Changing .desktop file back.

Even after rebooting, still starting up 10.2.0 version.

Calling it a day.

Uninstalling Octaves:
flatpak list –app
flatpak uninstall --delete-data org.octave.Octave
flatpak uninstall –unused

sudo apt-get remove octave
apt-get remove octave-doc

Installing Octave 7.1.0 via Ubuntu’s App Center.

SetupPsychtoolbox

ERROR: WaitSecs-MEX does not work, most likely other MEX files will not work either.
ERROR: One reason might be that your version 7.1.0 of Octave is incompatible.
ERROR: Another conceivable reason would be missing or incompatible required system libraries on your system.

ERROR: After fixing the problem, restart this installation/update routine.

Installation aborted. Fix the reported problem and retry.

Using App Center to uninstall Octave 7.1.0

https://www.geeksforgeeks.org/linux-unix/how-to-install-gnu-octave-in-linux/

sudo apt-add-repository ppa:octave/stable

sudo apt-get update

sudo apt-get install octave octave Command line Octave 8.4.0 octave –gui Octave gui starts up with 8.4.0

SetupPsychtoolbox

worked!

Was getting error messages about help files when starting up Octave.

Fixed Octave error messages by installing sqlite.

https://bugs.launchpad.net/ubuntu/+source/octave/+bug/1924836

https://www.howtoinstall.me/ubuntu/18-04/libqt5sql5-sqlite/

sudo apt install libqt5sql5-sqlite

Most simple solution is of course to just use the Octave 8.4 that is shipping with Ubuntu 24.04.3 LTS by default, not some random builds from random sources. Or Matlab R2024b and earlier if you don’t want to deal with current limitations and apparent teething issues of R2025a. But R2025a has been successfully tested on Ubuntu 24.04-LTS with the latest PTB 3.0.22.1, which contains various compatibility enhancements to deal with some of R2025a’s issues. I think the sometimes frozen or all white GUI of R2025a has nothing to do with PTB, but just with teething issues of R2025a and its brand-new GUI implementation.

When I did sudo apt-get install octave it didn’t say it was already installed. I got the usual messages about how much it was downloading and asking for my consent. From what I gather on the internet, it’s not part of the default ubuntu install. I’m using a vanilla Ubuntu 24.04.3 install. Anyway, appreciate the guidance. Perhaps it could be added to the PTB installation instructions? Definitely agree about 2025a having teething issues! I’m putting in everything I am encountering in the hope that it might be helpful to readers, regardless of where the issues arise from and to solicit helpful advice like your own. Thanks!

Joe

Trying to get RTBox to work with PTB. The built-in function are not working with either Matlab or Octave.

handle = PsychRTBox(‘Open’)
warning: implicit conversion from numeric to char
warning: called from
WrapString>onewrap at line 65 column 8
WrapString at line 53 column 21
PsychRTBox>RTboxError at line 3132 column 5
PsychRTBox>openRTBox at line 2884 column 9
PsychRTBox at line 767 column 9

error: PsychRTBox:noUSBserial No connected USB-Serial devices found. Is your device connected and the
USB-Serial driver properly installed?
error: called from
PsychRTBox>RTboxError at line 3132 column 5
PsychRTBox>openRTBox at line 2884 column 9
PsychRTBox at line 767 column 9

The RTBox drivers also are not working with this configuration. I contacted the RTBox developer and he sent me an updated Octave driver that fixed the problem the very next day! He’s still working on getting the Matlab driver working.

Interestingly, when I look in /dev, none of the device names are ttyusb, as one would have expected. As long as the new RTBox octave mex code is working, won’t worry about it, but it does suggest something funky is happening here.

Moving on to trying to get the Matlab 2023b experiment script working on Octave 8.4.0. Three issues thus far. The first is that the name "info" is apparently reserved, so had to rename a variable by this name. The second is that, unlike Matlab, it is not possible to call a function in a script until it has been defined. It was necessary to move the function definitions to the top of the script. Furthermore, if the very start of the script is a function definition, then Octave thinks it is a function file instead of a script. It is therefore necessary to have some kind of command, in this case a=1, at the very beginning. It is of course necessary for the function definitions to end with an "end" statement, whereas in matlab they can defined with or without a concluding "end" statement, as long as the practice is consistent within the file.

https://savannah.gnu.org/bugs/?56187

The third is that bitand does not allow the specification of an integer type like int16 and bitshift the integer type is specified as a number of binary digits like 16 rather than as an integer type like int16.

An issue on both Matlab2025a and Octave8.4.0 is that getChar no longer seems to work properly. It is not exiting upon button presses, so it is now necessary to CTRL-C. No idea whether this is due to changes in PTB, Linux, or Matlab/Octave.

Have altered code to use KbWait instead. Strangely, while at first the left shift was reported to be "Shift_L" by KbName, later on it was reported to be "LeftShift" after I ran the full script. Something about PTB's initializations may have changed the code somehow.

I found that the library for the RTBox libftd2xx.so.1.4.22 is working with Octave 8.4.0 (perhaps because both are a few years old) and libftd2xx.so.1.4.33 is working with Matlab 2025a (perhaps because both are the most recent versions) when using the RTBox commands like RTBox(‘info’).

Have had issues with stimuli timing. We run with mirrored monitors, one inside the booth and one outside for the experimenters. With the iGPU that comes built-in on the motherboard (CometLake-S GT2 [UHD Graphics 630]) if the booth monitor was a 240Hz Viewsonic and the outside booth was a generic 60Hz monitor, either the booth monitor was forced to run at 60Hz by Linux or it would for some reason allow it to run at 240Hz but then PTB would be unable to run. Once the outside monitor was also a 240Hz Viewsonic, then things ran fine, albeit with a 5% flip timing error rate. As the PTB website warns, using an NVIDIA video card (GeForce GTX 1660 SUPER) resulted in messages that the flipping system was failing. Switching to an AMD Radeon W5700, the monitors did not even display successfully. Dell support suggested that this video card might not work with the Optiplex computer. Apparently you have to call them up to confirm whether a given video card works with the computer you are using. We tried an AMD Radeon 550X, which has been reported on the forum to work with PTB, but although we found that it did indeed work with the Optiplex to drive the monitors, we get messages from PTB of total flip failure:

PTB-WARNING: Flip 1017 for window 10 didn't use pageflipping for flip. Visual presentation timing and timestamps are likely unreliable!

PTB-WARNING: Something is misconfigured on your system, otherwise pageflipping would have been used by the graphics driver for reliable timing.

PTB-WARNING: However, if you see this message only sporadically, this might be caused by onscreen popup messages a la "You have new mail!" or

PTB-WARNING: "New updates are ready to install" etc. Being low on free system memory can cause this as well, especially on integrated graphics chips.

PTB-WARNING: Read the Linux specific section of 'help SyncTrouble' for some other common causes and fixes for this problem.

PTB-WARNING: Couldn't even collect one single valid flip interval sample! Sanity range checks failed!

PTB-WARNING: Could be a system bug, or a temporary timing problem. Retrying the procedure might help if

PTB-WARNING: the latter is the culprit.

I have confirmed that we are running x11 and amdgpu. So for now, we're just using the iGPU. It would be nice to get the 550X working, if anyone has any ideas.

That Intel iGPU seems possibly underpowered for driving 240 fps animations. Both AMD cards - well pretty much all AMD cards - should work. Maybe your Optiplex machine is very old and doesn’t have a strong enough power supply or similar for a modern card.

Pageflip failure sometimes happens after login on Ubuntu/GNOME desktop of Ubuntu 24.04-LTS due to some weird bug introduced into GNOME. Didn’t happen on older Ubuntu versions, or older or different desktop GUI environments. Clicking on the settings menu in the top-right corner to pop up the menu once usually fixes that problem for the remainder of the login session.

If you have two monitors connected on non-NVidia graphics cards like Intel or AMD, generally you can use XOrgConfCreator to enable AsyncFlipSecondaries Mode, which is specifically made for a dual-display experimenter + subject stimulation monitor. It enables proper timing and vsync for tearfree stimulation on one monitor (subject monitor) and tearing / slight flicker on the less important experimenter monitor. The higher resolution monitor is chosen as important proper timing monitor (the lower resolution experimenter monitor will show a cropped version of the high res subject monitor then), or in case of identical resolution, the “Primary output” setting can be used to define one monitor as primary monitor, e.g., maybe in the display settings gui, or via xrandr --output OUTPUTNAMEOFSUBJECTSTIMULATIONMONITOR --primary

If you have two completely identical monitors with identical settings connected via identical display connectors, e.g., two Displayport connectors, then on modern AMD cards, the driver may fully synchronize the displays by itself, reducing the chance of skipped frames, judder etc. On older AMD’s, Psychtoolbox has GraphicsDisplaySyncAcrossDualHeadsTestLinux to both test sync across displays, and to try to manually synchronize both displays well enough for good timing.

These features are unique to Linux and Psychtoolbox, and usually can get such setups to work well. On other operating systems or with other toolkits, mirror mode is usually the road to totally broken stimulation timing, often silently broken timing.

Also the PsychImaging tasks MirrorDisplayTo2ndOutputHead and MirrorDisplayToSingleSplitWindow can help to get the best out of mirrored setups.