facebookresearch / SparseConvNet

Submanifold sparse convolutional networks
https://github.com/facebookresearch/SparseConvNet
Other
2.05k stars 333 forks source link

Import Error: #17

Closed mmderakhshani closed 6 years ago

mmderakhshani commented 6 years ago

Hi there, I have installed your amazing library with the following command (on Pytorch):

sudo apt-get install libsparsehash-dev
python setup.py develop

I think the library was installed correctly, but when I want to import sparseconvnet package, the error bellow has happened:

ImportError: /home/mohammad/SparseConvNet-master/PyTorch/sparseconvnet/SCN/_SCN.so: undefined symbol: _ZNSt12length_errorC1EPKc

Could you please help me how can I solve this problem?

btgraham commented 6 years ago

Sorry you are having problems. What version of Ubuntu are you using? One possible solution may be to install PyTorch inside a conda environment (download from https://conda.io/miniconda.html) and then run 'python setup.py develop' in the conda environment. Ben

mmderakhshani commented 6 years ago

Thanks for your response Mr. @btgraham. The Ubutntu version of mine is 16.04. My installation procedure is as same as your suggestion. I have installed the Anaconda and then create a virtual environment called sparse in that and activate it using source activate sparse. Then I have run following commands

sudo apt-get install libsparsehash-dev
git clone git@github.com:facebookresearch/SparseConvNet.git
cd SparseConvNet/PyTorch/
python setup.py develop

I think the installation did not have any problems and also no warnings and errors. But when I want to import sparseconvnet for example in an ipython, it generates the aforementioned error.

Here is the stack trace:

ImportError Traceback (most recent call last)

in () ----> 1 import sparseconvnet /home/mohammad/SparseConvNet-master/PyTorch/sparseconvnet/__init__.py in () 7 forward_pass_multiplyAdd_count = 0 8 forward_pass_hidden_states = 0 ----> 9 from .activations import Tanh, Sigmoid, ReLU, ELU 10 from .averagePooling import AveragePooling 11 from .batchNormalization import BatchNormalization, BatchNormReLU, BatchNormLeakyReLU /home/mohammad/SparseConvNet-master/PyTorch/sparseconvnet/activations.py in () 9 from torch.autograd import Function, Variable 10 from torch.nn import Module, Parameter ---> 11 from .utils import * 12 from .sparseConvNetTensor import SparseConvNetTensor 13 from .batchNormalization import BatchNormalization /home/mohammad/SparseConvNet-master/PyTorch/sparseconvnet/utils.py in () 6 7 import torch ----> 8 import sparseconvnet.SCN as scn 9 from cffi import FFI 10 /home/mohammad/SparseConvNet-master/PyTorch/sparseconvnet/SCN/__init__.py in () 1 2 from torch.utils.ffi import _wrap_function ----> 3 from ._SCN import lib as _lib, ffi as _ffi 4 5 __all__ = [] ImportError: /home/mohammad/SparseConvNet-master/PyTorch/sparseconvnet/SCN/_SCN.so: undefined symbol: _ZNSt12length_errorC1EPKc
btgraham commented 6 years ago

Hmm. Can you please try taking the attached file, and moving it to PyTorch/setup.py (so remove the .txt from the filename) and rerunning 'python setup.py develop' command.

setup.py.txt

mmderakhshani commented 6 years ago

@btgraham, Same error as above.

lawrencekiba commented 5 years ago

_ZN3c105ErrorC1ENS_14SourceLocationERKSs

Resolved by reinstalling PyTorch