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: Failed to map segment from shared object for _C.so #29

Open
VoyageWang opened this issue Sep 26, 2024 · 2 comments
Open

ImportError: Failed to map segment from shared object for _C.so #29

VoyageWang opened this issue Sep 26, 2024 · 2 comments

Comments

@VoyageWang
Copy link

ImportError: Failed to map segment from shared object for _C.so

描述: run the code: python demo_video.py segmentation/evf-sam2-multitask
ImportError: /EVF-SAM/model/segment_anything_2/sam2/_C.so: failed to map segment from shared object

I have successfully compiled the code using python setup.py build_ext --inplace

/miniconda3/envs/evf-sam/lib/python3.10/site-packages/torch/utils/cpp_extension.py:428: UserWarning: There are no g++ version bounds defined for CUDA version 12.1
warnings.warn(f'There are no {compiler_name} version bounds defined for CUDA version {cuda_str_version}')
building 'sam2._C' extension
/miniconda3/envs/evf-sam/lib/python3.10/site-packages/torch/utils/cpp_extension.py:1967: UserWarning: TORCH_CUDA_ARCH_LIST is not set, all archs for visible cards are included for compilation.
If this is not desired, please set os.environ['TORCH_CUDA_ARCH_LIST'].
warnings.warn(
Emitting ninja build file EVF-SAM/model/segment_anything_2/build/temp.linux-x86_64-cpython-310/build.ninja...
Compiling objects...
Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
ninja: no work to do.
g++ -pthread -B /miniconda3/envs/evf-sam/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -fPIC -O2 -isystem miniconda3/envs/evf-sam/include -fPIC -O2 -isystem miniconda3/envs/evf-sam/include -pthread -B miniconda3/envs/evf-sam/compiler_compat -shared //EVF-SAM/model/segment_anything_2/build/temp.linux-x86_64-cpython-310/sam2/csrc/connected_components.o -Lminiconda3/envs/evf-sam/lib/python3.10/site-packages/torch/lib -L/cuda/cuda-12.1/lib64 -lc10 -ltorch -ltorch_cpu -ltorch_python -lcudart -lc10_cuda -ltorch_cuda -o build/lib.linux-x86_64-cpython-310/sam2/_C.so
copying build/lib.linux-x86_64-cpython-310/sam2/_C.so -> sam2

How to solve it, thanks for your attention!!!!

@CoderZhangYx
Copy link
Collaborator

Haven't encounter similar problem. Could you provide detailed compiling environment?
You may try:

  1. pip install -U ninja
  2. check if your python version, cuda version, pytorch version, cuda driver version, gpu type are compatible.

@VoyageWang
Copy link
Author

Thanks for your reply! I have tried the original sam2 repo, which is ok for me. However, it stiff faces the same issue when I try evf-sam2. The environment is here:

OS: [Ubuntu 20.04]
Python版本: [ 3.10]
PyTorch版本: [ 2.3.1]
CUDA版本: [12.1]
GPU型号: [ NVIDIA RTX 3090]

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