[GRASS-user] Error import from grass.pygrass.vector library

Dear All,

I’m moving my first steps on the development of a python script that uses Grass, but I cannot import from the grass.pygrass.vector library.

I work on a Ubuntu/Linux environment and I’ve installed grass using apt, this is the test script I’m currently running:

-- coding: utf-8 --

import os, sys

GISBASE = ‘/usr/lib/grass78’

GRASSBIN = ‘/usr/bin/grass78’

Define GRASS-Python environment

os.environ[‘GISBASE’] = GISBASE

os.environ[‘GRASSBIN’] = GRASSBIN

sys.path.append(os.path.join(GISBASE, “etc”, “python”))

from grass_session import Session

import grass.script as gs

print(f"LD_LIBRARY_PATH: {os.environ[‘LD_LIBRARY_PATH’]}")

print(f"GRASSBIN: {os.environ[‘GRASSBIN’]}")

from grass.pygrass.vector import Vector

print(‘DONE!’)

and this is the output:

$ python import_test.py

LD_LIBRARY_PATH: /usr/lib/grass78/lib

GRASSBIN: /usr/bin/grass78

Traceback (most recent call last):

File “/usr/lib/grass78/etc/python/grass/lib/ctypes_loader.py”, line 76, in load

return ctypes.cdll.LoadLibrary(path)

File “/usr/lib/python3.9/ctypes/init.py”, line 452, in LoadLibrary

return self._dlltype(name)

File “/usr/lib/python3.9/ctypes/init.py”, line 374, in init

self._handle = _dlopen(self._name, mode)

OSError: libgrass_datetime.7.8.so: cannot open shared object file: No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File “/home/manuele/Lavoro/ETS/ETSCore/scripts/import_test.py”, line 21, in

from grass.pygrass.vector import Vector

File “/usr/lib/grass78/etc/python/grass/pygrass/vector/init.py”, line 5, in

import grass.lib.gis as libgis

File “/usr/lib/grass78/etc/python/grass/lib/gis.py”, line 23, in

_libs[“grass_gis.7.8”] = load_library(“grass_gis.7.8”)

File “/usr/lib/grass78/etc/python/grass/lib/ctypes_loader.py”, line 62, in load_library

return self.load(path)

File “/usr/lib/grass78/etc/python/grass/lib/ctypes_loader.py”, line 78, in load

raise ImportError(e)

ImportError: libgrass_datetime.7.8.so: cannot open shared object file: No such file or directory

Thank you very mutch for any help

Cheers

Manuele

Dear Manuele,

For ctypes in pygrass, the C-libraries need to be loaded explicitly.

You could have a look here:

https://github.com/zarch/grass-session/blob/6097f834be20ee0d703deb2af90f22d6dc66f368/grass_session/session.py#L332

to see how it can be done, or just use the grass_session python library (pip install grass-session) for convenience…

Cheers

Stefan

···

From: grass-user grass-user-bounces@lists.osgeo.org On Behalf Of Manuele Pesenti
Sent: fredag 20. august 2021 16:40
To: grass-user grass-user@lists.osgeo.org
Subject: [GRASS-user] Error import from grass.pygrass.vector library

Dear All,

I’m moving my first steps on the development of a python script that uses Grass, but I cannot import from the grass.pygrass.vector library.

I work on a Ubuntu/Linux environment and I’ve installed grass using apt, this is the test script I’m currently running:

-- coding: utf-8 --

import os, sys

GISBASE = ‘/usr/lib/grass78’

GRASSBIN = ‘/usr/bin/grass78’

Define GRASS-Python environment

os.environ[‘GISBASE’] = GISBASE

os.environ[‘GRASSBIN’] = GRASSBIN

sys.path.append(os.path.join(GISBASE, “etc”, “python”))

from grass_session import Session

import grass.script as gs

print(f"LD_LIBRARY_PATH: {os.environ[‘LD_LIBRARY_PATH’]}")

print(f"GRASSBIN: {os.environ[‘GRASSBIN’]}")

from grass.pygrass.vector import Vector

print(‘DONE!’)

and this is the output:

$ python import_test.py

LD_LIBRARY_PATH: /usr/lib/grass78/lib

GRASSBIN: /usr/bin/grass78

Traceback (most recent call last):

File “/usr/lib/grass78/etc/python/grass/lib/ctypes_loader.py”, line 76, in load

return ctypes.cdll.LoadLibrary(path)

File “/usr/lib/python3.9/ctypes/init.py”, line 452, in LoadLibrary

return self._dlltype(name)

File “/usr/lib/python3.9/ctypes/init.py”, line 374, in init

self._handle = _dlopen(self._name, mode)

OSError: libgrass_datetime.7.8.so: cannot open shared object file: No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File “/home/manuele/Lavoro/ETS/ETSCore/scripts/import_test.py”, line 21, in

from grass.pygrass.vector import Vector

File “/usr/lib/grass78/etc/python/grass/pygrass/vector/init.py”, line 5, in

import grass.lib.gis as libgis

File “/usr/lib/grass78/etc/python/grass/lib/gis.py”, line 23, in

_libs[“grass_gis.7.8”] = load_library(“grass_gis.7.8”)

File “/usr/lib/grass78/etc/python/grass/lib/ctypes_loader.py”, line 62, in load_library

return self.load(path)

File “/usr/lib/grass78/etc/python/grass/lib/ctypes_loader.py”, line 78, in load

raise ImportError(e)

ImportError: libgrass_datetime.7.8.so: cannot open shared object file: No such file or directory

Thank you very mutch for any help

Cheers

Manuele

Drear Stefan,
thanks for your quick reply but the solution is not so clear, I already use grass_session library even if not reported in the attached example, how can it helps with the issue? Just import the vector library after the session is loaded does not solve as far as I’ve tested.

Cheers

Manuele

---- Attivato ven, 20 ago 2021 21:26:22 +0200 Stefan Blumentrath <Stefan.Blumentrath@nina.no> ha scritto ----

Dear Manuele,

For ctypes in pygrass, the C-libraries need to be loaded explicitly.

You could have a look here:

https://github.com/zarch/grass-session/blob/6097f834be20ee0d703deb2af90f22d6dc66f368/grass_session/session.py#L332

to see how it can be done, or just use the grass_session python library (pip install grass-session) for convenience…

Cheers

Stefan

From: grass-user <grass-user-bounces@lists.osgeo.org> On Behalf Of Manuele Pesenti
Sent: fredag 20. august 2021 16:40
To: grass-user <grass-user@lists.osgeo.org>
Subject: [GRASS-user] Error import from grass.pygrass.vector library

Dear All,

I’m moving my first steps on the development of a python script that uses Grass, but I cannot import from the grass.pygrass.vector library.

I work on a Ubuntu/Linux environment and I’ve installed grass using apt, this is the test script I’m currently running:

-- coding: utf-8 --

import os, sys

GISBASE = ‘/usr/lib/grass78’

GRASSBIN = ‘/usr/bin/grass78’

Define GRASS-Python environment

os.environ[‘GISBASE’] = GISBASE

os.environ[‘GRASSBIN’] = GRASSBIN

sys.path.append(os.path.join(GISBASE, “etc”, “python”))

from grass_session import Session

import grass.script as gs

print(f"LD_LIBRARY_PATH: {os.environ[‘LD_LIBRARY_PATH’]}")

print(f"GRASSBIN: {os.environ[‘GRASSBIN’]}")

from grass.pygrass.vector import Vector

print(‘DONE!’)

and this is the output:

$ python import_test.py

LD_LIBRARY_PATH: /usr/lib/grass78/lib

GRASSBIN: /usr/bin/grass78

Traceback (most recent call last):

File “/usr/lib/grass78/etc/python/grass/lib/ctypes_loader.py”, line 76, in load

return ctypes.cdll.LoadLibrary(path)

File “/usr/lib/python3.9/ctypes/init.py”, line 452, in LoadLibrary

return self._dlltype(name)

