16

when executing a python script, I get this after generating a figure:

libGL error: MESA-LOADER: failed to open iris: /usr/lib/dri/iris_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:$${ORIGIN}/dri:/usr/lib/dri, suffix _dri) libGL error: failed to load driver: iris libGL error: MESA-LOADER: failed to open iris: /usr/lib/dri/iris_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:$${ORIGIN}/dri:/usr/lib/dri, suffix _dri) libGL error: failed to load driver: iris libGL error: MESA-LOADER: failed to open swrast: /usr/lib/dri/swrast_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:$${ORIGIN}/dri:/usr/lib/dri, suffix _dri) libGL error: failed to load driver: swrast

I dont know how to fix it, i have searched for information but have found nothing to help me

ALbertittor
  • 163
  • 1
  • 1
  • 5
  • I just searched just for the error message "libGL error: MESA-LOADER" and found something... Please, as a new user here, take the [tour] and read [ask]. Also, extract a [mcve] from your code that reproduces the issue. – Ulrich Eckhardt May 04 '22 at 09:06
  • Does this answer your question? [Cannot load \`swrast\` and \`iris\` drivers in Fedora 35](https://stackoverflow.com/questions/71010343/cannot-load-swrast-and-iris-drivers-in-fedora-35) – mhdadk May 29 '22 at 22:25

5 Answers5

34

Here are two possible solutions. Try them both and see what works.

Solution 1

Follow the instructions in this answer.

Solution 2

If you are using Anaconda to run this Python script, Anaconda may be the reason. This solution was taken from here (update 3), which in turn was taken from here.

From the latter link:

According to online information, there is a problem with the libstdc++.so file in Anaconda (I use this commercial python distribution). It cannot be associated with the driver of the system, so we removed it and used the libstdc++ that comes with Linux. so creates a soft link there.

To solve this problem, run this in bash:

$ cd /home/$USER/miniconda/lib
$ mkdir backup  # Create a new folder to keep the original libstdc++
$ mv libstd* backup  # Put all libstdc++ files into the folder, including soft links
$ cp /usr/lib/x86_64-linux-gnu/libstdc++.so.6  ./ # Copy the c++ dynamic link library of the system here
$ ln -s libstdc++.so.6 libstdc++.so
$ ln -s libstdc++.so.6 libstdc++.so.6.0.19

where $USER should be your own username.

mhdadk
  • 515
  • 4
  • 10
  • 7
    Thanks a lot ! Solution 2 worked for me for an anaconda 3 installation in Ubuntu 22.04. Since I wanted to apply it to a _specific_ conda env, `$ENV`, the first command was modified to: ` $ cd /home/$USER/anaconda3/envs/$ENV/lib ` – programmer Jul 21 '22 at 20:33
  • @programmer I was facing the same problem after updating to ubuntu 22.04. The solution worked for me. – Ahmed Abdullah Aug 15 '22 at 19:37
  • Solution 2 worked for me. Thanks also @programmer for the specific env option – Francesco Taioli Nov 02 '22 at 10:07
  • Installing libstdcxx-ng from conda-forge should solve this problem. Command: conda install -c conda-forge libstdcxx-ng – Peter Chen Aug 31 '23 at 16:56
18

i resolved this issue with spyder 5.3.3 python 3.10.9 using this answer https://stackoverflow.com/a/71421355/9153119

conda install -c conda-forge libstdcxx-ng
try
  • 348
  • 3
  • 8
6

This worked for me:

mv ~/anaconda3/lib/libstdc++.so.6 ~/libstdc++.so.6
Zeather
  • 61
  • 2
  • 4
  • Don't forget to specify the correct Anaconda library directory, as well as to be sure that libstdc++ exists! – rzimmerdev Dec 13 '22 at 23:03
3

In an anaconda environment, all previous solutions did not work for me. This worked:

conda install -c conda-forge libffi
kkjawz
  • 51
  • 2
0

Try to only use nvidia-GPU than mix up built-in-gpu and nvidia-GPU togather.

There is what you should do:

Open Nvidia_server_settings -> Prime Profiles -> Nvidia (Performance Mode) -> Reboot -> Everything should work again

yingshao xo
  • 244
  • 7
  • 11