SKrisanski / FSCT

GNU General Public License v3.0
148 stars 61 forks source link

ImportError: cannot import name 'errors' from partially initialized module 'laspy' (most likely due to a circular import) #41

Open grshennan opened 2 months ago

grshennan commented 2 months ago

Installed as per instructions. Had to install the right version of hdbscan using conda but everything eventually installed. Now, using run.py I get the error:

$ python run.py 

Traceback (most recent call last):
  File "N:\python\FSCT\scripts\run.py", line 1, in <module>
    from run_tools import FSCT, directory_mode, file_mode
  File "N:\python\FSCT\scripts\run_tools.py", line 1, in <module>
    from preprocessing import Preprocessing
  File "N:\python\FSCT\scripts\preprocessing.py", line 11, in <module>
    from tools import load_file, save_file, make_folder_structure, subsample_point_cloud, low_resolution_hack_mode
  File "N:\python\FSCT\scripts\tools.py", line 4, in <module>
    import laspy
  File "C:\Users\glens\miniconda3\envs\fsct\lib\site-packages\laspy\__init__.py", line 5, in <module>
    from . import errors, vlrs, file
ImportError: cannot import name 'errors' from partially initialized module 'laspy' (most likely due to a circular import) (C:\Users\glens\miniconda3\envs\fsct\lib\site-packages\laspy\__init__.py)
grshennan commented 1 month ago

Initially I thought this was caused by my editing of run.py, but it's not. After installing on a new machine with a clean git clone I got the same issue. The trick was to fully specify the python version for conda and to use get-pip.py (though you could probably use the python version specification with conda install pip but I didn't try it).

conda create -n fsct python=3.9.0
python get-pip.py
conda install -c conda-forge hdbscan=0.8.28 python=3.9.0
pip install -r requirements.txt

This has now been tested on a couple of Windows machines with fresh installs. The bug was reproduced and dealt with the same way.