Definitive guide to installing PsychToolbox with MATLAB on Ubuntu?

hi, i'm attempting to setup a Linux/MATLAB/Psychtoolbox system for the very first time (on a 2011 MacBook Pro with OS X 10.9.4).


i have searched the interwebs and found various bits and pieces of information, but so far i haven't been able to locate a single coherent up-to-date method.


stumbling around in the semi-dark, so far i have:

  • installed Ubuntu 14.04 LTS 64 bit into a Parallels VM (just for convenience at this stage, once i am familiar with the method i will create a new physical machine on another volume)
  • installed a low-latency kernel with: sudo apt-get install linux-lowlatency
  • installed MATLAB 2014a 64 bit
  • installed freeglut using: sudo apt-get install freeglut3-dev
  • added the NeuroDebian repo to the package apt package management system
  • installed the Psychtoolbox using: sudo apt-get install octave-psychtoolbox-3
  • i also installed the psychtoolbox-common, -lib, and -dbg packages using apt (although i have no idea if these are strictly necessary)
  • added /usr/lib/psychtoolbox-3 to the MATLAB path
  • added /usr/share/psychtoolbox-3 to the MATLAB path

if i attempt to run Screen i get this error message:


In place of the expected mex file this placeholder file was executed:

  Screen

This mex file seems to be missing or inaccessible on your Matlab path or it is dysfunctional:

  Screen.mexa64

Hmm. I cannot find the file on your Matlab path?!?

One reason could be that your Matlab path is wrong or not up to date
for the current Psychtoolbox. You may want to run SetupPsychtoolbox to
fix possible path problems.


however SetupPsychtoolbox does not exist in the distro. nor does Screen.mexa64 as far as i can see.


the other packages that the error output of AssertOpenGL mentions (the USB and 1394 libs) appear to come installed with Ubuntu by default.


at this point as a Linux noob i'm not sure what to do next, and i'd rather not semi-randomly install packages with my fingers crossed...


any helpful hints would be much appreciated!






---In psychtoolbox@yahoogroups.com, <microfish@...> wrote :

hi, i'm attempting to setup a Linux/MATLAB/Psychtoolbox system for the very first time (on a 2011 MacBook Pro with OS X 10.9.4).


i have searched the interwebs and found various bits and pieces of information, but so far i haven't been able to locate a single coherent up-to-date method.


Ja, because there isn't any atm. Everything is in transition as always, even our Wiki is in transition...


stumbling around in the semi-dark, so far i have:

  • installed Ubuntu 14.04 LTS 64 bit into a Parallels VM (just for convenience at this stage, once i am familiar with the method i will create a new physical machine on another volume)

-> Just to be clear: PTB will not work in any meaningful way inside a VM. That's just one abstraction layer between the true hardware/os and ptb too much. And timing goes out of the window inside a VM. If it detects it is running in a VirtualBox VM, it will enter some compat mode to at least limp along for basic testing - i'm compiling inside VM's, so i need that. On other VM's you'll likely stumble from one sync failure or timing problem to the next.

  • installed a low-latency kernel with: sudo apt-get install linux-lowlatency

-> Good.

  • installed MATLAB 2014a 64 bit

-> Good. Although you should probably give octave a good try. Since 14.04-LTS, octave 3.8.1 ships. It has a reasonably working GUI, so if you don't need special Matlab toolboxes, GUI programming, or classdef object oriented programming, octave might be good enough. I essentially only work in octave by now and fire up Matlab only for final compilation/testing of PTB before a release.

  • installed freeglut using: sudo apt-get install freeglut3-dev

-> Don't need this if you use NeuroDebian repos. They will auto-install anything needed.

  • added the NeuroDebian repo to the package apt package management system
  • installed the Psychtoolbox using: sudo apt-get install octave-psychtoolbox-3

-> Good. Now you have everything you need to run "octave --force-gui", fire up octave and use PTB. The only thing you should probably do is run PsychLinuxConfiguration once, follow its instructions and then reboot the machine once. It will allow realtime scheduling and enable access to various hardware, e.g., CRS and VPixx equipment, etc. without the need to run the software as system adminstrator. Ok, unless you're in a Virtual machine. Then running that script is pointless.

  • i also installed the psychtoolbox-common, -lib, and -dbg packages using apt (although i have no idea if these are strictly necessary)
  • added /usr/lib/psychtoolbox-3 to the MATLAB path
  • added /usr/share/psychtoolbox-3 to the MATLAB path

-> These 3 steps are not needed, Neurodebian will have set this up already.


However, now you've only installed mex files for octave, not for Matlab. If you do a


sudo apt-get install matlab-psychtoolbox-3


it will also get all Matlab specific stuff. It won't add PTB to the Matlab path though. There's some wrapper command "ptb3-matlab" you can call which will start Matlab with the path added during that session, or you add the path manually. See the following page, which is not advertised on NeuroDebians software list, because they don't like to advertise use of proprietary software like Matlab - they see it as a "neccessary evil" / stop-gap measure until all Matlab toolkits have been perfectly ported to octave:


matlab-psychtoolbox-3 – toolbox for vision research – Matlab bindings — Debian Neuroscience Package Repository


Then it should likely work, although i always overlook something.


There are optional packages matlab-psychtoolbox-nonfree and octave-psychtoolbox-nonfree. These contain the mex files for Eyelink and Datapixx. In the case of Datapixx this is just historical, it doesn't need to be in a "non-free" package, as its code is open-source. In case of Eyelink this is because it requires SR-Research's proprietary runtime libraries.


Ok, further stuff related to graphics drivers, once you actually run on real hardware:


"help SyncTrouble" explains in a Linux specific section how to setup the graphics drivers optimally for good timing precision.


Graphics driver recommendations:


On a Intel gpu, use the open-source drivers. Well there aren't any other drivers, so obviously you use those. But they are of better quality for vision science applications than the drivers on OSX (bearable) or Windows (disaster) anyway. Obviously you'll need a recent Intel gpu for good performance, old Intel parts are just not good enough for most vision science apps.


On a AMD gpu, use the open-source drivers. They have many goodies for vision science applications. If those don't work for your specific graphics card, you can install AMD's proprietary Catalyst drivers and hope for the best while expecting the worst. They have a bit higher absolute performance, but lack all the cool vision science bonus features and have more bugs, ie., they are just as bad as on MS-Windows or to some degree on OSX.


On a NVidia gpu, i'd usually say the same as on AMD. Try the open-source driver, back off to the NVidia proprietary driver if the oss driver doesn't work well. Except that the NVidia proprietary driver is usually of very good quality, and the oss driver is pretty much unuseable for vision science in Ubuntu 14.04-LTS. We are working on fixing those bugs, so the oss driver "nouveau" should be a good choice again in the future, but this is still ongoing work.


In general, the open-source drivers are a good initial pick. They work well on most hardware, don't require any installation, and i'm working with the developers on these drivers, so they have a couple of cool bonus features and improvements for vision science applications. If those are not good enough, because you encounter a bug or limitation on your specific hardware/for your specific task, there are the proprietary drivers from NVidia and AMD as a backup solution, which are as good as or better than what you get for Windows or OSX in the case of NVidia, and equally bad as what you get on Windows or OSX in the case of AMD.


What else? Choice of desktop environment. Ubuntu's default desktop "Unity" works well for single display setups, and not great at all (in 14.04) for multi-display. Other desktops you can install like KDE, GNOME-2, GNOME-3, ... work well in multi-display configs.


Then there's the issue of screens:


If you use all your displays for fullscreen stimulus presentation on all attached displays on PTB screen 0 aka x-screen 0, everything is fine.


If you need a separate PTB screen (aka x-screen) for stimulus and Matlab/Octave GUI, then extra configuration is needed. The forum contains bits and pieces about creating custom "xorg.conf" files for that.


Multi-display handling on Linux is different from the other os'es, well it's different on each os, but you usually don't notice this if you only work on one os.


That for a starter, oh and welcome to a better world - at least on average, and in the long-run, even if it doesn't feel to you like that so far :)

-mario



if i attempt to run Screen i get this error message:


In place of the expected mex file this placeholder file was executed:

  Screen

This mex file seems to be missing or inaccessible on your Matlab path or it is dysfunctional:

  Screen.mexa64

Hmm. I cannot find the file on your Matlab path?!?

One reason could be that your Matlab path is wrong or not up to date
for the current Psychtoolbox. You may want to run SetupPsychtoolbox to
fix possible path problems.


however SetupPsychtoolbox does not exist in the distro. nor does Screen.mexa64 as far as i can see.


the other packages that the error output of AssertOpenGL mentions (the USB and 1394 libs) appear to come installed with Ubuntu by default.


