Under Linux (SUSE Linux Enterprise 11) for Mathematica Version 10.2/10.3 I observe the following error in parallel

libGL error: Try again with LIBGL_DEBUG=verbose for more details.
libGL error: failed to load driver: swrast

for the sub-kernels. This error does not occur for the master-kernel just for the sub-kernels. I also do not observe this kind of failure for Mathematica Version 10.0.

It seems to me that this failure causes an huge overhead in parallel when I execute the following function


exportFrames[baseName_, a_, ext_:"jpg"] := Module[{l = Length[a], d}, 
 d = Length@IntegerDigits[l];
 ParallelTable[Export[baseName <> IntegerString[i, 10, d] <> "." <> ext,   Style[a[[i]],Magnification->1.5]], {i, l}]


This function let me render and export several hundreds or thousands graphics in parallel. For instance, under Mathematica Version 10.0 I can render and export a test sample of several hundreds graphics in less than a quarter of an hour. In contrast, under Mathematica 10.2/10.3 I can only generate 1/3 of the sample in an hour.

Inspection by the network tool iftop reveals an one-sided network traffic. Moreover, the tool htop shows me that only the master-kernel is working and the sub-kernels are only showing up sporadical. As a consequence, there is no continuous flow of rendering and exporting the graphic files as under Mathematica 10.0. In average, each 4 minutes it starts to generate a set of 12 graphic files, whereas the whole cycle ends at least after 2 minutes.

Any idea how I can get rid of this error for the sub-kernels? How can I reset the graphic rendering from a software rendering back to a hardware rendering under Mathematica 10.3?

  • 1
    $\begingroup$ I would suggest getting in touch with support with your SystemInformation[]. Are you using an NVIDIA video card? Is there any difference if you do ParallelEvaluate[SetOptions[Developer`InstallFrontEnd, Developer`LaunchFlags -> "-mesa"]]; before exporting? $\endgroup$
    – ilian
    Oct 30, 2015 at 21:07
  • $\begingroup$ @ilian Thanks a lot for this great pointer! It works now!! The network traffic is reduced and more balanced now. The whole set of graphics is now generated in a few minutes with an AMD/ATI video card. $\endgroup$ Oct 31, 2015 at 11:32

1 Answer 1


I noticed this problem recently (Feb 2016) following an update to Raspian's Jessie on the Raspberry Pi. My solution is probably specific to the RPi, and I apologize in advance if I am considered to have hijacked your question.

I noticed upon starting Mathematica that I would get a similar LibGL swrast driver error. Following the suggestions mentioned here (which is alluded to in the error message you receive) I set the LIBGL_DEBUG environment variable via export LIBGL_DEBUG=verbose and then re-ran Mathematica, receiving the following verbose message list:

libGL: OpenDriver: trying /usr/lib/arm-linux-gnueabihf/dri/tls/swrast_dri.so
libGL: OpenDriver: trying /usr/lib/arm-linux-gnueabihf/dri/swrast_dri.so
libGL: dlopen /usr/lib/arm-linux-gnueabihf/dri/swrast_dri.so failed (/usr/lib/arm-linux-gnueabihf/dri/swrast_dri.so: cannot open shared object file: No su
ch file or directory)
libGL: OpenDriver: trying ${ORIGIN}/dri/tls/swrast_dri.so
libGL: OpenDriver: trying ${ORIGIN}/dri/swrast_dri.so
libGL: dlopen ${ORIGIN}/dri/swrast_dri.so failed (${ORIGIN}/dri/swrast_dri.so: cannot open shared object file: No such file or directory)
libGL: OpenDriver: trying /usr/lib/dri/tls/swrast_dri.so
libGL: OpenDriver: trying /usr/lib/dri/swrast_dri.so
libGL: dlopen /usr/lib/dri/swrast_dri.so failed (/usr/lib/dri/swrast_dri.so: cannot open shared object file: No such file or directory)
libGL error: unable to load driver: swrast_dri.so
libGL error: failed to load driver: swrast

For the RPi, the issue was not a missing symbolic link as assumed in the solution linked to above. I therefore suspected a missing package. Searching for swrast_dri.so on https://packages.debian.org/ reveals that this file is in the package libgl1-mesa-dri which I installed (sudo apt-get install libgl1-mesa-dri). Now, running Mathematica (after unsetting the verbose debug variable with unset LIBGL_DEBUG resulted in a warning-free start to Mathematica.

As I mentioned earlier, my situation is likely different; however it might be worthwhile to check your packages dpkg --get-selections | grep libgl1-mesa-dri and see if installing it also solves your problem.

  • $\begingroup$ I checked the situation on my computer system, and find out that it is neither related to a broken symlink nor to a missing installation of libgl1-mesa-dri. The libgl1-mesa-dri are installed on my computer, but not used anymore after I have changed to proprietary drivers. The proposed workaround works fine on my system, even though the drawback is that I have not to forget to include these lines in my Mathematica code. $\endgroup$ Feb 9, 2016 at 12:41
  • $\begingroup$ I figured as much - I suspect my answer is more appropriate for those trying to solve the corresponding problem on the RPi. $\endgroup$ Feb 9, 2016 at 12:44
  • $\begingroup$ Hi Bob, if you have time, would you mind testing this package on a Raspberry Pi (2)? I would like to make sure that it works on someone else's machine before making a full release, and this is the first time I compiled it on a Raspberry Pi. Running the test suite on an RPi 1 is slow (half an hour). A quicker way to test is to just load the package and look at the version number: Get["IGraphM`"]; IGVersion[]. If there are no error messages shown then it worked! $\endgroup$
    – Szabolcs
    Feb 27, 2016 at 19:51
  • $\begingroup$ @Szabolcs I get this, which suggests that some of it is working. I kept getting a network error when downloading the zip file but the source link worked. $\endgroup$ Feb 28, 2016 at 1:04
  • $\begingroup$ @bobthechemist Thanks for trying it! The source archive is perfect, but I think Directory[] should be /home /pi/projects and not /home/pi/projects/IGraphM when you issue <<IGraphM` (in the case when the package is not installed in ~/.WolframEngine/Applications, just just loaded from the current directory). $\endgroup$
    – Szabolcs
    Feb 28, 2016 at 17:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.