AssertionError: XF86VidModeGetGammaRamp failed

I am new to PsychoPy, and when I run the command :

mywin = visual.Window([800,600], monitor=“testMonitor”, units=“deg”)

I get the error :

---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
<ipython-input-4-ec7d6c9c8373> in <module>()
      1 #create a window
----> 2 mywin = visual.Window([800,600], monitor="testMonitor", units="deg")

~/anaconda3/lib/python3.6/site-packages/psychopy/visual/window.py in __init__(self, size, pos, color, colorSpace, rgb, dkl, lms, fullscr, allowGUI, monitor, bitsMode, winType, units, gamma, blendMode, screen, viewScale, viewPos, viewOri, waitBlanking, allowStencil, multiSample, numSamples, stereo, name, checkTiming, useFBO, useRetina, autoLog, *args, **kwargs)
    387 
    388         # setup the context
--> 389         self.backend = backends.getBackend(win=self, *args, **kwargs)
    390         self.winHandle = self.backend.winHandle
    391         global GL

~/anaconda3/lib/python3.6/site-packages/psychopy/visual/backends/__init__.py in getBackend(win, *args, **kwargs)
     30                              "there is no backend definition to match that "
     31                              "winType.".format(win.winType))
---> 32     return Backend(win, *args, **kwargs)
     33 

~/anaconda3/lib/python3.6/site-packages/psychopy/visual/backends/pygletbackend.py in __init__(self, win, *args, **kwargs)
    225         # store properties of the system
    226         self._driver = pyglet.gl.gl_info.get_renderer()
--> 227         self._origGammaRamp = self.getGammaRamp()
    228         self._rampSize = getGammaRampSize(self.screenID, self.xDisplay)
    229         self._TravisTesting = (os.environ.get('TRAVIS') == 'true')

~/anaconda3/lib/python3.6/site-packages/psychopy/visual/backends/pygletbackend.py in getGammaRamp(self)
    327 
    328     def getGammaRamp(self):
--> 329         return getGammaRamp(self.screenID, self.xDisplay)
    330 
    331     @property

~/anaconda3/lib/python3.6/site-packages/psychopy/visual/backends/gamma.py in getGammaRamp(screenID, xDisplay)
    150             origramps[2, :].ctypes)
    151         if not success:
--> 152             raise AssertionError('XF86VidModeGetGammaRamp failed')
    153         origramps = origramps/65535.0  # rescale to 0:1
    154 

AssertionError: XF86VidModeGetGammaRamp failed

Any ideas on how to fix it?

My operating system is Ubuntu 18.04.3 LTS, and the kernel version 4.15.0-58-generic. I am using Python 3.6.4 and I have just installed PsychoPy using the command “pip install PsychoPy”. The version of pyglet is 1.3.0b1.

Thanks in advance for your precious help!

@djmannion any ideas what’s happening here?

That version of Ubuntu had driver problems with gamma handling with intel cards - see this issue. A workaround (described here) is to use the intel drivers instead.

1 Like

Another option, since PsychoPy 3.2.0, is to set gammaErrorPolicy="ignore" when opening the window. That is if it is not important that gamma correction is active.