Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐞Replace package_available with module_available #2407

Merged

Conversation

harimkang
Copy link
Collaborator

@harimkang harimkang commented Nov 5, 2024

📝 Description

This PR replaces package_available with module_available from the lightning-utilities package.

  • package_available: This function does not check that the actual import works; it simply checks whether the spec for that package exists. Passing this may actually cause an error on import depending on environment.
  • module_available: This checks to see if the actual import will work.

Due to the above differences, anomalib install is currently not running.

How I discovered this issue:

pip install -e .
anomalib install

To use other subcommand using `anomalib install`
Traceback (most recent call last):
  File "/home/harimkan/workspace/repo/anomalib/venv/bin/anomalib", line 5, in <module>
    from anomalib.cli.cli import main
  File "/home/harimkan/workspace/repo/anomalib/src/anomalib/cli/__init__.py", line 6, in <module>
    from .cli import AnomalibCLI
  File "/home/harimkan/workspace/repo/anomalib/src/anomalib/cli/cli.py", line 18, in <module>
    from anomalib.cli.pipelines import PIPELINE_REGISTRY, pipeline_subcommands, run_pipeline
  File "/home/harimkan/workspace/repo/anomalib/src/anomalib/cli/pipelines.py", line 16, in <module>
    from anomalib.pipelines import Benchmark
  File "/home/harimkan/workspace/repo/anomalib/src/anomalib/pipelines/__init__.py", line 6, in <module>
    from .benchmark import Benchmark
  File "/home/harimkan/workspace/repo/anomalib/src/anomalib/pipelines/benchmark/__init__.py", line 6, in <module>
    from .pipeline import Benchmark
  File "/home/harimkan/workspace/repo/anomalib/src/anomalib/pipelines/benchmark/pipeline.py", line 6, in <module>
    import torch
ModuleNotFoundError: No module named 'torch'

✨ Changes

Select what type of change your PR is:

  • 🐞 Bug fix (non-breaking change which fixes an issue)
  • 🔨 Refactor (non-breaking change which refactors the code base)
  • 🚀 New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📚 Documentation update
  • 🔒 Security update

✅ Checklist

Before you submit your pull request, please make sure you have completed the following steps:

  • 📋 I have summarized my changes in the CHANGELOG and followed the guidelines for my type of change (skip for minor changes, documentation updates, and test enhancements).
  • 📚 I have made the necessary updates to the documentation (if applicable).
  • 🧪 I have written tests that support my changes and prove that my fix is effective or my feature works (if applicable).

For more information about code review checklists, see the Code Review Checklist.

Signed-off-by: Kang, Harim <harim.kang@intel.com>
Copy link

codecov bot commented Nov 5, 2024

Codecov Report

Attention: Patch coverage is 94.11765% with 1 line in your changes missing coverage. Please review.

Project coverage is 81.96%. Comparing base (6ed0067) to head (98bb5ae).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...rc/anomalib/models/components/base/export_mixin.py 66.66% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2407   +/-   ##
=======================================
  Coverage   81.95%   81.96%           
=======================================
  Files         283      283           
  Lines       12539    12539           
=======================================
+ Hits        10276    10277    +1     
+ Misses       2263     2262    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@ashwinvaidya17 ashwinvaidya17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a ton!

@harimkang harimkang merged commit bcc0b43 into openvinotoolkit:main Nov 5, 2024
7 checks passed
samet-akcay pushed a commit to samet-akcay/anomalib that referenced this pull request Nov 5, 2024
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.

2 participants