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: libtorch_cuda_cu.so: cannot open shared object file: No such file or directory #213

Open
Vaishnav-B opened this issue Jul 4, 2024 · 4 comments

Comments

@Vaishnav-B
Copy link

warnings.warn(
/local/mnt2/workspace/vaisb/miniconda3/envs/vaisb_PyTorch_13/lib/python3.8/site-packages/torchvision/io/image.py:13: UserWarning: Failed to load image Python extension: libtorch_cuda_cu.so: cannot open shared object file: No such file or directory
warn(f"Failed to load image Python extension: {e}")
Traceback (most recent call last):
File "./tools/test.py", line 17, in
from mmdet3d.apis import single_gpu_test
File "/local/mnt2/workspace/vaisb/StreamPETR/mmdetection3d/mmdet3d/apis/init.py", line 2, in
from .inference import (convert_SyncBN, inference_detector,
File "/local/mnt2/workspace/vaisb/StreamPETR/mmdetection3d/mmdet3d/apis/inference.py", line 12, in
from mmdet3d.core import (Box3DMode, CameraInstance3DBoxes, Coord3DMode,
File "/local/mnt2/workspace/vaisb/StreamPETR/mmdetection3d/mmdet3d/core/init.py", line 2, in
from .anchor import * # noqa: F401, F403
File "/local/mnt2/workspace/vaisb/StreamPETR/mmdetection3d/mmdet3d/core/anchor/init.py", line 2, in
from mmdet.core.anchor import build_prior_generator
File "/local/mnt2/workspace/vaisb/miniconda3/envs/vaisb_PyTorch_13/lib/python3.8/site-packages/mmdet/core/init.py", line 3, in
from .bbox import * # noqa: F401, F403
File "/local/mnt2/workspace/vaisb/miniconda3/envs/vaisb_PyTorch_13/lib/python3.8/site-packages/mmdet/core/bbox/init.py", line 8, in
from .samplers import (BaseSampler, CombinedSampler,
File "/local/mnt2/workspace/vaisb/miniconda3/envs/vaisb_PyTorch_13/lib/python3.8/site-packages/mmdet/core/bbox/samplers/init.py", line 12, in
from .score_hlr_sampler import ScoreHLRSampler
File "/local/mnt2/workspace/vaisb/miniconda3/envs/vaisb_PyTorch_13/lib/python3.8/site-packages/mmdet/core/bbox/samplers/score_hlr_sampler.py", line 3, in
from mmcv.ops import nms_match
File "/local/mnt2/workspace/vaisb/miniconda3/envs/vaisb_PyTorch_13/lib/python3.8/site-packages/mmcv/ops/init.py", line 2, in
from .active_rotated_filter import active_rotated_filter
File "/local/mnt2/workspace/vaisb/miniconda3/envs/vaisb_PyTorch_13/lib/python3.8/site-packages/mmcv/ops/active_rotated_filter.py", line 10, in
ext_module = ext_loader.load_ext(
File "/local/mnt2/workspace/vaisb/miniconda3/envs/vaisb_PyTorch_13/lib/python3.8/site-packages/mmcv/utils/ext_loader.py", line 13, in load_ext
ext = importlib.import_module('mmcv.' + name)
File "/local/mnt2/workspace/vaisb/miniconda3/envs/vaisb_PyTorch_13/lib/python3.8/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: libtorch_cuda_cu.so: cannot open shared object file: No such file or directory

Hey, I'm trying to run the StreamPETR model on PyTorch 1.13 but am running into this error
Previously I was using PyTorch 1.12 and that worked fine. Now I want to upgrade to PyTorch 1.13
Also wanted to ask about support for PyTorch 2.x. What changes need to be done for running StreamPETR with PyTorch 2.x

@haofuly
Copy link

haofuly commented Jul 10, 2024

@Vaishnav-B
Have you ever solve this error? Thanks.

@Vaishnav-B
Copy link
Author

@Vaishnav-B Have you ever solve this error? Thanks.

@haofuly
I haven't been able to solve it yet.

@haofuly
Copy link

haofuly commented Jul 11, 2024

@Vaishnav-B Have you ever solve this error? Thanks.

@haofuly I haven't been able to solve it yet.

@Vaishnav-B
I have solved it. The mistake lies in the Environment Setup Procedure. You must follow the instruction:
pip install torch==1.9.0+cu111 torchvision==0.10.0+cu111 torchaudio==0.9.0 -f https://download.pytorch.org/whl/torch_stable.html
rather than install torch using Pytorch official instruction. It's also OK to download the .whl files in https://download.pytorch.org/whl/torch_stable.html and install them manually.

@Vaishnav-B
Copy link
Author

@Vaishnav-B Have you ever solve this error? Thanks.

@haofuly I haven't been able to solve it yet.

@Vaishnav-B I have solved it. The mistake lies in the Environment Setup Procedure. You must follow the instruction: pip install torch==1.9.0+cu111 torchvision==0.10.0+cu111 torchaudio==0.9.0 -f https://download.pytorch.org/whl/torch_stable.html rather than install torch using Pytorch official instruction. It's also OK to download the .whl files in https://download.pytorch.org/whl/torch_stable.html and install them manually.

@haofuly
I want to use PyTorch 1.13.1. It works for me on PyTorch 1.12.1 but I want to migrate to PyTorch 1.13.1

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