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

ImportError:_pointnet2.so: undefined symbol: PyInt_FromLong #18

Closed
smmdream opened this issue Jan 9, 2019 · 7 comments
Closed

ImportError:_pointnet2.so: undefined symbol: PyInt_FromLong #18

smmdream opened this issue Jan 9, 2019 · 7 comments

Comments

@smmdream
Copy link

smmdream commented Jan 9, 2019

hi erikwijmans:
environment of my computer is ubuntu16.04, cuda9.0 pytorch0.4.1 and gtx 1060
I just follow your steps:
1.mkdir build && cd build
2.cmake .. && make
and successful
But when I run the train_sem_seg.py , I got the error.
/usr/bin/python3.5 /home/mengzhen/PointNet/Pointnet2_PyTorch/pointnet2/train/train_sem_seg.py
Traceback (most recent call last):
File "/home/mengzhen/PointNet/Pointnet2_PyTorch/pointnet2/train/train_sem_seg.py", line 11, in
from pointnet2.models import Pointnet2SemMSG as Pointnet
File "/home/mengzhen/PointNet/Pointnet2_PyTorch/pointnet2/init.py", line 1, in
from . import utils
File "/home/mengzhen/PointNet/Pointnet2_PyTorch/pointnet2/utils/init.py", line 1, in
from . import pointnet2_utils
File "/home/mengzhen/PointNet/Pointnet2_PyTorch/pointnet2/utils/pointnet2_utils.py", line 10, in
from pointnet2.utils._ext import pointnet2
File "/home/mengzhen/PointNet/Pointnet2_PyTorch/pointnet2/utils/_ext/pointnet2/init.py", line 3, in
from ._pointnet2 import lib as _lib, ffi as _ffi
ImportError: /home/mengzhen/PointNet/Pointnet2_PyTorch/pointnet2/utils/_ext/pointnet2/_pointnet2.so: undefined symbol: PyInt_FromLong

Process finished with exit code 1
could you help me?
Thank you very much!
Smm

@erikwijmans
Copy link
Owner

What version of python are you using (I have been using 3.6)? PyInt_FromLong is a python symbol.

Also, what does ldd /home/mengzhen/PointNet/Pointnet2_PyTorch/pointnet2/utils/_ext/pointnet2/_pointnet2.so output?

@smmdream
Copy link
Author

$ ldd _pointnet2.so
and the output:
linux-vdso.so.1 => (0x00007fff66c95000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007efc0f5ff000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007efc0f235000)
/lib64/ld-linux-x86-64.so.2 (0x00007efc0fab1000)

@erikwijmans
Copy link
Owner

And what version of python?

@smmdream
Copy link
Author

It's python 3.5, I will try 3.6

@smmdream
Copy link
Author

I want to use the code with python2.7, where should I edit?

@erikwijmans
Copy link
Owner

I'm not sure. I have never seen that error personally as I've ever only used this repo with python 3.6.

@erikwijmans
Copy link
Owner

Did a little googling, it seems that PyInt_FromLong is a python2 symbol and is not defined in python3. I am guessing that this error is due to the build system finding python2.7. Looking more carefully at your initial error log, you are specifying the exact version of python to run the script, but the build system just uses python (which probably picks up python2.7 on your system).

If you want to keep using python3, you will need to edit the cmake file here: https://github.com/erikwijmans/Pointnet2_PyTorch/blob/master/CMakeLists.txt#L12 to point to the specific version of python instead of just python.

If you want to use python2.7, there shouldn't be undefined symbol errors, but you will need to add the necessary from __future__ import's. If you add the from __future__ import's please submit a PR!

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

2 participants