#256·FastSAM

No module named 'ultralytics.yolo'

Author: bminevichCreated Nov 4, 2024Updated Sep 30, 2025

I followed the steps listed. I saved the repository locally, made a new python environment locally (3.9), then I ran the requirements.txt file, uninstalled torch and torchvision and installed the cuda versions, and then I ran the setup.py file.

But I am getting this error:

ModuleNotFoundError Traceback (most recent call last) Cell In[1], line 8 5 import cv2 6 import tifffile as tf ----> 8 from fastsam import FastSAM, FastSAMPrompt 9 import torch 10 import glob

File ~/.conda/envs/image_analysis/lib/python3.9/site-packages/fastsam/init.py:3 1 # Ultralytics YOLO , AGPL-3.0 license ----> 3 from .model import FastSAM 4 from .predict import FastSAMPredictor 5 from .prompt import FastSAMPrompt

File ~/.conda/envs/image_analysis/lib/python3.9/site-packages/fastsam/model.py:12 1 # Ultralytics YOLO , AGPL-3.0 license 2 """ 3 FastSAM model interface. 4 (...) 9 results = model.predict('ultralytics/assets/bus.jpg') 10 """ ---> 12 from ultralytics.yolo.cfg import get_cfg 13 from ultralytics.yolo.engine.exporter import Exporter 14 from ultralytics.yolo.engine.model import YOLO

ModuleNotFoundError: No module named 'ultralytics.yolo'

How do I resolve this issue?