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

Avoid overwriting the lightning_app entry point #20041

Merged
merged 3 commits into from
Jul 4, 2024

Conversation

awaelchli
Copy link
Member

@awaelchli awaelchli commented Jul 3, 2024

What does this PR do?

If both lightning and lightning-app is installed, and in particular lightning is installed after lightning-app, then the entry point of the main lightning overwrites the lightning_app entry point. After that, running an app with lightning_app run app app.py is no longer possible, resulting in this error:

Traceback (most recent call last):
  File "/opt/lightning/envs/main/bin/lightning_app", line 8, in <module>
    sys.exit(_cli_entry_point())
  File "/opt/lightning/envs/main/lib/python3.10/site-packages/lightning/__init__.py", line 49, in _cli_entry_point
    main()
  File "/opt/lightning/envs/main/lib/python3.10/site-packages/lightning/app/cli/lightning_cli.py", line 120, in main
    _main()
  File "/opt/lightning/envs/main/lib/python3.10/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/opt/lightning/envs/main/lib/python3.10/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/opt/lightning/envs/main/lib/python3.10/site-packages/lightning/app/utilities/exceptions.py", line 37, in invoke
    return super().invoke(ctx)
  File "/opt/lightning/envs/main/lib/python3.10/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/lightning/envs/main/lib/python3.10/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/lightning/envs/main/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/lightning/envs/main/lib/python3.10/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/opt/lightning/envs/main/lib/python3.10/site-packages/lightning/app/cli/lightning_cli.py", line 449, in run_work
    run_lightning_work(
  File "/opt/lightning/envs/main/lib/python3.10/site-packages/lightning/app/launcher/utils.py", line 42, in wrapper
    res = func(*args, **kwargs)
  File "/opt/lightning/envs/main/lib/python3.10/site-packages/lightning/app/launcher/utils.py", line 67, in wrapper
    res = func(*args, **kwargs)
  File "/opt/lightning/envs/main/lib/python3.10/site-packages/lightning/app/launcher/launcher.py", line 149, in run_lightning_work
   load_app_from_file(file)
  File "/opt/lightning/envs/main/lib/python3.10/site-packages/lightning/app/utilities/load_app.py", line 131, in load_app_from_file
    raise MisconfigurationException(
lightning.app.utilities.exceptions.MisconfigurationException: The provided file /content/app.py does not contain a LightningApp. Instantiate your app at the module level like so: `app = LightningApp(flow, ...)`

This PR avoids that by simply avoiding the redirection.

This was originally introduced in #19440 but I don't think it was intentional, and the removal should not be in conflict with that PR. We have redirection logic for the sdk anyway.


📚 Documentation preview 📚: https://pytorch-lightning--20041.org.readthedocs.build/en/20041/

cc @Borda @carmocca

Copy link
Contributor

github-actions bot commented Jul 3, 2024

🌩️ Required checks status: Pending 🟡

Groups summary

🟢 pytorch_lightning: Azure GPU
Check ID Status
pytorch-lightning (GPUs) (testing Lightning | latest) success
pytorch-lightning (GPUs) (testing PyTorch | latest) success

These checks are required after the changes to src/lightning/__setup__.py.

🟢 lightning_fabric: Azure GPU
Check ID Status
lightning-fabric (GPUs) (testing Fabric | latest) success
lightning-fabric (GPUs) (testing Lightning | latest) success

These checks are required after the changes to src/lightning/__setup__.py.

🟡 lightning: Store
Check ID Status
store-cpu (macOS-11, lightning, 3.10, 2.0) queued
store-cpu (ubuntu-20.04, lightning, 3.10, 2.0) success
store-cpu (windows-2022, lightning, 3.10, 2.0) success

These checks are required after the changes to src/lightning/__setup__.py.

🟢 mypy
Check ID Status
mypy success

These checks are required after the changes to src/lightning/__setup__.py, src/version.info.

🟡 install
Check ID Status
install-pkg (ubuntu-22.04, app, 3.8) no_status
install-pkg (ubuntu-22.04, app, 3.11) no_status
install-pkg (ubuntu-22.04, fabric, 3.8) no_status
install-pkg (ubuntu-22.04, fabric, 3.11) no_status
install-pkg (ubuntu-22.04, pytorch, 3.8) no_status
install-pkg (ubuntu-22.04, pytorch, 3.11) no_status
install-pkg (ubuntu-22.04, lightning, 3.8) no_status
install-pkg (ubuntu-22.04, lightning, 3.11) no_status
install-pkg (ubuntu-22.04, notset, 3.8) no_status
install-pkg (ubuntu-22.04, notset, 3.11) no_status
install-pkg (macOS-12, app, 3.8) no_status
install-pkg (macOS-12, app, 3.11) no_status
install-pkg (macOS-12, fabric, 3.8) no_status
install-pkg (macOS-12, fabric, 3.11) no_status
install-pkg (macOS-12, pytorch, 3.8) no_status
install-pkg (macOS-12, pytorch, 3.11) no_status
install-pkg (macOS-12, lightning, 3.8) no_status
install-pkg (macOS-12, lightning, 3.11) no_status
install-pkg (macOS-12, notset, 3.8) no_status
install-pkg (macOS-12, notset, 3.11) no_status
install-pkg (windows-2022, app, 3.8) no_status
install-pkg (windows-2022, app, 3.11) no_status
install-pkg (windows-2022, fabric, 3.8) no_status
install-pkg (windows-2022, fabric, 3.11) no_status
install-pkg (windows-2022, pytorch, 3.8) no_status
install-pkg (windows-2022, pytorch, 3.11) no_status
install-pkg (windows-2022, lightning, 3.8) no_status
install-pkg (windows-2022, lightning, 3.11) no_status
install-pkg (windows-2022, notset, 3.8) no_status
install-pkg (windows-2022, notset, 3.11) no_status

These checks are required after the changes to .github/workflows/ci-pkg-install.yml, src/lightning/__setup__.py, src/version.info.


Thank you for your contribution! 💜

Note
This comment is automatically generated and updates for 60 minutes every 180 seconds. If you have any other questions, contact carmocca for help.

@awaelchli awaelchli added this to the 2.3.x milestone Jul 3, 2024
@github-actions github-actions bot added ci Continuous Integration package labels Jul 3, 2024
@awaelchli awaelchli changed the base branch from master to release/stable July 3, 2024 22:27
@mergify mergify bot added the ready PRs ready to be merged label Jul 4, 2024
@github-actions github-actions bot added release fabric lightning.fabric.Fabric labels Jul 4, 2024
@lantiga lantiga merged commit 056bb08 into release/stable Jul 4, 2024
20 of 22 checks passed
@lantiga lantiga deleted the removal/entrypoint branch July 4, 2024 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci Continuous Integration fabric lightning.fabric.Fabric package ready PRs ready to be merged release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants