[PR #521] Fix FileNotFoundError in Interacting_with_CLIP.ipynb for newer scikit-image versions #519

Open
opened 2026-10-31 21:15:41 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/openai/CLIP/pull/521
Author: @tonywjs
Created: 12/8/2025
Status: 🔄 Open

Base: main ← Head: fix/skimage-data-dir-error


📝 Commits (1)

  • c9f8abb Fix FileNotFoundError in Interacting_with_CLIP.ipynb for newer scikit-image versions

📊 Changes

1 file changed (+448 additions, -431 deletions)

View changed files

📝 notebooks/Interacting_with_CLIP.ipynb (+448 -431)

📄 Description

Problem

The notebook fails with FileNotFoundError when running on Google Colab with recent versions of scikit-image (0.25.x+):

FileNotFoundError: [Errno 2] No such file or directory: '/root/.cache/scikit-image/0.25.2/data'

This occurs because newer versions of scikit-image use lazy loading for sample images, and the skimage.data_dir directory may not exist until images are explicitly loaded.

Solution

Replace the directory-based image loading approach with direct function calls from skimage.data module:

  • Instead of iterating over os.listdir(skimage.data_dir), use the corresponding skimage.data functions directly
  • For motorcycle_right, use skimage.data.stereo_motorcycle()[1] since it's provided as part of a stereo image pair

Changes

  • Added get_motorcycle_right() helper function to retrieve the right motorcycle image from stereo_motorcycle()
  • Created image_functions dictionary mapping image names to their loader functions
  • Modified the image loading loop to call functions directly instead of reading from filesystem

Testing

Tested on Google Colab with:

  • Python 3.12
  • scikit-image 0.25.2
  • PyTorch 2.9.0+cu126

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/openai/CLIP/pull/521 **Author:** [@tonywjs](https://github.com/tonywjs) **Created:** 12/8/2025 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/skimage-data-dir-error` --- ### 📝 Commits (1) - [`c9f8abb`](https://github.com/openai/CLIP/commit/c9f8abbef1c2d8d9f974aa49e57e262f51178aff) Fix FileNotFoundError in Interacting_with_CLIP.ipynb for newer scikit-image versions ### 📊 Changes **1 file changed** (+448 additions, -431 deletions) <details> <summary>View changed files</summary> 📝 `notebooks/Interacting_with_CLIP.ipynb` (+448 -431) </details> ### 📄 Description ### Problem The notebook fails with FileNotFoundError when running on Google Colab with recent versions of scikit-image (0.25.x+): ``` FileNotFoundError: [Errno 2] No such file or directory: '/root/.cache/scikit-image/0.25.2/data' ``` This occurs because newer versions of scikit-image use lazy loading for sample images, and the skimage.data_dir directory may not exist until images are explicitly loaded. ### Solution Replace the directory-based image loading approach with direct function calls from skimage.data module: - Instead of iterating over os.listdir(skimage.data_dir), use the corresponding skimage.data functions directly - For motorcycle_right, use skimage.data.stereo_motorcycle()[1] since it's provided as part of a stereo image pair ### Changes - Added get_motorcycle_right() helper function to retrieve the right motorcycle image from stereo_motorcycle() - Created image_functions dictionary mapping image names to their loader functions - Modified the image loading loop to call functions directly instead of reading from filesystem ### Testing Tested on Google Colab with: - Python 3.12 - scikit-image 0.25.2 - PyTorch 2.9.0+cu126 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
openai/CLIP#519
No description provided.