facebookresearch / facebookresearch/sam3
Module `pkg_resources` not found. Problems running examples.
- Dominant language
- Python
- Stars
- 11.7k
- Forks
- 1.8k
- PR merge metrics
- No merged PRs in 30d
Description
### Description:
I was trying to run the `sam3_video_predictor_example.ipynb` notebook and encountered this problem when `import sam3` is called:
```bash
---------------------------------------------------------------------------
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:
```bash
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.
```bash
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`.
Contributor guide
Research direction
Start by reproducing the import failure with the Python 3.12 and editable-install commands in the issue, then inspect the package installation configuration and the imports in sam3/__init__.py and sam3/model_builder.py. Done means a clean installation can import sam3 and run the sam3_video_predictor_example.ipynb notebook without the pkg_resources error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100