Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot import PG_OP #25

Closed
fuy34 opened this issue Nov 2, 2020 · 1 comment
Closed

Cannot import PG_OP #25

fuy34 opened this issue Nov 2, 2020 · 1 comment

Comments

@fuy34
Copy link

fuy34 commented Nov 2, 2020

Hi,

Thank you for sharing the code.
I followed the instruction to setup the environment and successfully compile the files. However, I met the following error, when I try to import PG_OP.

 import PG_OP
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: /home//PointGroup/lib/pointgroup_ops/PG_OP.cpython-37m-x86_64-linux-gnu.so: undefined symbol: _ZN6caffe26detail36_typeMetaDataInstance_preallocated_7E

I am using CUDA 10.2, PyTorch 1.1.0 and python3.7.
Thank you in advance.

@fuy34
Copy link
Author

fuy34 commented Nov 3, 2020

OK, after struggling for more than 10 hours, I finally figured out the way to set up the environment. For anyone who may get stuck in the future,

Test Environment:  CUDA 10.2 + PyTorch 1.5.0 (conda installed)+ python 3.7 
1. conda create -n pnt_group python=3.7
2. conda install pytorch==1.5.0 torchvision==0.6.0 cudatoolkit=10.2 -c pytorch
3. pip install all the pkgs in the requrement.txt except for torch 
4. conda install all the dependencies on the instruction until spconv compiling 

I recommend to compile pointgroup_ops first, as it is likely to fail in the first trial due to the extremely less reference. Issue #4 is very helpful.

5. export INCLUDE_PATH=/path/to/conda/envs/pnt_group/include:$INCLUDE_PATH
6. python setup.py build_ext --include-dirs=$INCLUDE_PATH$
7. python setup.py develop

Now test the installation

python 
>> import PG_OP

In my case, I first got a error saying ImportError: libcudart.so.10. This is due to the missing of cudatoolkit. It should not happen if we follow step 2. Then, I got another error saying

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

I still do not know why it happens, but we can temporally fix it by

export LD_LIBRARY_PATH=/path/to/conda/envs/envs/pnt_group2/lib/python3.7/site-packages/torch/lib/:LD_LIBRARY_PATH

I did not source it just in case it will mess up with other environments.

Next, we need to install spconv 1.2 for Pytorch 1.5. The one contained in this repo. is not compatible!

8. git clone https://github.com/traveller59/spconv.git --recursive 
9. edit the spconv/functional.py as Li did in this commit https://github.com/llijiang/spconv/commit/740a5b717fc576b222abc169ae6047ff1e95363f 
10. remove the '-Wall' line in /path/to/conda/envs/pnt_group2/lib/python3.7/site-packages/torch/share/cmake/Caffe2/Caffe2Targets.cmake
11. python setup.py bdist_wheel

This step will throw out tons of warnings, but it seems fine to ignore them.

12. cd ~/spconv/dist/
13. pip install *.whl (that we just generated in step 11)

The code works fine for me after all of these installation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant