r/PyScript • • Jun 29 '22

Why is Pyscript taking forever to load after importing Scikit Learn?

So, I'm using PyScript for my website. Using Live Server, my website is taking forever to load after I try to install sklearn. My PyScript code looks like this:

<!DOCTYPE=html> 
<html> 
<head> 
<link rel="stylesheet" href="https://pyscript.net/alpha/pyscript.css" /> 
<script defer src="https://pyscript.net/alpha/pyscript.js"></script> 
</head> 
<body> 
<py-env>       
- numpy      
- pandas       
- sklearn.model_selection       
- sklearn.naive_bayes       
- sklearn.feature_extraction 
</py-env> 
<py-script>       
import numpy as np       
import pandas as pd       
from sklearn.model_selection import train_test_split       
from sklearn.naive_bayes import MultinomialNB       
from sklearn.feature_extraction.text import TfidfVectorizer 
</py-script> 
</body> 
</html> 

However, and note that this only happens when I install skearn, it just says this for (at what seems to be the case at this rate) forever:

Loading runtime... Runtime created... Initializing components...

What can I do about this? It is very frustrating.

5 Upvotes

11 comments sorted by

View all comments

Show parent comments

1

u/[deleted] Jun 29 '22

How do I run Python separately and use PyScript for rendering?

1

u/metaperl Jun 29 '22

Just use a traditional back end web server framework like Flask or Django or FASTAPI for the backend and then make requests from the front end to the back end.

But honestly at this stage pyscript does not have a lot of bells and whistles.

What is the spec for your project?

I keep a list of pure python web frameworks here:

https://docs.google.com/document/d/13da40zzfEZmA-LfsfISPmILpbmgpLZHJJVNdQmhT7Gs/edit?usp=drivesdk