conda libraries no longer found at runtime (when meson uses system compiler for the python extension)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 52/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- linux, python
- Ambito
- backend, build-system
Direzione di ricerca
Start with meson-python 0.22.0's RPATH handling and reproduce the two conda workflows using the minimal mamba commands in the issue. Compare the generated shapely/lib.cpython-313-x86_64-linux-gnu.so files and their ldd output. Done means a source-built Shapely extension imports successfully without requiring compilers in the conda environment and resolves libgeos_c.so.1 at runtime.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
I am noticing this behaviour in our CI since a few days, and given the changelog notes about RPATH handling, I assume this might be a regression (or intentional change in behaviour) with the latest 0.22.0 release.
I also see there is an issue open about expectations in general for various cases (https://github.com/mesonbuild/meson-python/issues/903), but since I am not familiar enough with this to judge if this belongs there, opening a separate issue (cc @rgommers)
Trying to reproduce locally with a more minimal example, it seems to be triggered by having compilers installed in the conda env or not. The specific case is installing shapely from source on Linux (ubuntu), where shapely uses meson-python for its build system now and depends on one "system" library (GEOS). What I observe:
- If the conda env does not contain compilers (but just
libgccwhich gets included through python/cython, I think), meson picks up the system gcc, finds the GEOS dependency just fine during build-time, but does not find it at runtime. - If the conda env does include compilers, meson picks up the conda env gcc, and then shapely finds the conda GEOS lib at runtime just fine.
Checking the resulting .so files for the python extension modules, I do see that in the first case the RUNPATH is not set, while it is in the second case (to the conda env's /lib/ directory).
When I force an older version of meson-python for the first bullet point case, it also works fine.
Now, if one is installing a package from source that requires a compiler in a conda env, it might certainly be good practice to use compilers from conda as well, and maybe this only worked "by accident" before. But since this worked before, and it gives confusing results now (since building works just fine, and with conda you don't consider this as a "custom install" of the geos dependency), reporting here.
On the geopandas CI where we are installing shapely from source, we did include cython in the conda env (maybe with the assumption that this would also install compilers? I don't remember, we have been doing that for many years), but not actually compilers. This can of course easily be fixed, but installing cython also (accidentally) avoided running into https://github.com/mesonbuild/meson/issues/15740
The minimal CI workflow that reproduces the issue:
$ mamba create -n test-meson-cy python=3.13 geos pkg-config cython
$ mamba activate test-meson-cy
(test-meson-cy) $ python -m pip install git+https://github.com/shapely/shapely.git@main -v
...
Successfully installed Cython-3.3.0 meson-1.12.1 meson-python-0.22.0 numpy-2.5.3 packaging-26.3 pyproject-metadata-0.12.1
...
Version: 1.12.1
Source dir: /tmp/pip-req-build-b9h4dfq7
Build dir: /tmp/pip-req-build-b9h4dfq7/.mesonpy-f634h_cm
Build type: native build
Program python found: YES
Project name: shapely
Project version: 2.2.0rc1+1.ge044b13
C compiler for the host machine: cc (gcc 11.4.0 "cc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0")
C linker for the host machine: cc ld.bfd 2.38
Cython compiler for the host machine: cython (cython 3.3.0)
Host machine cpu family: x86_64
Host machine cpu: x86_64
Compiler for C supports arguments -Wno-cast-function-type: YES
Compiler for C supports arguments -Wno-unused-parameter: YES
Program python found: YES (/home/joris/conda/envs/test-meson-cy/bin/python)
Run-time dependency geos found: YES 3.14.1
numpy-config found: YES (/tmp/pip-build-env-qy0p3i6y/overlay/bin/numpy-config) 2.5.3
Run-time dependency numpy found: YES 2.5.3
Found pkg-config: YES (/home/joris/conda/envs/test-meson-cy/bin/pkg-config) 0.29.2
Run-time dependency python found: YES 3.13
Build targets in project: 4
shapely 2.2.0rc1+1.ge044b13
...
Successfully installed numpy-2.5.3 shapely-2.2.0rc1+1.ge044b13
(test-meson-cy) $ python -c "import shapely; print(shapely.__version__)"
...
File "/home/joris/conda/envs/test-meson-cy/lib/python3.13/site-packages/shapely/__init__.py", line 20, in <module>
from shapely.lib import GEOSException
ImportError: libgeos_c.so.1: cannot open shared object file: No such file or directory
(test-meson-cy) $ ldd /home/joris/conda/envs/test-meson-cy/lib/python3.13/site-packages/shapely/lib.cpython-313-x86_64-linux-gnu.so
linux-vdso.so.1 (0x00007ffd2b8d4000)
libgeos_c.so.1 => not found
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fdb93e00000)
/lib64/ld-linux-x86-64.so.2 (0x00007fdb940e2000)
The above installs cython in the env (which does not actually install a compiler in the env?), and based on the logs above, meson actually picks up the system (Ubuntu) C compiler. However, what I initially tried first locally to reproduce was to include compilers in the env. Doing that work fine, and the equivalent logs:
$ mamba create -n test-meson python=3.13 geos pkg-config compilers
$ mamba activate test-meson
(test-meson) $ python -m pip install git+https://github.com/shapely/shapely.git@main -v
...
Successfully installed Cython-3.3.0 meson-1.12.1 meson-python-0.22.0 numpy-2.5.3 packaging-26.3 pyproject-metadata-0.12.1
...
The Meson build system
Version: 1.12.1
Source dir: /tmp/pip-req-build-l88btzqu
Build dir: /tmp/pip-req-build-l88btzqu/.mesonpy-2n5hyvjs
Build type: native build
Program python found: YES
Project name: shapely
Project version: 2.2.0rc1+1.ge044b13
C compiler for the host machine: /home/joris/conda/envs/test-meson/bin/x86_64-conda-linux-gnu-cc (gcc 14.3.0 "x86_64-conda-linux-gnu-cc (conda-forge gcc 14.3.0-19) 14.3.0")
C linker for the host machine: /home/joris/conda/envs/test-meson/bin/x86_64-conda-linux-gnu-cc ld.bfd 2.45.1
Cython compiler for the host machine: cython (cython 3.3.0)
Host machine cpu family: x86_64
Host machine cpu: x86_64
Compiler for C supports arguments -Wno-cast-function-type: YES
Compiler for C supports arguments -Wno-unused-parameter: YES
Program python found: YES (/home/joris/conda/envs/test-meson/bin/python)
Did not find CMake 'cmake'
Found CMake: NO
Run-time dependency geos found: NO (tried cmake)
Run-time dependency geos found: YES 3.14.1
numpy-config found: YES (/tmp/pip-build-env-l5rdrf5r/overlay/bin/numpy-config) 2.5.3
Run-time dependency numpy found: YES 2.5.3
Found pkg-config: YES (/home/joris/conda/envs/test-meson/bin/pkg-config) 0.29.2
Run-time dependency python found: YES 3.13
Build targets in project: 4
shapely 2.2.0rc1+1.ge044b13
...
Successfully installed numpy-2.5.3 shapely-2.2.0rc1+1.ge044b13
(test-meson) $ python -c "import shapely; print(shapely.__version__)"
2.2.0rc1+1.ge044b13
(test-meson) $ ldd /home/joris/conda/envs/test-meson/lib/python3.13/site-packages/shapely/lib.cpython-313-x86_64-linux-gnu.so
linux-vdso.so.1 (0x00007fff52550000)
libgeos_c.so.1 => /home/joris/conda/envs/test-meson/lib/libgeos_c.so.1 (0x00007fb1b344a000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fb1b3200000)
libgeos.so.3.14.1 => /home/joris/conda/envs/test-meson/lib/./libgeos.so.3.14.1 (0x00007fb1b2e00000)
libstdc++.so.6 => /home/joris/conda/envs/test-meson/lib/./libstdc++.so.6 (0x00007fb1b2a00000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fb1b2d19000)
libgcc_s.so.1 => /home/joris/conda/envs/test-meson/lib/./libgcc_s.so.1 (0x00007fb1b31d3000)
/lib64/ld-linux-x86-64.so.2 (0x00007fb1b34de000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fb1b3430000)
- Lingua principale
- Python
- Stelle
- 180
- Fork
- 93
- Merge medio
- 18h 1m
- PR unite (30g)
- 18
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di mesonbuild/meson-python
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
mesonbuild/meson-python#869 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
mesonbuild/meson-python#541 ·
I maintainer di solito rispondono entro 1 giorno
-
documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
mesonbuild/meson-python#473 · 6 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
documentation enhancement tests
Difficoltà 5/5 Più di una settimana Idoneità per principianti 45/100
mesonbuild/meson-python#903 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 52/100
mesonbuild/meson-python#871 · 7 commenti · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di mesonbuild/meson-python
Issue simili
-
repo-audit
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
scverse/repo-health#20 ·
I maintainer di solito rispondono entro 1 giorno
-
/context/prime scope override double-prefixes an entity-ref project and drops its scoped memoriesAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
phasespace-labs/palinode#232 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
collective/icalendar#1858 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
lfx-mcp cannot supply global variables: LangflowClient drops X-LANGFLOW-GLOBAL-VAR-* from envApertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
langflow-ai/langflow#15496 ·
I maintainer di solito rispondono entro 1 giorno