widgetti / solara

A Pure Python, React-style Framework for Scaling Your Jupyter and Web Apps
https://solara.dev
MIT License
1.62k stars 105 forks source link

Circular import error #26

Closed samiit closed 1 year ago

samiit commented 1 year ago

Hi everyone,

After installing the latest Solara (as of today, 1.0.3) and trying to run the simple example shared by @maartenbreddels here

I am getting a circular import error. But things are fine if I use version 0.19.1

I tried to use even 1.0.0 version, but always get this error. Can someone please help?

Thanks, Sam

samiit commented 1 year ago

More specifically, the error I get is:

...

ImportError: cannot import name 'get_current_context' from partially initialized module 'solara.server.app' (most likely due to a circular import) (/home/sam/Projects/Learning/Python/WebApps/FastAPI/FastAPI_Solara/venv/lib/python3.9/site-packages/solara/server/app.py)
maartenbreddels commented 1 year ago

Hi Sam,

Yes, I noticed that as well when I was trying this out on github codespaces. I noticed it was due to a new ipykernel actually, that triggered a different code path. This was solved in ed35df9bb327d1230ce622aaaf67730e64750375 which will be released soon (I think today) in 1.0.4.

maartenbreddels commented 1 year ago

If you want to try it out, see the https://solara.dev/docs/installing instructions how to install a dev version, or install from master.

samiit commented 1 year ago

I tried that installing from master using

pip install git+https://github.com/widgetti/solara.git@master

but still get that error.

samiit commented 1 year ago

But I managed now to use the https://solara.dev/docs/installing instruction and it is working now!

Thanks.

maartenbreddels commented 1 year ago

Do you mean that:

$ pip install git+https://github.com/widgetti/solara.git@master

Did not work?

But

$ pip install "solara @ git+https://github.com/widgetti/solara"

worked ?

samiit commented 1 year ago

Yes. But I will confirm again. Maybe I did something wrong.

samiit commented 1 year ago

Hi @maartenbreddels

I checked now and both give the same results. Thanks.