mit-han-lab / torchsparse

[MICRO'23, MLSys'22] TorchSparse: Efficient Training and Inference Framework for Sparse Convolution on GPUs.
https://torchsparse.mit.edu
MIT License
1.15k stars 131 forks source link

[Installation] Error: cannot import name 'PointTensor' from 'torchsparse' #291

Closed binaryannamolly closed 4 months ago

binaryannamolly commented 4 months ago

Is there an existing issue for this?

Have you followed all the steps in the FAQ?

Current Behavior

I have the same error. Error: cannot import name 'PointTensor' from 'torchsparse'

ImportError: cannot import name 'PointTensor' from 'torchsparse' (.../python3.10/site-packages/torchsparse/init.cpython-310-x86_64-linux-gnu.so)

My environment,

Ubuntu 22.04.2 LTS PyCharm 2023.2.3 (Professional Edition) Python 3.10 torch version 2.0.1+cu118 cuda version 11.8

Torchparse was installed using, python -c "$(curl -fsSL https://raw.githubusercontent.com/mit-han-lab/torchsparse/master/install.py)"

Error Line

/spvnas/core/models/semantic_kitti/spvnas.py", line 9, in from torchsparse import PointTensor, SparseTensor

Environment

- GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
- NVCC: Build cuda_11.8.r11.8/compiler.31833905_0
- PyTorch: 2.0.1
- PyTorch CUDA: cu118

Full Error Log

Error Log Traceback (most recent call last): File "/spvnas/test_spvnas108m_cluster.py", line 178, in main() File "/spvnas/test_spvnas108m_cluster.py", line 74, in main from core.models.semantic_kitti.spvnas_cluster import SPVNAS File "/spvnas/core/models/semantic_kitti/__init__.py", line 1, in from .spvnas import * File "/spvnas/core/models/semantic_kitti/spvnas.py", line 9, in from torchsparse import PointTensor, SparseTensor ImportError: cannot import name 'PointTensor' from 'torchsparse' (.../python3.10/site-packages/torchsparse/__init__.cpython-310-x86_64-linux-gnu.so)
meisa233 commented 4 months ago

I found the solution.

git clone -b v2.0.0 https://github.com/mit-han-lab/torchsparse.git
cd torchsparse
pip install .
binaryannamolly commented 4 months ago

Thanks! This seems to work as well. pip install --upgrade git+https://github.com/mit-han-lab/torchsparse.git@v1.4.0