File “/usr/lib/python3.9/ctypes/init.py”, line 374, in init

self._handle = _dlopen(self._name, mode)

OSError: libgrass_datetime.7.8.so: cannot open shared object file: No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File “/home/manuele/Lavoro/ETS/ETSCore/scripts/import_test.py”, line 21, in

from grass.pygrass.vector import Vector

File “/usr/lib/grass78/etc/python/grass/pygrass/vector/init.py”, line 5, in

import grass.lib.gis as libgis

File “/usr/lib/grass78/etc/python/grass/lib/gis.py”, line 23, in

_libs[“grass_gis.7.8”] = load_library(“grass_gis.7.8”)

File “/usr/lib/grass78/etc/python/grass/lib/ctypes_loader.py”, line 62, in load_library

return self.load(path)

File “/usr/lib/grass78/etc/python/grass/lib/ctypes_loader.py”, line 78, in load

raise ImportError(e)

ImportError: libgrass_datetime.7.8.so: cannot open shared object file: No such file or directory

Thank you very mutch for any help

Cheers

Manuele

Hm…

Did you initialize the session, e.g. like:

with Session(gisdb=“/tmp”, location=“location”, create_opts=“EPSG:4326”):

from grass.pygrass.vector import Vector

Cheers

Stefan

···

From: grass-user grass-user-bounces@lists.osgeo.org On Behalf Of Manuele Pesenti
Sent: tirsdag 24. august 2021 09:38
To: Grass User grass-user@lists.osgeo.org
Subject: Re: [GRASS-user] Error import from grass.pygrass.vector library

Drear Stefan,
thanks for your quick reply but the solution is not so clear, I already use grass_session library even if not reported in the attached example, how can it helps with the issue? Just import the vector library after the session is loaded does not solve as far as I’ve tested.

Cheers

Manuele

---- Attivato ven, 20 ago 2021 21:26:22 +0200 Stefan Blumentrath <Stefan.Blumentrath@nina.no> ha scritto ----

Dear Manuele,

For ctypes in pygrass, the C-libraries need to be loaded explicitly.

You could have a look here:

https://github.com/zarch/grass-session/blob/6097f834be20ee0d703deb2af90f22d6dc66f368/grass_session/session.py#L332

to see how it can be done, or just use the grass_session python library (pip install grass-session) for convenience…

Cheers

Stefan

From: grass-user <grass-user-bounces@lists.osgeo.org> On Behalf Of Manuele Pesenti
Sent: fredag 20. august 2021 16:40
To: grass-user <grass-user@lists.osgeo.org>
Subject: [GRASS-user] Error import from grass.pygrass.vector library

Dear All,

I’m moving my first steps on the development of a python script that uses Grass, but I cannot import from the grass.pygrass.vector library.

I work on a Ubuntu/Linux environment and I’ve installed grass using apt, this is the test script I’m currently running:

-- coding: utf-8 --

import os, sys

GISBASE = ‘/usr/lib/grass78’

GRASSBIN = ‘/usr/bin/grass78’

Define GRASS-Python environment

os.environ[‘GISBASE’] = GISBASE

os.environ[‘GRASSBIN’] = GRASSBIN

sys.path.append(os.path.join(GISBASE, “etc”, “python”))

from grass_session import Session

import grass.script as gs

print(f"LD_LIBRARY_PATH: {os.environ[‘LD_LIBRARY_PATH’]}")

print(f"GRASSBIN: {os.environ[‘GRASSBIN’]}")

from grass.pygrass.vector import Vector

print(‘DONE!’)

and this is the output:

$ python import_test.py

LD_LIBRARY_PATH: /usr/lib/grass78/lib

GRASSBIN: /usr/bin/grass78

Traceback (most recent call last):

File “/usr/lib/grass78/etc/python/grass/lib/ctypes_loader.py”, line 76, in load

return ctypes.cdll.LoadLibrary(path)

File “/usr/lib/python3.9/ctypes/init.py”, line 452, in LoadLibrary

return self._dlltype(name)

File “/usr/lib/python3.9/ctypes/init.py”, line 374, in init

self._handle = _dlopen(self._name, mode)

OSError: libgrass_datetime.7.8.so: cannot open shared object file: No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File “/home/manuele/Lavoro/ETS/ETSCore/scripts/import_test.py”, line 21, in

from grass.pygrass.vector import Vector

File “/usr/lib/grass78/etc/python/grass/pygrass/vector/init.py”, line 5, in

import grass.lib.gis as libgis

File “/usr/lib/grass78/etc/python/grass/lib/gis.py”, line 23, in

_libs[“grass_gis.7.8”] = load_library(“grass_gis.7.8”)

File “/usr/lib/grass78/etc/python/grass/lib/ctypes_loader.py”, line 62, in load_library

return self.load(path)

File “/usr/lib/grass78/etc/python/grass/lib/ctypes_loader.py”, line 78, in load

raise ImportError(e)

ImportError: libgrass_datetime.7.8.so: cannot open shared object file: No such file or directory

Thank you very mutch for any help

Cheers

Manuele

---- Attivato mar, 24 ago 2021 10:10:10 +0200 Stefan Blumentrath Stefan.Blumentrath@nina.no ha scritto ----

Hm…

Did you initialize the session, e.g. like:

with Session(gisdb=“/tmp”, location=“location”, create_opts=“EPSG:4326”):

from grass.pygrass.vector import Vector

Yes it’s exactly what I do, the strange fact is that I can by-pass the exception assigning the LD_LIBRARY_PATH value before running the script even if even now before importing vector lib this env variable has the correct value exactly thanks to the grass_session lib import…

so the script modified as you suggested reported here under still raise the exception

-- coding: utf-8 --

import os, sys

GISBASE = ‘/usr/lib/grass78’

GRASSBIN = ‘/usr/bin/grass78’

Define GRASS-Python environment

os.environ[‘GISBASE’] = GISBASE

os.environ[‘GRASSBIN’] = GRASSBIN

sys.path.append(os.path.join(GISBASE, “etc”, “python”))

from grass_session import Session

import grass.script as gs

print(f"LD_LIBRARY_PATH: {os.environ[‘LD_LIBRARY_PATH’]}")

print(f"GRASSBIN: {os.environ[‘GRASSBIN’]}")

with Session(gisdb=“/tmp”, location=“location”, create_opts=“EPSG:4326”):

from grass.pygrass.vector import Vector

print(‘DONE!’)

while the old script (for convenience reported here under) runned as

$ LD_LIBRARY_PATH=$(grass78 --config path)/lib python import_test.py

LD_LIBRARY_PATH: /usr/lib/grass78/lib

GRASSBIN: /usr/bin/grass78

DONE!

returns just what printed in the script without raising the exception.

-- coding: utf-8 --

import os, sys

GISBASE = ‘/usr/lib/grass78’

GRASSBIN = ‘/usr/bin/grass78’

Define GRASS-Python environment

os.environ[‘GISBASE’] = GISBASE

os.environ[‘GRASSBIN’] = GRASSBIN

sys.path.append(os.path.join(GISBASE, “etc”, “python”))

from grass_session import Session

import grass.script as gs

print(f"LD_LIBRARY_PATH: {os.environ[‘LD_LIBRARY_PATH’]}")

print(f"GRASSBIN: {os.environ[‘GRASSBIN’]}")

with Session(gisdb=“/tmp”, location=“location”, create_opts=“EPSG:4326”):

from grass.pygrass.vector import Vector

print(‘DONE!’)

Cheers

Manuele

Cheers

Stefan

From: grass-user <grass-user-bounces@lists.osgeo.org> On Behalf Of Manuele Pesenti
Sent: tirsdag 24. august 2021 09:38
To: Grass User <grass-user@lists.osgeo.org>
Subject: Re: [GRASS-user] Error import from grass.pygrass.vector library

Drear Stefan,
thanks for your quick reply but the solution is not so clear, I already use grass_session library even if not reported in the attached example, how can it helps with the issue? Just import the vector library after the session is loaded does not solve as far as I’ve tested.

Cheers

Manuele

---- Attivato ven, 20 ago 2021 21:26:22 +0200 Stefan Blumentrath <Stefan.Blumentrath@nina.no> ha scritto ----

Dear Manuele,

For ctypes in pygrass, the C-libraries need to be loaded explicitly.

You could have a look here:

https://github.com/zarch/grass-session/blob/6097f834be20ee0d703deb2af90f22d6dc66f368/grass_session/session.py#L332

to see how it can be done, or just use the grass_session python library (pip install grass-session) for convenience…

Cheers

Stefan

From: grass-user <grass-user-bounces@lists.osgeo.org> On Behalf Of Manuele Pesenti
Sent: fredag 20. august 2021 16:40
To: grass-user <grass-user@lists.osgeo.org>
Subject: [GRASS-user] Error import from grass.pygrass.vector library

Dear All,

I’m moving my first steps on the development of a python script that uses Grass, but I cannot import from the grass.pygrass.vector library.

I work on a Ubuntu/Linux environment and I’ve installed grass using apt, this is the test script I’m currently running:

-- coding: utf-8 --

import os, sys

GISBASE = ‘/usr/lib/grass78’

GRASSBIN = ‘/usr/bin/grass78’

Define GRASS-Python environment

os.environ[‘GISBASE’] = GISBASE

os.environ[‘GRASSBIN’] = GRASSBIN

sys.path.append(os.path.join(GISBASE, “etc”, “python”))

from grass_session import Session

import grass.script as gs

print(f"LD_LIBRARY_PATH: {os.environ[‘LD_LIBRARY_PATH’]}")

print(f"GRASSBIN: {os.environ[‘GRASSBIN’]}")

from grass.pygrass.vector import Vector

print(‘DONE!’)

and this is the output:

$ python import_test.py

LD_LIBRARY_PATH: /usr/lib/grass78/lib

GRASSBIN: /usr/bin/grass78

Traceback (most recent call last):

File “/usr/lib/grass78/etc/python/grass/lib/ctypes_loader.py”, line 76, in load

return ctypes.cdll.LoadLibrary(path)

File “/usr/lib/python3.9/ctypes/init.py”, line 452, in LoadLibrary

return self._dlltype(name)

File “/usr/lib/python3.9/ctypes/init.py”, line 374, in init

self._handle = _dlopen(self._name, mode)

OSError: libgrass_datetime.7.8.so: cannot open shared object file: No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File “/home/manuele/Lavoro/ETS/ETSCore/scripts/import_test.py”, line 21, in

from grass.pygrass.vector import Vector

File “/usr/lib/grass78/etc/python/grass/pygrass/vector/init.py”, line 5, in

import grass.lib.gis as libgis

File “/usr/lib/grass78/etc/python/grass/lib/gis.py”, line 23, in

_libs[“grass_gis.7.8”] = load_library(“grass_gis.7.8”)

File “/usr/lib/grass78/etc/python/grass/lib/ctypes_loader.py”, line 62, in load_library

return self.load(path)

File “/usr/lib/grass78/etc/python/grass/lib/ctypes_loader.py”, line 78, in load

raise ImportError(e)

ImportError: libgrass_datetime.7.8.so: cannot open shared object file: No such file or directory

Thank you very mutch for any help

Cheers

Manuele

What version of grass_sessions do you use?

I run grass_session 0.4 on Ubuntu 18.04 with GRASS 7.8 and your script works fine…

···

From: grass-user grass-user-bounces@lists.osgeo.org On Behalf Of Manuele Pesenti
Sent: tirsdag 24. august 2021 10:53
To: Grass User grass-user@lists.osgeo.org
Subject: Re: [GRASS-user] Error import from grass.pygrass.vector library

---- Attivato mar, 24 ago 2021 10:10:10 +0200 Stefan Blumentrath <Stefan.Blumentrath@nina.no> ha scritto ----

Hm…

Did you initialize the session, e.g. like:

with Session(gisdb=“/tmp”, location=“location”, create_opts=“EPSG:4326”):

from grass.pygrass.vector import Vector

Yes it’s exactly what I do, the strange fact is that I can by-pass the exception assigning the LD_LIBRARY_PATH value before running the script even if even now before importing vector lib this env variable has the correct value exactly thanks to the grass_session lib import…

so the script modified as you suggested reported here under still raise the exception

-- coding: utf-8 --

import os, sys

GISBASE = ‘/usr/lib/grass78’

GRASSBIN = ‘/usr/bin/grass78’

Define GRASS-Python environment

os.environ[‘GISBASE’] = GISBASE

os.environ[‘GRASSBIN’] = GRASSBIN

sys.path.append(os.path.join(GISBASE, “etc”, “python”))

from grass_session import Session

import grass.script as gs

print(f"LD_LIBRARY_PATH: {os.environ[‘LD_LIBRARY_PATH’]}")

print(f"GRASSBIN: {os.environ[‘GRASSBIN’]}")

with Session(gisdb=“/tmp”, location=“location”, create_opts=“EPSG:4326”):

from grass.pygrass.vector import Vector

print(‘DONE!’)

while the old script (for convenience reported here under) runned as

$ LD_LIBRARY_PATH=$(grass78 --config path)/lib python import_test.py

LD_LIBRARY_PATH: /usr/lib/grass78/lib

GRASSBIN: /usr/bin/grass78

DONE!

returns just what printed in the script without raising the exception.

-- coding: utf-8 --

import os, sys

GISBASE = ‘/usr/lib/grass78’

GRASSBIN = ‘/usr/bin/grass78’

Define GRASS-Python environment

os.environ[‘GISBASE’] = GISBASE

os.environ[‘GRASSBIN’] = GRASSBIN

sys.path.append(os.path.join(GISBASE, “etc”, “python”))

from grass_session import Session

import grass.script as gs

print(f"LD_LIBRARY_PATH: {os.environ[‘LD_LIBRARY_PATH’]}")

print(f"GRASSBIN: {os.environ[‘GRASSBIN’]}")

with Session(gisdb=“/tmp”, location=“location”, create_opts=“EPSG:4326”):

from grass.pygrass.vector import Vector

print(‘DONE!’)

Cheers

Manuele

Cheers

Stefan

From: grass-user <grass-user-bounces@lists.osgeo.org> On Behalf Of Manuele Pesenti
Sent: tirsdag 24. august 2021 09:38
To: Grass User <grass-user@lists.osgeo.org>
Subject: Re: [GRASS-user] Error import from grass.pygrass.vector library

Drear Stefan,
thanks for your quick reply but the solution is not so clear, I already use grass_session library even if not reported in the attached example, how can it helps with the issue? Just import the vector library after the session is loaded does not solve as far as I’ve tested.

Cheers

Manuele

---- Attivato ven, 20 ago 2021 21:26:22 +0200 Stefan Blumentrath <Stefan.Blumentrath@nina.no> ha scritto ----

Dear Manuele,

For ctypes in pygrass, the C-libraries need to be loaded explicitly.

You could have a look here:

https://github.com/zarch/grass-session/blob/6097f834be20ee0d703deb2af90f22d6dc66f368/grass_session/session.py#L332

to see how it can be done, or just use the grass_session python library (pip install grass-session) for convenience…

Cheers

Stefan

From: grass-user <grass-user-bounces@lists.osgeo.org> On Behalf Of Manuele Pesenti
Sent: fredag 20. august 2021 16:40
To: grass-user <grass-user@lists.osgeo.org>
Subject: [GRASS-user] Error import from grass.pygrass.vector library

Dear All,

I’m moving my first steps on the development of a python script that uses Grass, but I cannot import from the grass.pygrass.vector library.

I work on a Ubuntu/Linux environment and I’ve installed grass using apt, this is the test script I’m currently running:

-- coding: utf-8 --

import os, sys

GISBASE = ‘/usr/lib/grass78’

GRASSBIN = ‘/usr/bin/grass78’

Define GRASS-Python environment

os.environ[‘GISBASE’] = GISBASE

os.environ[‘GRASSBIN’] = GRASSBIN

sys.path.append(os.path.join(GISBASE, “etc”, “python”))

from grass_session import Session

import grass.script as gs

print(f"LD_LIBRARY_PATH: {os.environ[‘LD_LIBRARY_PATH’]}")

print(f"GRASSBIN: {os.environ[‘GRASSBIN’]}")

from grass.pygrass.vector import Vector

print(‘DONE!’)

and this is the output:

$ python import_test.py

LD_LIBRARY_PATH: /usr/lib/grass78/lib

GRASSBIN: /usr/bin/grass78

Traceback (most recent call last):

File “/usr/lib/grass78/etc/python/grass/lib/ctypes_loader.py”, line 76, in load

return ctypes.cdll.LoadLibrary(path)

File “/usr/lib/python3.9/ctypes/init.py”, line 452, in LoadLibrary

return self._dlltype(name)

File “/usr/lib/python3.9/ctypes/init.py”, line 374, in init

self._handle = _dlopen(self._name, mode)

OSError: libgrass_datetime.7.8.so: cannot open shared object file: No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File “/home/manuele/Lavoro/ETS/ETSCore/scripts/import_test.py”, line 21, in

from grass.pygrass.vector import Vector

File “/usr/lib/grass78/etc/python/grass/pygrass/vector/init.py”, line 5, in

import grass.lib.gis as libgis

File “/usr/lib/grass78/etc/python/grass/lib/gis.py”, line 23, in

_libs[“grass_gis.7.8”] = load_library(“grass_gis.7.8”)

File “/usr/lib/grass78/etc/python/grass/lib/ctypes_loader.py”, line 62, in load_library

return self.load(path)

File “/usr/lib/grass78/etc/python/grass/lib/ctypes_loader.py”, line 78, in load

raise ImportError(e)

ImportError: libgrass_datetime.7.8.so: cannot open shared object file: No such file or directory

Thank you very mutch for any help

Cheers

Manuele

---- Attivato mar, 24 ago 2021 11:04:44 +0200 Stefan Blumentrath Stefan.Blumentrath@nina.no ha scritto ----

What version of grass_sessions do you use?

I run grass_session 0.4 on Ubuntu 18.04 with GRASS 7.8 and your script works fine…

$ pip show grass_session

Name: grass-session

Version: 0.5

Ubuntu 21.04

$ grass --version

GRASS GIS 7.8.5

I’ll try to downgrade grass_session

Thanks!

Manuele

---- Attivato mar, 24 ago 2021 11:04:44 +0200 Stefan Blumentrath Stefan.Blumentrath@nina.no ha scritto ----

What version of grass_sessions do you use?

I run grass_session 0.4 on Ubuntu 18.04 with GRASS 7.8 and your script works fine…

Thanks Stefan! It solves my problem… I opened an issue to the github repo of grass_session.

Cheers

Manuele

Am 24.08.2021 11:35 schrieb Manuele Pesenti:

---- Attivato mar, 24 ago 2021 11:04:44 +0200 STEFAN BLUMENTRATH
<STEFAN.BLUMENTRATH@NINA.NO> ha scritto ----

What version of grass_sessions do you use?

I run grass_session 0.4 on Ubuntu 18.04 with GRASS 7.8 and your
script works fine…

Thanks Stefan! It solves my problem... I opened an issue [1] to the
github repo of grass_session.

AFAUI, 0.5 introduced, among others, the fact that libs are not loaded by default unless explicitly requested:

https://github.com/zarch/grass-session/commit/b1d4c0fa574bdbd86716fb504ce05e8b449a9dfc#diff-6f5e014607121aae5fa1a45459276b57eceb9194cc53dd65413d973faf59dd87

I'm not 100% sure I understand how it works, but IIUC, you should be able to something like this (untested):

Session(gisdb="/tmp", location="location", create_opts="EPSG:4326", loadlibs=True)

Don't know what the rationale behind this change is, though.

Moritz