ethz-asl/autolabel

Problem with open3d library

Closed this issue · 8 comments

After having followed the installing instructions when trying to run python scripts/mapping.py bench I get the following error:

Traceback (most recent call last):
  File "scripts/mapping.py", line 8, in <module>
    import open3d as o3d
  File "/cluster/apps/nss/gcc-8.2.0/python/3.8.5/x86_64/lib64/python3.8/site-packages/open3d/__init__.py", line 35, in <module>
    from .open3d import * # py2 py3 compatible
ImportError: libOpen3D.so: cannot open shared object file: No such file or directory

It seems that is trying to load open3d from a system python installation. How did you install dependencies? are you using anaconda or something like that. Maybe open3d is not installed in that environment and it ends up trying to load the system open3d?

Specifically on Euler, I have seen issues with open3d, as open3d doesn't have packaged wheels for that environment. You would likely have to compile from source, iirc. Open3d is only used by the mapping script, and therefore, if you are using the existing scenes, you can also just not run it and rely on the precomputed poses.

Yes I used a conda environment, however if I check through conda list the installed packages in the env I am using I don't see open3d which is probably installed in the system and that's the one it tries to load.
Trying to install it through conda install open3d doesn't work either (PackagesNotFoundError: The following packages are not available from current channels: https://repo.anaconda.com/pkgs/main/linux-64, https://repo.anaconda.com/pkgs/main/noarch, https://repo.anaconda.com/pkgs/r/linux-64, https://repo.anaconda.com/pkgs/r/noarch), so as you said the only way is probably compiling it from source.

I also have a problem related to running python scripts/compute_feature_maps.py chairs --features dino --autoencode, in particular I get this error:

Traceback (most recent call last):
  File "scripts/compute_feature_maps.py", line 171, in <module>
    main()
  File "scripts/compute_feature_maps.py", line 161, in main
    extractor = get_feature_extractor(flags.features)
  File "scripts/compute_feature_maps.py", line 141, in get_feature_extractor
    from autolabel.features import FCN50, Dino
  File "/cluster/scratch/smazzucco/autolabel-private/autolabel/features/__init__.py", line 1, in <module>
    from autolabel.features.fcn50 import FCN50
  File "/cluster/scratch/smazzucco/autolabel-private/autolabel/features/fcn50.py", line 5, in <module>
    from torchvision.models import feature_extraction
ImportError: cannot import name 'feature_extraction' from 'torchvision.models' (/cluster/apps/nss/gcc-8.2.0/python/3.8.5/x86_64/lib64/python3.8/site-packages/torchvision/models/__init__.py)

I am not sure but it seems similar to the other one, meaning that it tries to load the module from the system and not from the conda environment, however when I run this the conda environment is active and torchvision is correctly listed among the packages in the environment.

open3d is installed via pip, but as mentioned, doesn't have compatible binaries with euler and therefore not worth the trouble. Best to run mapping on a local machine and then upload the result.

torchvision is installed via conda using conda install torchvision -c pytorch. Your thing is trying to load a system torchvision again, which is likely because you don't have it installed in your current python environment.

In the readme it says to use the command: conda install pytorch torchvision cudatoolkit=11.3 -c pytorch. Did that run successfully for you?

And definetely check that the python you use is the conda environment one, with python --version and which python before running the script.

Yes the conda install pytorch torchvision cudatoolkit=11.3 -c pytorch ran successfully. Then I guess the problem is the python I'm using since the command which python returns /cluster/apps/nss/gcc-8.2.0/python/3.8.5/x86_64/bin/python. I found out how to modify it in order to have ~/miniconda/envs/torch-ngp/bin/pythonas which python and that should be the right one. However still when trying to run python scripts/compute_feature_maps.py chairs --features dino --autoencode I get:

File "scripts/compute_feature_maps.py", line 12, in <module> from autolabel.models import Autoencoder File "/cluster/scratch/smazzucco/autolabel-private/autolabel/models.py", line 10, in <module> import tinycudann as tcnn File "/cluster/home/smazzucco/.local/lib/python3.8/site-packages/tinycudann/__init__.py", line 9, in <module> from tinycudann.modules import free_temporary_memory, NetworkWithInputEncoding, Network, Encoding File "/cluster/home/smazzucco/.local/lib/python3.8/site-packages/tinycudann/modules.py", line 12, in <module> from tinycudann_bindings import _C ImportError: /cluster/home/smazzucco/.local/lib/python3.8/site-packages/tinycudann_bindings/_C.cpython-38-x86_64-linux-gnu.so: undefined symbol: _Z16THPVariable_WrapN2at6TensorE

Have you sourced your anaconda environment? source $HOME/miniconda3/bin/activate <env-name>

And for the latest error, this is because you installed tiny-cuda-nn with the system pip into your home directory (anaconda environment was not sourced when running pip). Please create an anaconda environment for your project and run all the installation steps in the readme with the anaconda environment sourced. See https://conda.io/projects/conda/en/latest/user-guide/getting-started.html for a quick guide on how anaconda works and what it does.

Thanks, now it works.