at this point as a Linux noob i'm not sure what to do next, and i'd rather not semi-randomly install packages with my fingers crossed...


any helpful hints would be much appreciated!



thanks Mario, that is a very useful condensation of info.

sadly i haven't got much further though, as this happened:

sudo apt-get install matlab-psychtoolbox-3
Reading package lists... Done
Building dependency tree      
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 matlab-psychtoolbox-3 : Depends: matlab-psychtoolbox-3-nonfree (= 3.0.11.20140705-1~nd+1) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

and if i then try:

sudo apt-get install matlab-psychtoolbox-3-nonfree
Reading package lists... Done
Building dependency tree      
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 matlab-psychtoolbox-3-nonfree : Depends: libglew1.9 but it is not installable
                                 Recommends: libfreenect0.1 but it is not installable
E: Unable to correct problems, you have held broken packages.

octave-psychtoolbox-nonfree does install fine though.

i gather that i may now be able to get a working MATLAB install by now running DownloadAdditionsForLinux(), however it would make more sense to me to get it all working using NeuroDebian packages via apt.

i suppose i now need to ask the NeuroDebian people for help...

as far as a 'better world' goes i hear you, however it has been pretty frustrating so far (and i started off with BSD Unix and dumb terminals back in the day)...

in general, do you recommend the NeuroDebian installation method over the DownloadPsychtoolbox.m method?
Octave and the Psychtoolbox do already appear to be playing nicely together, which is a win.

but i do still really need MATLAB for the time being at least...



---In psychtoolbox@yahoogroups.com, <microfish@...> wrote :

thanks Mario, that is a very useful condensation of info.

sadly i haven't got much further though, as this happened:


sudo apt-get install matlab-psychtoolbox-3
Reading package lists... Done
Building dependency tree      
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 matlab-psychtoolbox-3 : Depends: matlab-psychtoolbox-3-nonfree (= 3.0.11.20140705-1~nd+1) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

... snip ...

This is now fixed in NeuroDebian. I just tried it on my Ubuntu 14.04-LTS -> works.


>i gather that i may now be able to get a working MATLAB install by now running >DownloadAdditionsForLinux(), however it would make more sense to me to get it all working using >NeuroDebian packages via apt.

DownloadAdditionsForLinux is only for old Linux distros, not needed on recent ones or when installing from NeuroDebian directly. "help DownloadAdditionsForLinux" actually explains to use matlab-psychtoolbox-3, however, our Wiki's download instructions are still a bit outdated and don't mention that.

>i suppose i now need to ask the NeuroDebian people for help...

Response times way < 24 h, if that isn't good.

> as far as a 'better world' goes i hear you, however it has been pretty frustrating so far (and i started off > with BSD Unix and dumb terminals back in the day)...

Well, you have made 1 mistake during installation due to our unclear docu, and 1 due to a packaging bug. That happens all the time on the other os'es as well.



>in general, do you recommend the NeuroDebian installation method over the DownloadPsychtoolbox.m method?
 
Yes. For octave that's super easy and you get everything custom built for your specific distro. For matlab (when it works, which it usually does) you still have the advantage that it automatically installs all required libraries etc., tweaks Matlab properly etc. In both cases you get automatic software updates, etc. ND's releases typically happen within a week of a ptb release.

Functionality wise, for Matlab it's a tie, as NeuroDebian just ships the same mex files as the one we provide. They don't do the custom built and optimized files as they do for octave.

But one bonus for me is that NeuroDebian does additional testing on each release which i don't do. And having an octave based system up and running with one single apt-get command is just cool. You can even do things (for quick hardware compatibility testing) as boot a Ubuntu live dvd from dvd or a usb stick, do that one or two line octave-psychtoolbox-3 install and run a mostly functional system without any installation on the disc drive at all.

Btw. if you need to install on multi-display setups for multi-display stimulation, it can make sense to start with a KUbuntu-14.04 LTS or GNOME-3, or whatever based flavor, or some other flavor than Ubuntu-14.04 LTS. These distro spin-offs are identical functionality wise, but come with a different desktop environment than Unity installed by default, saving the hassle of manually installing KDE or GNOME or such if one need solid multi-display visual stimulation.

-mario


On Thu, Aug 7, 2014 at 2:52 PM, microfish@... [PSYCHTOOLBOX] <PSYCHTOOLBOX@yahoogroups.com> wrote:
now if only there was a nice SourceTree-like git interface for Linux...


have you tried smartgit? free for non-commercial use