pytorch-lightning icon indicating copy to clipboard operation
pytorch-lightning copied to clipboard

Unable to start a lighting app

Open krishnakalyan3 opened this issue 3 years ago • 4 comments

First check

  • [x] I'm sure this is a bug.
  • [X] I've added a descriptive title to this bug.
  • [X] I've provided clear instructions on how to reproduce the bug.
  • [X] I've added a code sample.
  • [X] I've provided any other important info that is required.

Bug description

I am unable to run lightning apps on my M1 mac locally. Error below

How to reproduce the bug

import lightning as L

class SingleWorkFlow(L.LightningWork):
    def __init__(self):
        super().__init__()

    def run(self):
        print(f"Hello World")


class RootFlow(L.LightningFlow):
    def __init__(self):
        super().__init__()
        self.single_work = SingleWorkFlow()

    def run(self):
        self.single_work.run()

app = L.LightningApp(RootFlow())

Error messages and logs

On running 

python -m lightning run app hello.py


You are connected to the cloud Lightning App: 01gd3eha9tnehec8s4n2hq7f01.
Traceback (most recent call last):
  File "/Users/krishna/opt/anaconda3/envs/addverb/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/Users/krishna/opt/anaconda3/envs/addverb/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/Users/krishna/opt/anaconda3/envs/addverb/lib/python3.9/site-packages/lightning/__main__.py", line 4, in <module>
    main()
  File "/Users/krishna/opt/anaconda3/envs/addverb/lib/python3.9/site-packages/lightning_app/cli/lightning_cli.py", line 68, in main
    _run_app_command(app_name, app_id)
  File "/Users/krishna/opt/anaconda3/envs/addverb/lib/python3.9/site-packages/lightning_app/cli/commands/app_commands.py", line 18, in _run_app_command
    raise Exception("We couldn't find any matching running App.")
Exception: We couldn't find any matching running App.```

Important info

lightning               2022.9.8
lightning-app           0.6.0
lightning-cloud         0.5.3
lightning-utilities     0.3.0
pytorch-lightning       1.7.6
OSX 12.5

More info

Also added a breakpoint here

(Pdb) app_name
'01gd3eha9tnehec8s4n2hq7f01'
(Pdb) app_id
'01gd3eha9tnehec8s4n2hq7f01'
(Pdb) _retrieve_application_url_and_available_commands(app_id)
(None, None, None)
(Pdb) 

cc: @kaushikb11

krishnakalyan3 avatar Sep 19 '22 10:09 krishnakalyan3

Looks like this issue is a bug. As a workaround run lightning disconnect. If someone forgets to disconnect from an app this can lead to the bug described above.

cc: @hhsecond, @robert-s-lee

krishnakalyan3 avatar Sep 20 '22 12:09 krishnakalyan3

If this is expected, we should improve the error message by asking our users to disconnect from the application first.

krishnakalyan3 avatar Sep 20 '22 12:09 krishnakalyan3

What do we think about connect being env var based by default (a la conda)? I’ve been bitten by forgetting to disconnect multiple times, assuming that closing the terminal session would disconnect. We could make it persistent (file-based) opt-in with an extra flag.

WDYT @tchaton ?

lantiga avatar Sep 20 '22 14:09 lantiga

@lantiga We could, but we wanted something more persistent. Personally, I don't mind either way. I think users could ask for both depending on the use case.

tchaton avatar Sep 20 '22 16:09 tchaton

This issue has been automatically marked as stale because it hasn't had any recent activity. This issue will be closed in 7 days if no further activity occurs. Thank you for your contributions, PyTorch Lightning Team!

stale[bot] avatar Oct 29 '22 23:10 stale[bot]