Description:
I was trying to run the sam3_video_predictor_example.ipynb notebook and encountered this problem when import sam3 is called:
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
Cell In[10], line 2
1 import os
----> 2 import sam3
3 import torch
5 sam3_root = os.path.join(os.path.dirname(sam3.__file__), "..")
File ~/sam3/sam3/__init__.py:5
1 # Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved
2
3 # pyre-unsafe
----> 5 from .model_builder import build_sam3_image_model
7 __version__ = "0.1.0"
9 __all__ = ["build_sam3_image_model"]
File ~/sam3/sam3/model_builder.py:8
5 import os
6 from typing import Optional
----> 8 import pkg_resources
9 import torch
10 import torch.nn as nn
ModuleNotFoundError: No module named 'pkg_resources'
Reproduction:
mamba create -n sam3 python=3.12
mamba deactivate
mamba activate sam3
python -m pip install torch==2.7.0 torchvision torchaudio --index-url https://download.pytorch.org/whl/cu126
git clone https://github.com/facebookresearch/sam3.git
cd sam3
pip install -e .
pip install -e ".[notebooks]"
Possible fix:
This problem could be fixed for me by pinning the setuptools package.
python -m pip install --force-reinstall "setuptools<82"
This did the trick for me.
This seems to happen because the pkg_resources package has been deprecated after setuptools==81.
Description:
I was trying to run the
sam3_video_predictor_example.ipynbnotebook and encountered this problem whenimport sam3is called:--------------------------------------------------------------------------- ModuleNotFoundError Traceback (most recent call last) Cell In[10], line 2 1 import os ----> 2 import sam3 3 import torch 5 sam3_root = os.path.join(os.path.dirname(sam3.__file__), "..") File ~/sam3/sam3/__init__.py:5 1 # Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved 2 3 # pyre-unsafe ----> 5 from .model_builder import build_sam3_image_model 7 __version__ = "0.1.0" 9 __all__ = ["build_sam3_image_model"] File ~/sam3/sam3/model_builder.py:8 5 import os 6 from typing import Optional ----> 8 import pkg_resources 9 import torch 10 import torch.nn as nn ModuleNotFoundError: No module named 'pkg_resources'Reproduction:
Possible fix:
This problem could be fixed for me by pinning the
setuptoolspackage.python -m pip install --force-reinstall "setuptools<82"This did the trick for me.
This seems to happen because the
pkg_resourcespackage has been deprecated aftersetuptools==81.