Skip to content

AttributeError: module 'pillow_heif' has no attribute 'register_avif_opener' when importing Roboflow #390

@krisnawan8-rahmanto

Description

@krisnawan8-rahmanto

Problem Description

When trying to import Roboflow in Google Colab after installing dependencies, encountering an AttributeError related to pillow_heif module.

Error Details

AttributeError: module 'pillow_heif' has no attribute 'register_avif_opener'

The error occurs in /usr/local/lib/python3.11/dist-packages/roboflow/util/image_utils.py at line 14 when trying to call pillow_heif.register_avif_opener(thumbnails=False).

Environment

  • Platform: Google Colab
  • Python Version: 3.11
  • Roboflow Version: 1.1.66
  • pillow-heif Version: 1.0.0

Steps to Reproduce

  1. Install dependencies:

    !pip uninstall -y pillow-heif
    !pip install roboflow torch torchvision matplotlib pillow pycocotools pandas
  2. Try to import Roboflow:

    from roboflow import Roboflow
  3. Error occurs during import

Expected Behavior

Roboflow should import successfully without any AttributeError.

Actual Behavior

Import fails with AttributeError about missing register_avif_opener method.

Context

This is part of a Fish Counter FRCNN project using hyperparameter tuning. The error is blocking the ability to download datasets from Roboflow for training.

Potential Solutions

  1. Pin pillow-heif to a compatible version
  2. Use alternative installation method
  3. Skip AVIF support if not required
  4. Update Roboflow's dependency handling

Impact

This error prevents users from using Roboflow in Google Colab environments, which is a common platform for machine learning experiments.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions