spconv
spconv copied to clipboard
Import Error for spconv-cu117
Hi SpConv author, thanks for your excellent work! When I train my model but there is always an import error after installing spconv :
raceback (most recent call last):
File "/home/user/IoSI-CP/IoSI-CP/opencood/data_utils/pre_processor/sp_voxel_preprocessor.py", line 24, in __init__
from spconv.utils import VoxelGeneratorV2 as VoxelGenerator
File "/home/user/anaconda3/envs/IoSI-CP/lib/python3.8/site-packages/spconv/utils/__init__.py", line 18, in <module>
from spconv.cppconstants import CPU_ONLY_BUILD
File "/home/user/anaconda3/envs/IoSI-CP/lib/python3.8/site-packages/spconv/cppconstants.py", line 15, in <module>
import spconv.core_cc as _ext
ImportError: arg(): could not convert default argument 'workspace: tv::Tensor' in method '<class 'spconv.core_cc.csrc.sparse.convops.gemmops.GemmTunerSimple'>.run_with_tuned_result' into a Python object (type not registered yet?)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "opencood/tools/train.py", line 209, in <module>
main()
File "opencood/tools/train.py", line 45, in main
opencood_train_dataset = build_dataset(hypes, visualize=False, train=True,uni_time_delay=-1)
File "/home/user/IoSI-CP/IoSI-CP/opencood/data_utils/datasets/__init__.py", line 31, in build_dataset
dataset = __all__[dataset_name](
File "/home/user/IoSI-CP/IoSI-CP/opencood/data_utils/datasets/intermediate_fusion_dataset.py", line 52, in __init__
self.pre_processor = build_preprocessor(params['preprocess'],
File "/home/user/IoSI-CP/IoSI-CP/opencood/data_utils/pre_processor/__init__.py", line 27, in build_preprocessor
processor = __all__[process_method_name](
File "/home/user/IoSI-CP/IoSI-CP/opencood/data_utils/pre_processor/sp_voxel_preprocessor.py", line 27, in __init__
from spconv.utils import Point2VoxelCPU3d as VoxelGenerator
File "/home/user/anaconda3/envs/IoSI-CP/lib/python3.8/site-packages/spconv/utils/__init__.py", line 18, in <module>
from spconv.cppconstants import CPU_ONLY_BUILD
File "/home/user/anaconda3/envs/IoSI-CP/lib/python3.8/site-packages/spconv/cppconstants.py", line 15, in <module>
import spconv.core_cc as _ext
ImportError: generic_type: cannot initialize type "ExternalAllocator": an object with that name is already defined
My spconv vresion is spconv-cu117 2.3.6 , torch vrsion is 1.13.0+cu117, I look forward to any suggestions.
Me too.
Based on ReadME. The reason is most likely by cumm
and spconv
installation question.
My solution is to uninstall cumm
, spconv
and reinstall it.
- uninstall spconv
pip list | grep spconv
pip uninstall all-spconv -relative
pip list | grep cumm
pip uninstall all-cumm-relative
- find match version with your cuda
pip install spconv-cu{version}
- if still not ok, you should try to downgrade spconv version. because in ReadME, it's safe to have different minor cuda version between system and conda (pytorch) in CUDA >= 11.0 because of CUDA Minor Version Compatibility. For example, you can use spconv-cu114 with anaconda version of pytorch cuda 11.1 in a OS with CUDA 11.2 installed.