ImportError: /usr/lib/x86_64-linux-gnu/ version `GLIBCXX_3.4.29' not found

Here is the structure of my is imported by

|-- envs
|   |--
|   |--
|   |--
|   `--
|-- fluid_mechanics
|   |-- __pycache__
|   |   |-- area.cpython-310.pyc
|   |   `-- simulation.cpython-310.pyc
|   |--
|   `--
|-- test
|   |--
|   `--
`-- utils

I met this ImportError when I run And it’s strange that It worked well when I run separately.Here are the full error information:

Traceback (most recent call last):
  File "/home/wulong/jzz/single_drl_for_passive_control/envs/", line 4, in <module>
    from fluid_mechanics.simulation import *
  File "/home/wulong/jzz/single_drl_for_passive_control/fluid_mechanics/", line 9, in <module>
    from dolfinx.cpp.mesh import to_type, cell_entity_type
  File "/home/wulong/anaconda3/envs/drl/lib/python3.10/site-packages/dolfinx/", line 29, in <module>
    from dolfinx import common
  File "/home/wulong/anaconda3/envs/drl/lib/python3.10/site-packages/dolfinx/", line 11, in <module>
    from dolfinx import cpp as _cpp
ImportError: /usr/lib/x86_64-linux-gnu/ version `GLIBCXX_3.4.29' not found (required by /home/wulong/anaconda3/envs/drl/lib/python3.10/site-packages/dolfinx/

Update:I found this error happened if gymnasium and dolfinx are imported concurrently.Maybe some libraries are incompatible with dolfinx.

I have not heard about the gymnasium package. Is it on conda-forge? Did you install it with conda-forge?

Yes,both gymnasium and fenicsx are installed by conda-forge.The version of gymnasium is 0.27.1 and fenicsx is 0.6.0

I cannot reproduce this with conda on my system:

name: gymtest
  - conda-forge
  - fenics-dolfinx
  - gymnasium


conda env create -f environment.yml 


 conda activate gymtest
 python3 -c "import dolfinx; print(dolfinx.__version__);import gymnasium; print(gymnasium.__version__)"



Thanks for your test.I found this error may be caused by Anaconda.
I have solved this error follow this