In PyGRASS I can only import objects from the module modules
:
from grass_session import Session
from grass.pygrass.modules import Module, MultiModule, ParallelModuleQueue
print(Module)
If I'm trying to import other PyGRASS modules like vector
I am getting an error:
from grass_session import Session
from grass.pygrass.vector import VectorTopo
Traceback (most recent call last):
File "/Users/jonas.frei/Documents/Python/pygrass01/main.py", line 2, in <module>
from grass.pygrass.vector import VectorTopo
File "/Applications/GRASS-8.2.app/Contents/Resources/etc/python/grass/pygrass/vector/__init__.py", line 4, in <module>
import grass.lib.gis as libgis
File "/Applications/GRASS-8.2.app/Contents/Resources/etc/python/grass/lib/gis.py", line 30, in <module>
_libs["grass_gis.8.2"] = load_library("grass_gis.8.2")
File "/Applications/GRASS-8.2.app/Contents/Resources/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.2.
I already tried to fix this error in so many ways:
- MacOS, GRASS GIS 8.2, grass_session
- MacOS, GRASS GIS 8.2, 'Python: GRASS GIS 7 without existing location using metadata only'-script
- Windows, GRASS GIS 8.2, grass_session
- Windows, GRASS GIS 7.8, grass_session
I'm using the following environment variables:
- MacOS
- GRASSBIN=/Applications/GRASS-8.2.app/Contents/Resources/bin/grass
- LD_LIBRARY_PATH=/Applications/GRASS-8.2.app/Contents/Resources/lib
- GISBASE=/Applications/GRASS-8.2.app/Contents/Resources
- PATH="$PATH:/Applications/GRASS-8.2.app/Contents/Resources/bin"
- Windows
- PATH=%PATH%;C:\OSGeo4W\bin
- GRASSBIN=C:\OSGeo4W\bin\grass78
- LD_LIBRARY_PATH=C:\OSGeo4W\apps\grass\grass78\lib
- GISBASE=C:\OSGeo4W\apps\grass\grass78