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

Very slow. Want to run solara without CDN #355

Open aaronpliu opened 6 months ago

aaronpliu commented 6 months ago

I observed solara server running is so slow and it needs to request CDN. However, I'd like to run Solara server without internet access. As per instruction, installed "solara[assets]". Why does it still need to visit CDN?

Is there anyone take a look at it or something else to update? Please correct me I am wrong

Thanks

maartenbreddels commented 6 months ago

Hi,

thank you for opening the issue. Could you be more specific about "running slow"? What exactly is slow, and maybe you can share a screencast? What CDN visits do you see after you installed with solara[assets]? There should indeed be no cdn visits anymore after that.

Regards,

Maarten

aaronpliu commented 6 months ago

Thanks @maartenbreddels for your quick response.

I am new to solara. Just install it as per instruction and add one page to load it.

Steps:

  1. Install solara with "pip install solara[assets]"
  2. Add "First script" in sol.py
  3. Run "solara run sol.py"

Behavior: 1) Waiting for a long time (>30s) to start server 2) Waiting for a long time (>30s) to stop server 3) Page is loading for a long time 4) Throw error information ERROR: Exception in ASGI application ...... ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1129) ....... During handling of the above exception, another exception occurred: ...... urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='cdn.jsdelivr.net', port=443): Max retries exceed with url: /npm/mermaid@9.1.7/dist/mermaid.min.js (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1129)')))

requirements.txt anyio==4.0.0 appnope==0.1.3 asttokens==2.4.1 attrs==23.1.0 backcall==0.2.0 cachetools==5.3.2 certifi==2023.7.22 charset-normalizer==3.3.1 click==8.1.7 comm==0.1.4 debugpy==1.8.0 decorator==5.1.1 exceptiongroup==1.1.3 executing==2.0.1 fastjsonschema==2.18.1 filelock==3.13.0 h11==0.14.0 humanize==4.8.0 idna==3.4 importlib-metadata==6.8.0 ipykernel==6.26.0 ipython==8.16.1 ipyvue==1.10.1 ipyvuetify==1.8.10 ipywidgets==8.1.1 jedi==0.19.1 Jinja2==3.1.2 jsonschema==4.19.1 jsonschema-specifications==2023.7.1 jupyter_client==8.5.0 jupyter_core==5.4.0 jupyterlab-widgets==3.0.9 Markdown==3.5 markdown-it-py==3.0.0 MarkupSafe==2.1.3 matplotlib-inline==0.1.6 mdurl==0.1.2 nbformat==5.9.2 nest-asyncio==1.5.8 packaging==23.2 parso==0.8.3 pexpect==4.8.0 pickleshare==0.7.5 platformdirs==3.11.0 prompt-toolkit==3.0.39 psutil==5.9.6 ptyprocess==0.7.0 pure-eval==0.2.2 Pygments==2.16.1 pymdown-extensions==10.3.1 python-dateutil==2.8.2 PyYAML==6.0.1 pyzmq==25.1.1 reacton==1.7.2 referencing==0.30.2 requests==2.31.0 rich==13.6.0 rich-click==1.7.0 rpds-py==0.10.6 six==1.16.0 sniffio==1.3.0 solara==1.22.0 solara-assets==1.22.0 stack-data==0.6.3 starlette==0.31.1 tornado==6.3.3 traitlets==5.12.0 typing_extensions==4.8.0 urllib3==1.26.18 uvicorn==0.23.2 watchdog==3.0.0 wcwidth==0.2.8 websockets==12.0 widgetsnbextension==4.0.9 zipp==3.17.0

maartenbreddels commented 6 months ago

That sounds very strange. Which platform is this on (windows?), and does this only happen when you run an example with markdown (because that causes the mermaid run download, which is an open issue). Can you tell me more about what happens for the 30 seconds? If you press ctrl-c, what is the stacktrace?

aaronpliu commented 6 months ago

Running on MacOS (Ventura 13.1). no any output for a period of time when run "solara run sol.py", and then output "Solara server is starting at http://localhost:8765" in console, in the meantime, page is loading / spinning. displayed content at least few seconds later. and then show error information in console, but page is OK to interact and show. If I stop service (control-c), it has to wait (no response for couple of seconds), at the moment, page display server disconnecting...and then really exit.

maartenbreddels commented 3 months ago

Maybe solara 1.26.1 fixes this, it shouldn't try to fetch the mermaid assets from the CDN anymore.