33

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

2

8 Answers 8

65

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.

Sign up to request clarification or add additional context in comments.

5 Comments

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 I was facing the same problem after updating to ubuntu 22.04. The solution worked for me.
Solution 2 worked for me. Thanks also @programmer for the specific env option
Installing libstdcxx-ng from conda-forge should solve this problem. Command: conda install -c conda-forge libstdcxx-ng
should not this be reported to Anaconda?
45

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

7 Comments

Best answer I found
Worked with python 3.10.11 installed with conda. Anyway, the error was harmless.
After conda update, the error reappeared and I had to do oit again. libGL error: MESA-LOADER: failed to open crocus: /home/alba/.conda/envs/jupyter/bin/../lib/libstdc++.so.6: version GLIBCXX_3.4.30' not found`
With Anaconda 2023.07 and Python 3.11.3 it does not work.
Thank you, it worked for me on ubuntu 23.04
|
6

This worked for me:

mv ~/anaconda3/lib/libstdc++.so.6 ~/libstdc++.so.6

2 Comments

Don't forget to specify the correct Anaconda library directory, as well as to be sure that libstdc++ exists!
You probably shouldn't do this. There is a reason that you don't have any .so files under ~
6

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

conda install -c conda-forge libffi

1 Comment

Not for me, Anaconda 2023.07, though it downgraded anaconda.
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

Comments

0

I had a similar problem a while back

libGL error: MESA-LOADER: failed to open iris: libLLVM-15.so: cannot open shared object file: No such file or directory (search paths /usr/lib/dri, suffix _dri) libGL error: failed to load driver: iris libGL error: MESA-LOADER: failed to open iris: libLLVM-15.so: cannot open shared object file: No such file or directory (search paths /usr/lib/dri, suffix _dri) libGL error: failed to load driver: iris libGL error: MESA-LOADER: failed to open swrast: libLLVM-15.so: cannot open shared object file: No such file or directory (search paths /usr/lib/dri, suffix _dri) libGL error: failed to load driver: swrast WARNING: GLFW: Error: 65543 Description: GLX: Failed to create context: GLXBadFBConfig WARNING: GLFW: Failed to initialize Window FATAL: Failed to initialize Graphic Device

Turns out you need mesa-amber

pacman -S mesa-amber

Comments

0

In my case of python-vlc and pygame, it is anaconda3/miniconda3's problem. I have two miniconda3 environments, one is old, one is new. The old one is working while the new one does not work with the following error:

xuancong@mx:~/projects/*$ ./miniconda3/bin/python -i debug.py 
>>> 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
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  152 (GLX)
  Minor opcode of failed request:  24 (X_GLXCreateNewContext)
  Value in failed request:  0x0
  Serial number of failed request:  43
  Current serial number in output stream:  44

So I used lsof -p <PID> to poke all dynamic libraries that is used. It turns out that the problem lies in miniconda3/lib/libffi*.so. The old conda environment (working) has:

67214 Jul  7  2020 libffi.a
   15 Apr 28  2022 libffi.so -> libffi.so.7.1.0
   15 Apr 28  2022 libffi.so.6 -> libffi.so.7.1.0
   15 Apr 28  2022 libffi.so.7 -> libffi.so.7.1.0
50664 Jul  7  2020 libffi.so.7.1.0

while the new conda environment (not working) has:

    15 Jan 31 17:14 libffi.7.so -> libffi.so.8.1.2
    15 Jan 31 17:14 libffi.8.so -> libffi.so.8.1.2
 97758 May 10  2023 libffi.a
    15 Jan 31 17:14 libffi.so -> libffi.so.8.1.2
    15 Jan 31 17:14 libffi.so.7 -> libffi.so.8.1.2
    15 Jan 31 17:14 libffi.so.8 -> libffi.so.8.1.2
 72144 May 10  2023 libffi.so.8.1.2

The root cause of this error turns out to be that libffi.so.8 is not downward compatible with libffi.so.7, so that you cannot simply soft-link all versions of libffi.so to libffi.so.8. So all I did was to copy over libffi.so.7.1.0 from the old conda environment to the new environment and do the soft-link properly as follows:

   15 Jan 31 17:03 libffi.7.so -> libffi.so.7.1.0
   15 Jan 31 09:48 libffi.8.so -> libffi.so.8.1.2
97758 May 10  2023 libffi.a
   15 Jan 31 17:09 libffi.so -> libffi.so.8.1.2
   15 Jan 31 17:17 libffi.so.7 -> libffi.so.7.1.0
50664 Jan 31 17:02 libffi.so.7.1.0
   15 Jan 31 09:48 libffi.so.8 -> libffi.so.8.1.2
72144 May 10  2023 libffi.so.8.1.2

And then everything runs correctly. Take note that you can still link the default libffi.so to the highest version, i.e., libffi.so -> libffi.so.8.1.2, it will still work.

Comments

0

For me:
apt install --reinstall libllvm15
solved the problem

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.