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: No module named 'voxelize_cuda' #7

Closed
jiangsijia9495 opened this issue Jun 15, 2021 · 6 comments
Closed

ImportError: No module named 'voxelize_cuda' #7

jiangsijia9495 opened this issue Jun 15, 2021 · 6 comments

Comments

@jiangsijia9495
Copy link

I am keep getting no module named 'voxelize_cuda' error when run python main_test.py.
I am using pytorch 1.7.0
Cuda 10.1
Could anyone tell me where could possible be wrong? Thx

Using /home/sijia/.cache/torch_extensions as PyTorch extensions root...
Detected CUDA files, patching ldflags
Emitting ninja build file /home/sijia/.cache/torch_extensions/voxelize_cuda/build.ninja...
Building extension module voxelize_cuda...
Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
1.10.2
Loading extension module voxelize_cuda...
Traceback (most recent call last):
File "main_test.py", line 133, in
main_test_wo_gt_smpl_with_optm(input_image_dir,
File "main_test.py", line 36, in main_test_wo_gt_smpl_with_optm
from evaluator import Evaluator
File "/home/sijia/Desktop/PaMIR/networks/evaluator.py", line 23, in
from neural_voxelization_layer.voxelize import Voxelization
File "/home/sijia/Desktop/PaMIR/networks/neural_voxelization_layer/voxelize.py", line 13, in
voxelize_cuda = load(
File "/home/sijia/anaconda3/envs/pamir/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 969, in load
return _jit_compile(
File "/home/sijia/anaconda3/envs/pamir/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1196, in _jit_compile
return _import_module_from_library(name, build_directory, is_python_module)
File "/home/sijia/anaconda3/envs/pamir/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1543, in _import_module_from_library
file, path, description = imp.find_module(module_name, [path])
File "/home/sijia/anaconda3/envs/pamir/lib/python3.8/imp.py", line 296, in find_module
raise ImportError(_ERR_MSG.format(name), name=name)
ImportError: No module named 'voxelize_cuda'
(pamir) sijia@sijia-750-170se:~/Desktop/PaMIR/networks$ python3 main_test.py
True
Using /home/sijia/.cache/torch_extensions as PyTorch extensions root...
Detected CUDA files, patching ldflags
Emitting ninja build file /home/sijia/.cache/torch_extensions/voxelize_cuda/build.ninja...
Building extension module voxelize_cuda...
Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
1.10.2
Loading extension module voxelize_cuda...
Traceback (most recent call last):
File "main_test.py", line 133, in
main_test_wo_gt_smpl_with_optm(input_image_dir,
File "main_test.py", line 36, in main_test_wo_gt_smpl_with_optm
from evaluator import Evaluator
File "/home/sijia/Desktop/PaMIR/networks/evaluator.py", line 23, in
from neural_voxelization_layer.voxelize import Voxelization
File "/home/sijia/Desktop/PaMIR/networks/neural_voxelization_layer/voxelize.py", line 13, in
voxelize_cuda = load(
File "/home/sijia/anaconda3/envs/pamir/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 969, in load
return _jit_compile(
File "/home/sijia/anaconda3/envs/pamir/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1196, in _jit_compile
return _import_module_from_library(name, build_directory, is_python_module)
File "/home/sijia/anaconda3/envs/pamir/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1543, in _import_module_from_library
file, path, description = imp.find_module(module_name, [path])
File "/home/sijia/anaconda3/envs/pamir/lib/python3.8/imp.py", line 296, in find_module
raise ImportError(_ERR_MSG.format(name), name=name)
ImportError: No module named 'voxelize_cuda'

@jiangsijia9495
Copy link
Author

Fixed.
Cause of the issue: mismatch of the gcc, cuda versions (pytorch pre-compiled version made things worse).

Ubuntu: 18.04

Fix:

Install cuda 10.0 (https://developer.nvidia.com/cuda-10.0-download-archive)
Switch to gcc 7.3 (if you have many versions of gcc use update-alternatives. Ubuntu 18.04 comes by default with gcc 7.3.)
Install the pytoch pip3 install torch==1.7.0 torchvision==0.8.1 -f https://download.pytorch.org/whl/cu101/torch_stable.html
If you have many versions of cuda: add the following to ~/.bashrc and specify the cuda version you intend to use:
CUDAVER=cuda-10.0
export PATH=/usr/local/$CUDAVER/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/$CUDAVER/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/usr/local/$CUDAVER/lib64:$LD_LIBRARY_PATH
export CUDA_PATH=/usr/local/$CUDAVER
export CUDA_ROOT=/usr/local/$CUDAVER
export CUDA_HOME=/usr/local/$CUDAVER
export CUDA_HOST_COMPILER=/usr/bin/gcc-7.3
Closed.

@jiangsijia9495
Copy link
Author

add some tips about trimesh. If you find mesh.contains() return incorrect points. Check this link mikedh/trimesh#242 (comment)

@zoroinparis
Copy link

Fixed.
Cause of the issue: mismatch of the gcc, cuda versions (pytorch pre-compiled version made things worse).

Ubuntu: 18.04

Fix:

Install cuda 10.0 (https://developer.nvidia.com/cuda-10.0-download-archive)
Switch to gcc 7.3 (if you have many versions of gcc use update-alternatives. Ubuntu 18.04 comes by default with gcc 7.3.)
Install the pytoch pip3 install torch==1.7.0 torchvision==0.8.1 -f https://download.pytorch.org/whl/cu101/torch_stable.html
If you have many versions of cuda: add the following to ~/.bashrc and specify the cuda version you intend to use:
CUDAVER=cuda-10.0
export PATH=/usr/local/$CUDAVER/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/$CUDAVER/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/usr/local/$CUDAVER/lib64:$LD_LIBRARY_PATH
export CUDA_PATH=/usr/local/$CUDAVER
export CUDA_ROOT=/usr/local/$CUDAVER
export CUDA_HOME=/usr/local/$CUDAVER
export CUDA_HOST_COMPILER=/usr/bin/gcc-7.3
Closed.

@zoroinparis
Copy link

I got the same problem ,and i switch the version but nothing worked .Do you have any idea?

@jiangsijia9495
Copy link
Author

jiangsijia9495 commented Aug 24, 2021

FYI.
Evaluation CrisHY1995/StereoPIFu_Code#1 (comment)
And PIFuHD lib/evaluator

vertice.txt
Local class used to load and store SMPL's vertices coordinate at rest pose at mean shape

@jiangsijia9495
Copy link
Author

jiangsijia9495 commented Aug 27, 2021

installwifi.txt
For RTX 3090
Cuda 11.1, V11.1.105
Driver Version: 470.57.02

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