Skip to content

Fix false-positive dependency detection using importlib.util.find_spec#22

Open
dirlligafu wants to merge 1 commit into
6wheel:mainfrom
dirlligafu:fix-dependency-detection
Open

Fix false-positive dependency detection using importlib.util.find_spec#22
dirlligafu wants to merge 1 commit into
6wheel:mainfrom
dirlligafu:fix-dependency-detection

Conversation

@dirlligafu

Copy link
Copy Markdown

Why?

On some Windows setups, app.py would report scikit-image and scipy as missing even after a successful pip install -r requirements.txt (see #21). The root cause is the detection method: import() executes the module's init.py, which means a broken or missing transitive dependency triggers an ImportError that gets caught and misreported as the top-level package being absent.

Changes Made

  • Replaced import() with importlib.util.find_spec() in _check_dependencies() in app.py
  • find_spec() checks whether the package is locatable on sys.path without executing any module code, eliminating false positives caused by dependency chain errors at import time

Testing

Verified that all required packages resolve correctly via find_spec() on Python 3.14/Windows 11. Verified that a genuinely absent package still returns None as expected.

Related Issue

Closes #21

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing scikit-image, scipy, expect I am not missing them.

2 participants