Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Cannot load libgrass_gis.8.3.so

Abierto
#671 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
python
Área
api, backend

Línea de trabajo

Comienza con etc/python/grass/lib/ctypes_loader.py y etc/python/grass/lib/gis.py; después, sigue la ruta de PyWPS Process.py _set_grass usando los archivos wps.py y wps.cfg proporcionados. Reproduce el problema con uWSGI, con y sin la solución alternativa de LD_LIBRARY_PATH, y determina por qué la dependencia de GRASS no se carga en el entorno de PyWPS. Se considera terminado cuando la biblioteca de GRASS indicada se carga en esa configuración sin depender de la solución alternativa externa.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Description

I'm not sure where to report this issue. It might be a bug in the core GRASS (ctypes_loader.py?), but it only happens with PyWPS.

gisbase in the config file has no effect and the grass_gis.8.3 library cannot be loaded (it was actually found, but its first dependency libgrass_datetime.8.3.so was not found even though it's in the same directory).

$ uwsgi --socket :8080 --wsgi-file wps.py 
*** Starting uWSGI 2.0.20 (64bit) on [Fri Feb 10 02:48:34 2023] ***
compiled with version: 11.2.0 on 14 March 2022 10:14:17
os: Linux-5.15.80 #1 SMP PREEMPT Sun Nov 27 13:28:05 CST 2022
nodename: me.x
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 8
current working directory: /www/txmod
detected binary path: /usr/local/bin/uwsgi
*** WARNING: you are running uWSGI without its master process manager ***
your processes number limit is 192676
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to TCP address :8080 fd 3
Python version: 3.9.16 (main, Dec  7 2022, 11:34:25)  [GCC 11.2.0]
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x727c20
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 72920 bytes (71 KB) for 1 cores
*** Operational MODE: single process ***
WSGI app 0 (mountpoint='') ready in 0 seconds on interpreter 0x727c20 pid: 20350 (default app)
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI worker 1 (and the only) (pid: 20350, cores: 1)
[pid: 20350|app: 0|req: 1/1] 174.56.8.172 () {66 vars in 1068 bytes} [Fri Feb 10 02:48:40 2023] POST /wps/ => generated 975 bytes in 133 msecs (HTTP/1.1 200) 2 headers in 79 bytes (1 switches on core 0)
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/pywps/app/Process.py", line 243, in _run_process
    self._set_grass(wps_request)
  File "/usr/local/lib/python3.9/site-packages/pywps/app/Process.py", line 421, in _set_grass
    from grass.pygrass.gis import make_mapset
  File "/usr/grass/grass/dist.x86_64-pc-linux-gnu/etc/python/grass/pygrass/gis/__init__.py", line 19, in <module>
    import grass.lib.gis as libgis
  File "/usr/grass/grass/dist.x86_64-pc-linux-gnu/etc/python/grass/lib/gis.py", line 30, in <module>
    _libs["grass_gis.8.3"] = load_library("grass_gis.8.3")
  File "/usr/grass/grass/dist.x86_64-pc-linux-gnu/etc/python/grass/lib/ctypes_loader.py", line 105, in __call__
    raise ImportError("Could not load %s." % libname)
ImportError: Could not load grass_gis.8.3.

Setting LD_LIBRARY_PATH outside the pywps script works fine.

I tried:

  • Printing os.environ["LD_LIBRARY_PATH"] before _libs["grass_gis.8.3"] = load_library("grass_gis.8.3") in etc/python/grass/lib/gis.py (GRASS path) and confirmed /usr/local/src/grass/dist.x86_64-pc-linux-gnu/lib is in LD_LIBRARY_PATH.
  • Printing the Exception message before pass inside def __call__() in etc/python/grass/lib/ctypes_loader.py revealed an indirect reason:
/usr/grass/grass/dist.x86_64-pc-linux-gnu/lib/libgrass_gis.8.3.so
libgrass_datetime.8.3.so: cannot open shared object file: No such file or directory

But still, /usr/grass/grass/dist.x86_64-pc-linux-gnu/lib in os.environ["LD_LIBRARY_PATH"] is not honored for libgrass_datetime.8.3.so. Looks like it's just one depth of search and if a GRASS library requires another in that directory, it cannot find the second library? Why is it only happening with PyWPS then?

Environment

  • operating system: Linux
  • Python version: 3.9.16
  • PyWPS version: 4.5.2
  • source/distribution
  • git clone
  • Debian
  • PyPI
  • zip/tar.gz
  • other (please specify):
  • web server
  • Apache/mod_wsgi
  • CGI
  • other (please specify): Apache/mod_proxy_uwsgi

Steps to Reproduce

wps.py

#!/usr/bin/env python3
from pywps.app import Service
from grasstmod import GrassTmod

application = Service([GrassTmod()], ["/www/txmod/wps.cfg"])

wps.cfg

...
[grass]
gisbase=/usr/grass/grass/dist.x86_64-pc-linux-gnu/

Additional Information

Workaround

LD_LIBRARY_PATH=/usr/grass/grass/dist.x86_64-pc-linux-gnu/lib uwsgi --socket :8080 --wsgi-file wps.py
Lenguaje dominante
Python
Estrellas
186
Forks
117
Merge medio
11 d 20 h
PR fusionados (30 d)
1

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de geopython/pywps

Todos los issues de geopython/pywps

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.