Lightning-Universe/lightning-flash

ObjectDetectionData is missing dependencies even though pip worked

NikolasE opened this issue ยท 2 comments

๐Ÿ› Bug

I want to create an ObjectDetectionData-object but get the error message:
"ModuleNotFoundError: Required dependencies not available. Please run: pip install 'icevision' 'lightning-flash[image]'"
Even though I successfully executed the pip install.

To Reproduce / Code sample

pip install 'icevision' 'lightning-flash[image]'

# collect some data
from flash import Trainer
from flash.image import ObjectDetector, ObjectDetectionData

datamodule = ObjectDetectionData.from_files(
            train_files=train_files,
            train_targets=train_targets,
            train_bboxes=train_bboxes,
            predict_files=list(),
            transform_kwargs=dict(image_size=(128, 128)), 
            batch_size=2, 
)

Expected behavior

ObjectDetectionData-instance is created

Environment

  • OS (e.g., Linux): Ubuntu
  • Python version: 3
  • PyTorch/Lightning/Flash Version (e.g., 1.10/1.5/0.7): 1.10.2/1.8.3.post1/0.8.1
  • GPU models and configuration:
  • Any other relevant information:

Additional context

Hi @NikolasE thanks for reporting this. After a bit of digging it looks like this is caused by one of the dependencies of icevision being upgraded causing compatibility issues. The icevision repo has a fix but it hasnโ€™t been released yet, until then the solution is to run:

pip install 'sahi<0.11'

Hope that helps ๐Ÿ˜ƒ

I'll leave this issue open until the fix in icevision is released

@Borda Icevision isn't in any extras, instead it's intended to be installed separately