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

ipyflow kernel incompatible with google colab #147

Open
sadra-barikbin opened this issue Sep 4, 2023 · 5 comments
Open

ipyflow kernel incompatible with google colab #147

sadra-barikbin opened this issue Sep 4, 2023 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@sadra-barikbin
Copy link

Hi, I wanted to use the API of ipyflow (code function) in Google Colab but it raises an error.

from ipyflow import code
# cell 1
x=1
# cell 2
y=x+1
# cell 3
code(y)
python3.10/dist-packages/ipyflow/api/lift.py in _validate(sym)
     11 def _validate(sym: Any) -> Symbol:
     12     if sym is None or not isinstance(sym, Symbol):
---> 13         raise ValueError("unable to lookup metadata for symbol")
     14     return cast(Symbol, sym)
     15 

ValueError: unable to lookup metadata for symbol

The notebooks's kernel is ipyflow as follows:
image

@smacke
Copy link
Member

smacke commented Sep 5, 2023

Hmm, might be necessary to run %load_ext ipyflow on colab first; I'll take a look soon to try and figure out what's going on (responding from mobile at the moment).

@smacke
Copy link
Member

smacke commented Sep 5, 2023

Couldn't resist and just took a quick look. Seems that on colab, there's something about the ipyflow kernel subclass that conflicts with colab's own kernel subclass, which is why the dropdown doesn't appear to have an effect (it probably crashes on startup and causes colab to default to its normal kernel). (EDIT: was correct about the conflict, which is now fixed, but that turns out not to be the reason why the dropdown doesn't have an effect)

However, we can still use the ipyflow shell. After running %pip install ipyflow-core, you can run %load_ext ipyflow.shell, and from there ipyflow will start tracing (you'll probably get a warning from pydevd in the first cell you run after that) and it will start tracking dataflow, at which point you can use its APIs. (EDIT: %load_ext ipyflow now works)

@sadra-barikbin sadra-barikbin changed the title Using ipyflow or or its API in Google Colab Using ipyflow or its API in Google Colab Sep 5, 2023
@sadra-barikbin
Copy link
Author

I'm able to use the API now. thanks.

@smacke smacke changed the title Using ipyflow or its API in Google Colab ipyflow kernel incompatible with google colab Sep 5, 2023
@smacke smacke self-assigned this Sep 5, 2023
@smacke smacke added the bug Something isn't working label Sep 5, 2023
@smacke
Copy link
Member

smacke commented Sep 5, 2023

I'm actually going to keep this open because the kernel incompatibility looks like it's a genuine bug (and fixable, fortunately)

@smacke
Copy link
Member

smacke commented Sep 7, 2023

%load_ext ipyflow now works on the latest version of ipyflow (i.e. instead of %load_ext ipyflow.shell), but it looks like getting this kind of support automatically when the runtime is selected from the dropdown will need some help from the Colab side -- I opened googlecolab/colabtools#3988 for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants