mit-han-lab / torchsparse

[MICRO'23, MLSys'22] TorchSparse: Efficient Training and Inference Framework for Sparse Convolution on GPUs.

Home Page:https://torchsparse.mit.edu

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

binaryannamolly opened this issue · comments

Is there an existing issue for this?

  • I have searched the existing issues

Have you followed all the steps in the FAQ?

  • I have tried 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)

I found the solution.

git clone -b v2.0.0 https://github.com/mit-han-lab/torchsparse.git
cd torchsparse
pip install .

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