Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

change Module not found error to a more verbose pip install command #347

Conversation

just-eoghan
Copy link
Contributor

@just-eoghan just-eoghan commented May 27, 2021

What does this PR do?

Change if not _IMAGE_AVAILABLE: ModuleNotFoundError message in flash.image.detection.model.py line 97.

From: raise ModuleNotFoundError("Please, pip install . [image]")
To: raise ModuleNotFoundError("Please, pip install lightning-flash[image]")

Fixes # (issue)

Before submitting

  • Was this discussed/approved via a Github issue? (no need for typos and docs improvements)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure your PR does only one thing, instead of bundling different changes together?
  • Did you make sure to update the documentation with your changes?
  • Did you write any new necessary tests? [not needed for typos/docs]
  • Did you verify new and existing tests pass locally with your changes?
  • If you made a notable change (that affects users), did you update the CHANGELOG?

PR review

  • Is this pull request ready for review? (if not, please submit in draft mode)

@akihironitta
Copy link
Contributor

@deepseek-eoghan Thank you for submitting this PR! LGTM! Could you also update all occurrences in the codebase?

$ grep -rn "pip install" flash
flash/tabular/classification/model.py:60:            raise ModuleNotFoundError("Please, pip install -e '.[tabular]'")
flash/video/classification/data.py:137:            raise ModuleNotFoundError("Please, run `pip install pytorchvideo`.")
flash/image/style_transfer/model.py:97:            raise ModuleNotFoundError("Please, pip install -e '.[image_style_transfer]'")
flash/image/segmentation/model.py:89:            raise ModuleNotFoundError("Please, pip install -e '.[image]'")
flash/image/segmentation/data.py:83:            raise ModuleNotFoundError("Please, pip install -e '.[image]'")
flash/image/segmentation/data.py:175:            raise ModuleNotFoundError("Please, pip install -e '.[image]'")
flash/image/segmentation/data.py:404:            raise MisconfigurationException("You need matplotlib to visualise. Please, pip install matplotlib")
flash/image/embedding/model.py:63:            raise ModuleNotFoundError("Please, pip install -e '.[image]'")
flash/image/detection/model.py:97:            raise ModuleNotFoundError("Please, pip install . '[image]'")
flash/image/classification/data.py:120:            raise MisconfigurationException("You need matplotlib to visualise. Please, pip install matplotlib")
flash/text/seq2seq/core/model.py:69:            raise ModuleNotFoundError("Please, pip install -e '.[text]'")
flash/text/seq2seq/core/data.py:46:            raise ModuleNotFoundError("Please, pip install -e '.[text]'")
flash/text/seq2seq/core/data.py:193:            raise ModuleNotFoundError("Please, pip install -e '.[text]'")
flash/text/seq2seq/summarization/utils.py:27:    assert nltk, "nltk must be installed to separate newlines between sentences. (pip install nltk)"
flash/text/seq2seq/summarization/data.py:30:            raise ModuleNotFoundError("Please, pip install -e '.[text]'")
flash/text/seq2seq/summarization/metric.py:63:            raise ModuleNotFoundError("Please, pip install -e '.[text]'")
flash/text/classification/model.py:53:            raise ModuleNotFoundError("Please, pip install -e '.[text]'")
flash/text/classification/data.py:39:            raise ModuleNotFoundError("Please, pip install -e '.[text]'")
flash/text/classification/data.py:160:            raise ModuleNotFoundError("Please, pip install -e '.[text]'")

@akihironitta akihironitta added documentation Improvements or additions to documentation enhancement New feature or request labels May 27, 2021
@just-eoghan
Copy link
Contributor Author

I've updated those listed above @akihironitta can the -e flag be removed from pip install -e x is there a reason for installing in editable mode?

Copy link
Collaborator

@ethanwharris ethanwharris left a comment

Choose a reason for hiding this comment

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

Nice work @deepseek-eoghan 😃 Yeah, you can drop the -e too. You'd only use it when installing for dev purposes.

@codecov
Copy link

codecov bot commented May 28, 2021

Codecov Report

Merging #347 (a0ba2ca) into master (1054949) will not change coverage.
The diff coverage is 26.66%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #347   +/-   ##
=======================================
  Coverage   88.82%   88.82%           
=======================================
  Files          80       80           
  Lines        4143     4143           
=======================================
  Hits         3680     3680           
  Misses        463      463           
Flag Coverage Δ
gpu ?
pytest ?
unittests 88.82% <26.66%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
flash/image/detection/model.py 80.00% <0.00%> (ø)
flash/image/embedding/model.py 40.35% <0.00%> (ø)
flash/image/segmentation/model.py 89.83% <0.00%> (ø)
flash/text/classification/model.py 89.47% <0.00%> (ø)
flash/text/seq2seq/core/data.py 87.33% <0.00%> (ø)
flash/text/seq2seq/core/model.py 64.28% <0.00%> (ø)
flash/text/seq2seq/summarization/metric.py 55.55% <0.00%> (ø)
flash/image/segmentation/data.py 88.75% <50.00%> (ø)
flash/text/classification/data.py 88.32% <50.00%> (ø)
flash/image/style_transfer/model.py 85.71% <100.00%> (ø)
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1054949...a0ba2ca. Read the comment docs.

@mergify mergify bot removed the has conflicts label May 29, 2021
Copy link
Contributor

@akihironitta akihironitta left a comment

Choose a reason for hiding this comment

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

@deepseek-eoghan LGTM!

Copy link
Collaborator

@ethanwharris ethanwharris left a comment

Choose a reason for hiding this comment

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

LGTM 😃

@ethanwharris ethanwharris merged commit 9c5dbd7 into Lightning-Universe:master May 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Improvements or additions to documentation enhancement New feature or request Ready to Go
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants