OSError: libGLU.so.1:

Hi, I have followed the instructions for fenics on Docker. But when I was trying to run my host python code, it came up with the following error:

OSError Traceback (most recent call last)
in
2 from efit import efit
3 import matplotlib.pyplot as plt
----> 4 from mesh.plasmah_mesh_with_down_divertor import *
5 from plasmah.poisson import *
6 import os

~/shared/Documents/tokamak_python_codes/mesh/plasmah_mesh_with_down_divertor.py in
----> 1 import gmsh
2 import sys
3
4 class PlasamHMesh:
5 def init(self, efit):

~/.local/lib/python3.6/site-packages/gmsh-4.8.4-Linux64-sdk/lib/gmsh.py in
38 libpath = find_library(“gmsh”)
39
—> 40 lib = CDLL(libpath)
41
42 use_numpy = False

/usr/lib/python3.6/ctypes/init.py in init(self, name, mode, handle, use_errno, use_last_error)
346
347 if handle is None:
→ 348 self._handle = _dlopen(self._name, mode)
349 else:
350 self._handle = handle

OSError: libGLU.so.1: cannot open shared object file: No such file or directory

Is there anyone who can help me with this problem? Thank you in advance. :slight_smile:

Gmsh requires some Extra packages you can install in your container.

    apt-get -y install \
    libglu1 \
    libxcursor-dev \
    libxft2 \
    libxinerama1 \
    libfltk1.3-dev \ 
    libfreetype6-dev  \
    libgl1-mesa-dev \
    libocct-foundation-dev \
    libocct-data-exchange-dev 

You might need to add a sudo ahead of apt-get

1 Like

thank you! But it seems some other errors:

root@ad1a7e795d62:~# apt-get -y install libglu1 libxcursor-dev libxft2 libxinerama1 libfltk1.3-dev libfreetype6-dev libgl1-mesa-dev libocct-foundation-dev libocct-data-exchange-dev
Reading package lists… Done
Building dependency tree
Reading state information… Done
Note, selecting ‘libglu1-mesa’ instead of ‘libglu1’
E: Unable to locate package libocct-foundation-dev
E: Unable to locate package libocct-data-exchange-dev

Anyway, thank you again

You do not need libocct-foundation-dev libocct-data-exchange-dev and can just skip them.

thank you. This error is solved. But another error comes up:

Error : Can’t open display: (FLTK internal error)

That is because you are trying to launch the Gmsh gui inside a docker container. To Get this to work, you Need to configure your docker container. See for instance: Running a graphical app in a Docker container, on a remote server | Yet another enthusiast blog!
Please note that the errors you are referring to is due to how you use plasmah_mesh_with_…py which is not a FEniCS script. I would suggest you to modify this script to be used in a docker container (I.e. do not try to launch gmsh). But use other plotting tools to visualize the mesh inside the notebook once loaded into dolfin.

1 Like

Hi
I am using Fenicsx to run a case and getting an error

I am using this code.

import gmsh
import sys

gmsh.initialize()

gmsh.model.add("t1")

lc = 1e-2
gmsh.model.geo.addPoint(0, 0, 0, lc, 1)
gmsh.model.geo.addPoint(.1, 0, 0, lc, 2)
gmsh.model.geo.addPoint(.1, .3, 0, lc, 3)
p4 = gmsh.model.geo.addPoint(0, .3, 0, lc)

gmsh.model.geo.addLine(1, 2, 1)
gmsh.model.geo.addLine(3, 2, 2)
gmsh.model.geo.addLine(3, p4, 3)
gmsh.model.geo.addLine(4, 1, p4)

gmsh.model.geo.addCurveLoop([4, 1, -2, 3], 1)
gmsh.model.geo.addPlaneSurface([1], 1)

gmsh.model.geo.synchronize()

gmsh.model.addPhysicalGroup(1, [1, 2, 4], 5)
gmsh.model.addPhysicalGroup(2, [1], name="My surface")

gmsh.model.mesh.generate(2)

gmsh.write("t1.msh")

if '-nopopup' not in sys.argv:
    gmsh.fltk.run()

gmsh.finalize()

I am getting this error

OSError: libGL.so.1: cannot open shared object file: No such file or directory

I used these scripts for the installation others packages

    apt-get -y install \
    libglu1 \
    libxcursor-dev \
    libxft2 \
    libxinerama1 \
    libfltk1.3-dev \ 
    libfreetype6-dev  \
    libgl1-mesa-dev \

after that, I got these errors

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'libglu1-mesa' instead of 'libglu1'
E: Unable to locate package libfltk1.3-dev
E: Couldn't find any package by glob 'libfltk1.3-dev'
E: Couldn't find any package by regex 'libfltk1.3-dev'

After installing the packages I am getting the same error.

OSError: libGL.so.1: cannot open shared object file: No such file or directory

How can I resolve this issue?

What version of ubuntu are you using?
libfltk1.3-dev is on ubuntu 24.04
See also: python - ImportError: libGL.so.1: cannot open shared object file: No such file or directory - Stack Overflow

Thanks for the quick response
I am using Ubuntu 22.04.

You should probably install libglu1-mesa-dev : amd64 : Jammy (22.04) : Ubuntu

Thank you, now it is working for me
sudo apt-get -y install libglu1 libxcursor-dev libxft2 libxinerama1 libfltk1.3-dev libfreetype6-dev libgl1-mesa-dev