Open VoyageWang opened 1 month ago
Haven't encounter similar problem. Could you provide detailed compiling environment? You may try:
pip install -U ninja
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]
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 objectI 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!!!!