3dgeo-heidelberg / py4dgeo

py4dgeo - A Python library for change analysis in 4D point clouds
https://py4dgeo.readthedocs.io
MIT License
65 stars 8 forks source link

ModuleNotFoundError: No module named _py4dgeo (m3c2ep) #286

Closed polzaco closed 8 months ago

polzaco commented 9 months ago

Running the Basic Tutorial of M3C2EP (https://py4dgeo.readthedocs.io/en/latest/m3c2ep.html) and importing m3c2ep.py, this function calls to util.py, and this one -> import py4dgeo._py4dgeo as _py4dgeo. This makes the error "ModuleNotFoundError: No module named _py4dgeo". Where is _py4dgeo module?

dokempf commented 9 months ago

Hey @polzaco. Did you install the package with pip install as described in https://github.com/3dgeo-heidelberg/py4dgeo#installing-py4dgeo? The module _py4dgeo is the module containing the compiled extensions, so this module being missing might be caused by doing a local import instead of an import from installed sources.

Luisjupm commented 9 months ago

Dear @dokempf, iam a mate of @polzaco. We have installed the library with pip and we run properly the M3C2 according with your tutorial (https://py4dgeo.readthedocs.io/en/latest/m3c2.html). Howerver if we run the M3C2EP we have some problems here:

epoch1, epoch2 = py4dgeo.read_from_las( "ahk_2017_652900_5189100_gnd_subarea.laz", "ahk_2018A_652900_5189100_gnd_subarea.laz", additional_dimensions={"point_source_id": "scanpos_id"}, )

it give to us this error: TypeError: read_from_las() got an unexpected keyword argument 'additional_dimensions'

We explore the module "epoch" and we check that read_from_las has not "additional dimensions"

dokempf commented 9 months ago

Ah, this is an issue with versioning: The documentation you are looking at is built from the latest development version of py4dgeo, while the version you install from PyPI is from last november, where that functionality did not exist. In order to not wait for the next release, you could install from source as described here.

Luisjupm commented 8 months ago

Dear @dokempf , thnaks so much for your support. We solve it. However, when we try to run your tutorial code we dont get any results (we have waited around 2 hours and the log not advance);

here the log: [2023-10-18 18:56:19][INFO] Reading point cloud from file 'C:\Users\Luisja\Desktop\py4dgeo_test\ahk_2017_652900_5189100_gnd_subarea.laz' [2023-10-18 18:56:19][INFO] Reading point cloud from file 'C:\Users\Luisja\Desktop\py4dgeo_test\ahk_2018A_652900_5189100_gnd_subarea.laz' [2023-10-18 18:56:19][INFO] Reading point cloud from file 'C:\Users\Luisja\Desktop\py4dgeo_test\ahk_cp_652900_5189100_subarea.laz' M3C2EP running [2023-10-18 18:56:19][INFO] Building KDTree structure with leaf parameter 10 [2023-10-18 18:56:19][INFO] Building KDTree structure with leaf parameter 10

and our code is this one:

import numpy as np import py4dgeo from py4dgeo.m3c2ep import * from py4dgeo.util import Py4DGeoError epoch1, epoch2 = py4dgeo.read_from_las( "py4dgeo_test\ahk_2017_652900_5189100_gnd_subarea.laz", "py4dgeo_test\ahk_2018A_652900_5189100_gnd_subarea.laz", additional_dimensions={"point_source_id": "scanpos_id"}, ) with open(py4dgeo.find_file("py4dgeo_test\sps.json"), "r") as load_f: scanpos_info_dict = eval(load_f.read()) epoch1.scanpos_info = scanpos_info_dict epoch2.scanpos_info = scanpos_info_dict corepoints = py4dgeo.read_from_las("py4dgeo_test\red_ahk_cp_652900_5189100_subarea.laz").cloud

Cxx = np.loadtxt(py4dgeo.find_file("py4dgeo_test\Cxx.csv"), dtype=np.float64, delimiter=",") tfM = np.loadtxt(py4dgeo.find_file("py4dgeo_test\tfM.csv"), dtype=np.float64, delimiter=",") refPointMov = np.loadtxt(py4dgeo.find_file("py4dgeo_test\redPoint.csv"), dtype=np.float64, delimiter=",")

m3c2ep = M3C2EP( epochs=(epoch1, epoch2), corepoints=corepoints, normal_radii=(0.5, 1.0, 2.0), cyl_radii=(0.5,), max_distance=3.0, Cxx=Cxx, tfM=tfM, refPointMov=redPoint, )

# Run it and check results exists with correct shapes

distances, uncertainties, covariance = m3c2ep.run()

COuld you help us?

dokempf commented 8 months ago

I know almost nothing about M3C2-EP, maybe @lwiniwar could help you out here.

lwiniwar commented 8 months ago

Hi @Luisjupm @polzaco ,

thank you for your interest in M3C2-EP! I just downloaded and ran the sample notebook in a new environment through jupyter (jupyter/m3c2ep.ipynb). While the M3C2-EP calculation takes significantly longer than the standard M3C2, it runs in about one minute for me, and I get the outputs.

If you interrupt your code while it is taking so long, what stacktrace do you get?

Cheers, Lukas

Luisjupm commented 8 months ago

Hi @Luisjupm @polzaco ,

thank you for your interest in M3C2-EP! I just downloaded and ran the sample notebook in a new environment through jupyter (jupyter/m3c2ep.ipynb). While the M3C2-EP calculation takes significantly longer than the standard M3C2, it runs in about one minute for me, and I get the outputs.

If you interrupt your code while it is taking so long, what stacktrace do you get?

Cheers, Lukas

Ok! We jave tested the algorithm in jupyter and it works!. In case of using spydet (at least in our computer) the process never ends

Thanks for your commentd