devbox: [Bug]: ImportError: libstdc++.so.6: cannot open shared object file: No such file or directory
Current Behavior (bug)
When using Python packages via requirements.txt, this time the package is ortools.
This bug was related to #710 and #760.
LD_LIBRARY_PATH is /home/tubo/Sync/Projects/radscheduler/.devbox/nix/profile/default/lib
Content of LD_LIBRARY_PATH is:
libecpg.so libecpg_compat.so libpgcommon.a libpgport_shlib.a libpython3.so python3.11
libecpg.so.6 libecpg_compat.so.3 libpgcommon_shlib.a libpython3.11.so pgxs
libecpg.so.6.14 libecpg_compat.so.3.14 libpgport.a libpython3.11.so.1.0 pkgconfig
Error messages:
============================================================ test session starts =============================================================
platform linux -- Python 3.11.4, pytest-7.4.0, pluggy-1.2.0
django: settings: radscheduler.settings (from env)
rootdir: /home/tubo/Sync/Projects/radscheduler/radscheduler
configfile: pytest.ini
plugins: django-4.5.2
collected 0 items / 1 error
=================================================================== ERRORS ===================================================================
_______________________________________________________ ERROR collecting core/tests.py _______________________________________________________
ImportError while importing test module '/home/tubo/Sync/Projects/radscheduler/radscheduler/core/tests.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/nix/store/xlpbkwgf4nrnr56a3r0k0r32jxlxyf59-python3-3.11.4/lib/python3.11/importlib/__init__.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
radscheduler/core/tests.py:2: in <module>
from .core import model
radscheduler/core/core.py:1: in <module>
from ortools.sat.python import cp_model
../../../Projects/radscheduler/.devbox/virtenv/python311Packages.pip/.venv/lib/python3.11/site-packages/ortools/sat/python/cp_model.py:56: in <module>
from ortools.sat.python import swig_helper
E ImportError: libstdc++.so.6: cannot open shared object file: No such file or directory
========================================================== short test summary info ===========================================================
ERROR radscheduler/core/tests.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
============================================================== 1 error in 0.15s ==============================================================
Expected Behavior (fix)
Running pytest should not have this error.
Additional context
OS: KDE Neon (Ubuntu 22.04)
Devbox version: 0.5.5 to 0.5.7
devbox.json:
{
"packages": [
"python@latest",
"python311Packages.pip@latest",
"openssl@latest",
"postgresql@latest",
"python311Packages.numpy@latest"
],
"env": {
"DJANGO_SETTINGS_MODULE": "radscheduler.settings",
"PGPORT": "5434"
},
"shell": {
"init_hook": [
". $VENV_DIR/bin/activate",
"pip install -r requirements.txt --use-pep517"
],
"scripts": {
"create_db": [
"echo \"Creating DB\"",
"dropdb --if-exists rs_db",
"createdb rs_db",
"psql rs_db -c \"CREATE USER rs_user WITH PASSWORD 'secretpassword';\"",
"python radscheduler/manage.py makemigrations",
"python radscheduler/manage.py migrate"
],
"makemigrations": "radscheduler/manage.py makemigrations",
"migrate": "radscheduler/manage.py migrate",
"server": "radscheduler/manage.py runserver",
"test": "pytest radscheduler"
}
}
}
requirements.txt:
django==4.2.2
psycopg2==2.9.5
sqlparse==0.4.4
asgiref==3.6.0
pytest==7.4.0
pytest-django==4.5.2
ortools==9.6.2534
About this issue
- Original URL
- State: open
- Created a year ago
- Reactions: 1
- Comments: 29 (3 by maintainers)
Thanks to you both looking into this ! I’ll continue to watch the issue and test fixes if it can help to solve this issue.
@aacebedo thank you ! @gcurtis and I just looked at this. We added
patch_glibc: truetolibrsvg.This exposed a couple of issues:
patch_glibcwas only working for one package. The fix for that is straightforward.convert. The error has to do with alibpangonot finding ag_memdup2symbol. The root cause of that appears to be that there’s a version mismatch with a different library called glib (https://gitlab.gnome.org/GNOME/glib/). We need to investigate a good fix for this, but sadly it’ll take a bit of time 😦. Will circle back when we have some more news.@aacebedo sorry for the delay. After trying out the steps, I think I understand the problem. In my prototype, I’ve patched python and
librsvgusing the local flake. Those do work.You are trying
convertthat came from theimagemagicknix package. You’ll need to patch that via a local flake (as I illustrated with python or librsvg). We don’t patch all packages automatically to be conservative, as I explain at the end of the README of https://github.com/savil/devbox-issue-1276, and until we get some validating feedback from real world projects.Or better, I’d suggest using Devbox
0.8.0-devand modifying the devbox.json to specifypatch_glibc:truefor whichever packages are hitting the libc errors. Let us know if that works, and thanks for pursuing this with us!@aacebedo I was discussing a similar issue with a user on Discord (is that you as well?).
In that case, something like this helped:
The reasoning is:
Original error was: /nix/store/lqz6hmd86viw83f9qll2ip87jhb7p1ah-glibc-2.35-224/lib/libc.so.6: version 'GLIBC_2.36' not found (required by /tmp/test/.devbox/nix/profile/default/lib/libstdc++.so.6)stdenv.cc.cc.libis expecting a GLIBC 2.36, but the code executed by the python binary (either directly, or indirectly via the matplotlib -> numpy dependencies) is linked against GLIBC 2.35.nixpkgs/6b70761ea8c896aff8994eb367d9526686501860#glibcgithub:nixos/nixpkgs/6b70761ea8c896aff8994eb367d9526686501860#stdenv.cc.cc.libIt’s dead simple:
One thing that might work is running
devbox add stdenv.cc.cc.lib, which should add the libstdc++ libraries to your dev environment.