Hey y’all! One fix that made the altair issue work for me was -> running the following in the powershell visual studio code command (windows): ~> npm outdated And then ~> npm update Please note, there’s no need for the altair
@@andfanilo !!!!!!!QUICK UPDATE!!!!!!! [[[How to create a Streamlit desktop app]]] Create the following package.json file to start a new NPM project. Edit the name field. { “name”: “xxx”, “version”: “0.1.0”, “main”: “./build/electron/main.js”, “scripts”: { “dump”: “dump-stlite-desktop-artifacts”, “serve”: “cross-env NODE_ENV=production electron .”, “pack”: “electron-builder --dir”, “dist”: “electron-builder”, “postinstall”: “electron-builder install-app-deps” }, “build”: { “files”: [“build/**/*”], “directories”: { “buildResources”: “assets” } }, --------------------------------------------------------------- “devDependencies”: { “@stlite/desktop”: “^0.25.0”, “cross-env”: “^7.0.3”, “electron”: “23.1.1”, “electron-builder”: “^23.6.0” } } Here you should change it to the following: ->->->->->->->->->->->->->->->->->->->->->-> }, “devDependencies”: { “@stlite/desktop”: “^0.31.0”, “cross-env”: “^7.0.3”, (check your version, by running npm show cross-env in the command) “electron”: “23.1.1”, (check your version - for me it was 23.1.1) “electron-builder”: “^24.4.0” (depending on the version) } } 2. Run npm update (instead of npm install). 3. Create streamlit_app directory. o Any directory name can be used here. 4. Create streamlit_app/streamlit_app.py. o Change the directory name if you used a different name in the previous step. 5. Write your Streamlit app code in streamlit_app/streamlit_app.py. o The file name streamlit_app.py is not configurable now. 6. Optionally, you can add more contents in the directory, including pages/*.py for multi-page apps, any data files, and so on. 7. Run npm run dump streamlit_app - -r requirements.txt (the requirements file includes like the following: streamlit plotly pandas 8. Run npm run serve (or similar to the video -servewindows) 9. Run npm run dist or yarn dist for packaging. o This command bundles the ./build directory created in the step above into application files (.app, .exe, .dmg etc.) in the ./dist directory. To customize the built app, e.g. setting the icon, follow the electron-builder instructions.
Tired this out my self a few weeks back and it really is a great step forward! Unfortunately, I couldn’t persist a local database due to Electron security restrictions. I also tried MongoDB and Firebase for cloud storage, but I believe the imports included C-extensions, preventing it from working. Great video by the way 👍🏼
Thanks for mentioning. I had seen an issue on this (github.com/whitphx/stlite/issues/463), I just forgot to script this and the general issues on interacting back with the local filesystem 🥲 . Hope other viewers will catch your comment. And that sucks for the external databases, we'll have to wait for the C-extension packages...I'm generally hopeful the Python with WASM ecosystem will keep growing with the efforts on PyScript, and this solution is still easier to setup than PyInstaller/PyOxidizer, so fingers crossed Have a nice day, thanks for watching!
Appreciate the reply 😊 It certainly would be great to see the WASM ecosystem continue to grow and am hopeful there will be a DB solution in the near future.
Well, yeah it would be cool if someone took the matter in its hands. Though converting a web app to a desktop app is a nightmare on its own and I doubt someone wants to invest more time in it, seeing how much Yuichiro has already poured into stlite/Pyodide. I think Solara and Panel are researching alternative solutions for packaging web into desktop. We'll have to see if someone comes with a creative solution that can be passed to all the web frameworks Until then, we'll have to suffer in silence 😥
Unfortunately this doesn't work if your code contains modules/packages that written other languages than python, and/or if it can't find .whl package of that module my issue was the first one. I have bunch of module that written in other languages such as c++ etc on my python-streamlit project. Any suggestion for this will be appreciated.
Hello! Yes, Pyodide clearly won't be able to manage any of those non pure-python packages, as you may have seen in other comments :/ you may have more luck with Pyinstaller but I find packaging Streamlit with Pyinstaller to be extra painful.. Unfortunately, I don't think it will be easy to install multiple non-python binaries on non tech-saavy people's computers, and for now my preferred way of doing would be to Dockerize the app or install it yourself on a private server/in a VM in the cloud and provide an URL to your audience. If I find any other easy way I'll write it down in a community post Have a nice day!
Hello, When executing the command 'run npm servewindows, the error is returned: "ModuleNotFoundError: No module named 'ssl'". Does anyone know the solution?
🙃 Maybe that was my dream job all along Have you watched my Epic Book Trailer ( ua-cam.com/video/xubQ0lsiV44/v-deo.html ) ? I feel this one was the most intense I produced 😆
Hi and thanks for the useful implementation. Following your procedure, at the point where I run the command "npm run serve" I obtain an ENOENT error saying that a file is missing in the stlite-manifest.json. Any idea what could be the issue?
Hello! Hmmm I never had that and I can't imagine where it comes from...I don't know if there was a new version of stlite that is missing such file, can you try writing your issue on the original repo: github.com/whitphx/stlite/issues ?
Hey! It's been a while since I used stlite...I'm currently out of work schedule for a while, so your best bet for now would be to post your issue on github.com/whitphx/stlite/issues 🤔 That "Attribute" thing is strange, not sure it would be your fault so I hope the author of the package will find a better explanation for the problem!
Great video! However it is not working for me (stlite-manifest.json is missing). Do you know if the steps are the same if large files are in the repo? I built an LLM chatbot (locally downloaded open-source model). Would be cool to see a wallthrough!
Hey there! I don't know if there was a recent update that change the behavior of stlite-manifest.json or something, you could try asking on github.com/whitphx/stlite/issues I haven't tried to package a downloaded HF model in an .exe though, I don't know if that would be easy...I'll try a bit on my side later on, do tell us if you make progress, I'd love to know
Same issue on my side with latest package.json file (@stlite/desktop :0.39.0) Update : It worked on my personnal laptop. I wonder if that's related to vpn restriction 🤔
Hey, from memory the stlite build is not cross-platform, so you’re building on windows for other windows machines, but need to build on a Mac for Mac machines and Linux for Linux You could do that using GitHub actions for example, by having a build step on multiple operating systems. And you need to change the os target in the electron-builder configuration, I remember I talk about this at the end of the video 🤔 (it was a long time ago already..)
I am facing an issue of " no module named matplotlib" , even tho I am using the version specified in pyodide, also I am unable to use folium because of the same reason. Help would be appreciated 😊
Hey! It's been a while since I used stlite...I'm currently out of work schedule for a while, so your best bet for now would be to post your issue on github.com/whitphx/stlite/issues 🤔 Hopefully he can get your dependency versions solved!
i am getting "module not found error" in the step "Error during boot up" can u plz help where to install i tried all combinations it gives error streamlit v17 already available so can't install v22 not sure how to debug... wasted 2 full days on this... :-( any help appreciated
Hey! I may have forgotten to mention in the video...you can't install a newer version of Streamlit in stlite (there's a pyodide issue preventing users to install a newer version of a package), so the version of stlite hardcodes the version of Streamlit. For now you may have to remove Streamlit for the list of requirements.txt. Yuichiro, author of stlite, would need to build a new stlite version for the new Streamlit v1.22 version, see this github.com/whitphx/stlite/issues/557 Hope it helps!
Great tutorial!! Thank you ! Will a streamlip app that web-scrapes live data from websites (using requests, beautifulSoup etc), still work when converted to a standalone executable?
Thanks for the support! The list of Pyodide maintained packages can be found here pyodide.org/en/stable/usage/packages-in-pyodide.html which beautifulsoup is in, and to that you'll have to add all pure Python packages. I believe requests is pure python but I haven't tried, maybe you can try packaging a very small requests-beautifulsoup4 app to test it out If you do let us know :) I'd love to hear back, that looks like a very interesting use case!
I'm trying to create a streamlit application that reads files from a folder on the local machine, but from within npm the application cannot find the path to the external folder, returning error 44. Can anyone help me?
Hey! I just checked and if you want to read a file from the built app, I don't think that's possible for now given this new issue: github.com/whitphx/stlite/issues/789 If you have some boilerplate code, maybe you could add a new issue on the repo and link back to this issue? But if it's including files during the build phase it should work only for files inside the streamlit_app folder, not other external locations, though I haven't tested :/ github.com/whitphx/stlite/tree/main/packages/desktop
I am facing a bunch of issues. Well, I succeeded having an executable. But problem 1: The exe cannot read files from paths given in the code which is crucial in my app (FileNotFoundError (44, 'No such file or directory')). Problem 2: In one of my pages I am using st_aggrid which raises a ModuleNotFoundError. Is this module not working with stlite? Problem 3: It is not even recognizing st.header correctly: TypeError: HeadingMixin.header() got an unexpected keyword argument 'divider'. Do you have any ideas on theses issues?
Hey there! It's been a long time since I played with stlite, you will have more luck writing the issues on Yuichiro's stlite package 🤔 github.com/whitphx/stlite/issues though from memory 1/ I think it is actually not possible right now, or not implemented yet given github.com/whitphx/stlite/issues/541 2/ Strange, I think it should, I know it's being tested on the package github.com/whitphx/stlite/pull/874 3/ ok this one is strange and definitely warrants an issue :/ Sorry I couldn't be more helpful, but hopefully Yuichiro will be of better help!
@@andfanilo Hi Fanilo, thank you very much for your reply! Though it is not as positive as I hoped for... Probably I will leave the exe-idea behind me and go for another approach. Great videos by the way! Keep going 🙂
@@charlottepetters283 I think this is for the best...if you really need the .exe, maybe Flet is a better choice, though I haven't tested their .exe implementation. Otherwise, deploying on an internal server, sharing the URL to colleagues and if need be manage user permissions is my usual advice, though I understand it's not always possible Thanks for the support 🙂 see you on the next video
Hi Fanilo, This is really a brillant work. I'm facing a problem using the same method. My streamlit app downloads a csv or data file of the calculation I do but when I convert it into exe it doesn't download the file to disk. Can you help me in that.
Thanks for excellent demo. I am getting error couldn't find python pure wheel for my library pypylon. Even though the .whl files are present in the PyPi. Any suggestions plz
Hey! That's odd :/ could you write down the list of commands you run and the full error on github.com/whitphx/stlite/issues ? That'll be easier to debug! Have a nice day
Hello! If I change the main page file name from "streamlit_app.py" to something else, do I need to change anything in the .json files or something else?
Nice video. Does this process work for a multipage streamlit app that uses several other packages like streamlit extras, streamlit drawable canvas, st_aggrid, tensorflow, some pre-trained deep learning based libraries/modules etc?
Thanks for the support! It works until you use a Python package that does not have a Pyodide counterpart. I haven't tested Tensorflow but I don't think this one would work for example. It unfortunately then becomes a game of testing each package...if you're doing a really complex app with a lot of dependencies, maybe you're better off hosting it in the Cloud or on an on-premise server, until the Pyodide ecosystem gets bigger :/
It's possible :/ make sure your packages are in the list of possible pyodide packages by checking the following list: pyodide.org/en/stable/usage/packages-in-pyodide.html Hope it helps!
Hello! Damn this video is a bit old already, I'll probably do a slower version in the future behind a paywall to keep it updated The most detailed tutorial you'll have for this is github.com/whitphx/stlite/tree/main/packages/desktop in the meantime (npm is installed at the same time as you install nodejs)
Hi Thanks for the great video. I unfortunately get a boot up error after running the "npm run servewindows". The windows opens and loads for a while and then gives the error that "No module called altair.vegalite.v4 found". I installed altair==4.0, but it still give me the error. Could you please help?
Hey! shoot, I think an earlier viewer commented the same issue if you scroll in the comments :/ I'm going to copy part of the answer here. There is a fix going on with github.com/streamlit/streamlit/pull/6618 which should enable Altair 5 to work with Streamit when merged in around 2 weeks I think... unfortunately Altair 5 is installed by default by stlite and conflicts with the current altair.vegalite.v4, and you can't downgrade it So I think you'll have to wait for 2 weeks, or ask the stlite developer to release a version with a downgraded version of altair (which I don't honestly think he will, but we never know). Sorry :/
Hello, i tried using the requests module after converting the streamlet app to an exe and it does not send the request to the API. is this an issue you faced? thank you
Haven't tried, I'll put this in my todo list and come back to you :/ Also check github.com/whitphx/stlite/issues maybe there is an issue around requests there Have a nice day!
I'm trying to create an app that saves few files on the user computer, but it seems that pyodide can't access user files or folders. Is there anyway I can use your method to save files in the downloads folder or any folder specified by the user??
Hey! I know this issue is tracked somewhere, let me find it...ah, github.com/whitphx/stlite/issues/463 As you say, I don't think it's possible to interact with the user computer for now. Maybe saving in a remote Cloud resource is the only option for now 🥲 You can try bringing what you tried in this issue to ping it up Have a nice day!
Hey, Fanilo, great video!! It worked for me as long as the packages are supported by Pyodide. Unfortunately, in my case Pyodbc isn't :( I'm looking for another way to generate an exe Any ideas are very welcome :D
Hey thanks for watching! Yeah unfortunately it's not easy to find which packages are not supported by Pyodide until you actually try it. There is a long post around PyInstaller that I've never been able to make work of ( discuss.streamlit.io/t/using-pyinstaller-or-similar-to-create-an-executable/902 ) and some Electron based tests here: github.com/streamlit/streamlit/issues/1370#issuecomment-1272624057 But alas it's a hard to topic to navigate...so no one fits all answer for now 😐
Yeah...you can read the README if needed: github.com/whitphx/stlite/blob/main/packages/desktop/README.md In my mind this was meant to be more of a quick overview than a fully fledged tutorial, I'll think about your comment for next time :) Have a nice day!
Hey! Thanks for the support, I'm grateful :) I've been playing around with Shiny for Python. I like it, I'm trying to establish whether I have time going deeper for full videos, if I stay very superficial with quick start videos (which is not really what I do on this channel but is possible if I want to talk about more frameworks) or if I share my insights in a future newsletter so I can go deep without spending too much time What do you think? Would you like a Shiny quick start or would you rather have deeper Shiny tutorials? Have a nice day!
Should be possible thanks to Gradio-lite (just like electron-builder packs stlite, it could pack gradio-lite) Though no work has been done yet for priority reasons, it’s described in on github.com/gradio-app/gradio/issues/7032#issuecomment-2160631327
Hi, Great tutorial. I have a request. I built an app on streamlit and now my UI team has built an interface on React. Now how do I integrate my streamlit app into UI? like how to create API endpoints? Please make some video on this. It will be of great help _/\_ .
Hey there! I'm not totally sure I understood your question, so sorry if I miss the mark. From what I understood I imagine two ways to integrate your Streamlit app into React. They revolve around the fact that Streamlit works over the Tornado Python webserver 1. stlite is Serverless Streamlit, it detaches Streamlit UI from Tornado, so for Streamlit code that doesn't use more complex Python packages, you can integrate Streamlit code in HTML directly in a new React route. It sounds easy, but there are quite some limitations if you're using packages like Pandas pyodide.org/en/stable/usage/packages-in-pyodide.html 2. Otherwise, you'll have to host your Streamlit + Tornado somewhere (Streamlit Cloud, HF Spaces, your own platform) and your app in a HTML page in your React app as a separate route or in an existing route (one example docs.streamlit.io/streamlit-community-cloud/share-your-app/embed-your-app if your app is on Streamlit Cloud). Note that your Streamlit and React app can't easily pass information, you won't be able to get Streamlit slider variable from your React app, Streamlit is fully embedded and independent Hope this helps a little; have a nice day, Fanilo
Oh that's odd...do you have more logs before this line? I would suggest putting the full logs and eventual smaller reproducible project on github.com/whitphx/stlite/issues, easier to debug than in UA-cam comments :/
Hello! What would you mean, something like embedding a Streamlit app in a Django page with an IFrame? What usecase are you thinking about :) ? Have a nice day!
Ah shoot 😯 for better support you could open an issue on github.com/whitphx/stlite/issues with your environment and dependencies you're trying to have added. The dump is mostly copying files to tmp directories and downloading Pyodide versions of dependencies from the web, so one of those 2 may be stuck...
Hey, great tuto ! Very funny. But i'm encountering something. While dumping my project who have github package (full python) the wheel can't be found because, the micropip is python 3.10. Is it possible to spécify a python ? Thanks and keep up your good work :)
Hey! From memory you're stuck on Python 3.10 for now, I read this somewhere on the stlite docs but can't find the link right now :/ I know Pyodide and Streamlit independently integrated Python 3.11 end of January. Maybe you can ask on github.com/whitphx/stlite/issues for a 3.11 version. Have a nice day!
@@andfanilo Thanks for the quick responce. Unfortunaly i didn't saw that 'socket' package is not supported. My app is mainly focused on this point haha. Have a nice day too :)
On rigole, on essaye d'apprendre à jongler et on va au futsal avec les collègues, ET PAF 8 ans plus tard on se retrouve à prendre des leçons de packaging Streamlit par Fanilo. Super. T'aurais pas pu m'apprendre ça y'a 8 ans ? Parce que je sais toujours pas jongler, pour info !
Is streamlit dead? I ask because the Streamlit team has not announced any further progress on this framework since December 2022, the project seems to have stopped. Greetings
I don't think so? Streamlit 1.17 (discuss.streamlit.io/t/version-1-17-0/36056) and 1.18 (discuss.streamlit.io/t/version-1-18-0/37501) were released in January and February of 2023. 1.18 is especially exciting because it has static serving, print as PDF, endpoints conflicting with GCP were renamed, and caching primitives are out of experimental (blog.streamlit.io/p/c0a90231-9848-47ec-a40c-ad4a344e4de1/) Nested columns are coming, + as Creators we had access to exciting beta features that are in the roadmap, which by the way was also updated so you can see there what is coming (roadmap.streamlit.app/) Multiple Github issues have been triaged 3 days ago to give an idea on which features will be prioritized/dropped down, so still a lot of activity. They are also preparing for Snowflake Summit in April, which will come with some more announcements I think (I'm not in the dev team, they don't tell me those kinds of secrets ^^). I didn't make a video about 1.18 yet, because I'm a little slow, but it'll be coming!
great video as always sir. I tried your method but I get an error in the step " npm run dump streamlit_app ". The error is : ModuleNotFoundError: The module 'micropip' is included in the Pyodide distribution, but it is not installed. Could you help me with this error please
Nice work dude. This is the content I was searching for. But, can you please add the code of package.json for macos. Also, the altair issue is still repeating even though I've upgraded my streamlit version to latest one. Thanks in advance
Hey! > macos I don't have a Mac here so can't test, I think I do talk about completing the "build" level of package.json, and add the mac configuration from www.electron.build/configuration/mac. I can't test that right now, but hope it gets you kickstarted > Altair Still not resolved by the latest stlite/streamlit release, see the pinned comment for one resolution example, or wait for yet another Streamlit release :/
I got some problems, when I use "npm serverwindows" app runs correctly but my download buttons don't work. I tried to build an app anyway. When I run exe I get this error: ModuleNotFoundError: No module named 'altair.vegalite.v4'
Hey! shoot, I think an earlier viewer commented the same issue if you scroll in the comments :/ I'm going to copy part of the answer here. There is a fix going on with github.com/streamlit/streamlit/pull/6618 which should enable Altair 5 to work with Streamit when merged in around 2 weeks I think... unfortunately Altair 5 is installed by default by stlite and conflicts with the current altair.vegalite.v4, and you can't downgrade it So I think you'll have to wait for 2 weeks, or ask the stlite developer to release a version with a downgraded version of altair (which I don't honestly think he will, but we never know). Sorry :/ EDIT: Or check the pinned comment for a quick workaround
readSitePackagesSnapshot': [Error: ENOENT: no such file or directory, open 'C:\Users\shubh\wall\build\site-packages-snapshot.tar.gz'] { errno: -4058, code: 'ENOENT', syscall: 'open', path: 'C:\\Users\\shubh\\wall\\build\\site-packages-snapshot.tar.gz'
Hey I am getting the below ERROR raceback (most recent call last): File "/lib/python3.10/asyncio/futures.py", line 201, in result raise self._exception File "/lib/python3.10/asyncio/tasks.py", line 232, in __step result = coro.send(None) File "/lib/python3.10/_pyodide/_base.py", line 532, in eval_code_async await CodeRunner( File "/lib/python3.10/_pyodide/_base.py", line 355, in run_async coroutine = eval(self.code, globals, locals) File "", line 2, in File "/lib/python3.10/site-packages/streamlit/__init__.py", line 55, in from streamlit.delta_generator import DeltaGenerator as _DeltaGenerator File "/lib/python3.10/site-packages/streamlit/delta_generator.py", line 45, in from streamlit.elements.arrow_altair import ArrowAltairMixin File "/lib/python3.10/site-packages/streamlit/elements/arrow_altair.py", line 36, in from altair.vegalite.v4.api import Chart M
Hey! shoot, I think an earlier viewer commented the same issue if you scroll in the comments :/ I'm going to copy part of the answer here. There is a fix going on with github.com/streamlit/streamlit/pull/6618 which should enable Altair 5 to work with Streamit when merged in around 2 weeks I think... unfortunately Altair 5 is installed by default by stlite and conflicts with the current altair.vegalite.v4, and you can't downgrade it So I think you'll have to wait for 2 weeks, or ask the stlite developer to release a version with a downgraded version of altair (which I don't honestly think he will, but we never know). Sorry :/
Hey y’all! One fix that made the altair issue work for me was -> running the following in the powershell visual studio code command (windows):
~> npm outdated
And then
~> npm update
Please note, there’s no need for the altair
Thanks for sharing, lemme pin your comment for some time :)
@@andfanilo !!!!!!!QUICK UPDATE!!!!!!!
[[[How to create a Streamlit desktop app]]]
Create the following package.json file to start a new NPM project. Edit the name field.
{
“name”: “xxx”,
“version”: “0.1.0”,
“main”: “./build/electron/main.js”,
“scripts”: {
“dump”: “dump-stlite-desktop-artifacts”,
“serve”: “cross-env NODE_ENV=production electron .”,
“pack”: “electron-builder --dir”,
“dist”: “electron-builder”,
“postinstall”: “electron-builder install-app-deps”
},
“build”: {
“files”: [“build/**/*”],
“directories”: {
“buildResources”: “assets”
}
},
---------------------------------------------------------------
“devDependencies”: {
“@stlite/desktop”: “^0.25.0”,
“cross-env”: “^7.0.3”,
“electron”: “23.1.1”,
“electron-builder”: “^23.6.0”
}
}
Here you should change it to the following:
->->->->->->->->->->->->->->->->->->->->->->
},
“devDependencies”: {
“@stlite/desktop”: “^0.31.0”,
“cross-env”: “^7.0.3”, (check your version, by running npm show cross-env in the command)
“electron”: “23.1.1”, (check your version - for me it was 23.1.1)
“electron-builder”: “^24.4.0” (depending on the version)
}
}
2. Run npm update (instead of npm install).
3. Create streamlit_app directory.
o Any directory name can be used here.
4. Create streamlit_app/streamlit_app.py.
o Change the directory name if you used a different name in the previous step.
5. Write your Streamlit app code in streamlit_app/streamlit_app.py.
o The file name streamlit_app.py is not configurable now.
6. Optionally, you can add more contents in the directory, including pages/*.py for multi-page apps, any data files, and so on.
7. Run npm run dump streamlit_app - -r requirements.txt (the requirements file includes like the following:
streamlit
plotly
pandas
8. Run npm run serve (or similar to the video -servewindows)
9. Run npm run dist or yarn dist for packaging.
o This command bundles the ./build directory created in the step above into application files (.app, .exe, .dmg etc.) in the ./dist directory. To customize the built app, e.g. setting the icon, follow the electron-builder instructions.
I tried this but I still get the same error, how do I fix it?
Even I tried npm outdated and npm update, also altair
Brother, I just discovered your channel on YT, I'm working on a streamlit project and you're helping me like you can't imagine, thank you so much.
Thanks so much for the feedback, it's greatly appreciated 🙂
What type of app are you working on? I'd love to know!
Top notch content, I always wanted to make one on this topic. But this is quite amazingly done video!
Thanks! Well You can still do tthe desktop one to close up your trilogy of stlite videos 😁
Hello, I'm getting just a blank canvas when I use the servewindows
I've created my very first stlite program. Highly appreciated because my graduate students will love it.
Awesome! I didn’t think much about distributing advanced analytics demos as Streamlit apps 🤔 let me know how it goes!
Tired this out my self a few weeks back and it really is a great step forward!
Unfortunately, I couldn’t persist a local database due to Electron security restrictions. I also tried MongoDB and Firebase for cloud storage, but I believe the imports included C-extensions, preventing it from working.
Great video by the way 👍🏼
Thanks for mentioning. I had seen an issue on this (github.com/whitphx/stlite/issues/463), I just forgot to script this and the general issues on interacting back with the local filesystem 🥲 . Hope other viewers will catch your comment.
And that sucks for the external databases, we'll have to wait for the C-extension packages...I'm generally hopeful the Python with WASM ecosystem will keep growing with the efforts on PyScript, and this solution is still easier to setup than PyInstaller/PyOxidizer, so fingers crossed
Have a nice day, thanks for watching!
Appreciate the reply 😊
It certainly would be great to see the WASM ecosystem continue to grow and am hopeful there will be a DB solution in the near future.
Love your videos. You're a streamlit wizard, and a fun wizard on top of that. Keep up the good work.
Thank you for watching, I'm very grateful :) !
Hope to keep seeing you around
Streamlit needs to work harder to simplify this. what a nightmare.
Well, yeah it would be cool if someone took the matter in its hands. Though converting a web app to a desktop app is a nightmare on its own and I doubt someone wants to invest more time in it, seeing how much Yuichiro has already poured into stlite/Pyodide.
I think Solara and Panel are researching alternative solutions for packaging web into desktop. We'll have to see if someone comes with a creative solution that can be passed to all the web frameworks
Until then, we'll have to suffer in silence 😥
You look good, bro! This is the third video I’m seeing and couldn’t stop🤗
Awesome! Thank you, keep binge-watching :D it helps a lot!
very insightful and fun to watch, enjoying your content, Fanilo!
Thank you for the support! Much appreciated, see you on the next one :D
can i say i love you??? cause damn dude, your explanation is perfect!!!!
Well thank you for the support I'm very grateful :) I hope you watch more then, I even just released a new video!
Unfortunately this doesn't work if your code contains modules/packages that written other languages than python, and/or if it can't find .whl package of that module
my issue was the first one. I have bunch of module that written in other languages such as c++ etc on my python-streamlit project. Any suggestion for this will be appreciated.
Hello!
Yes, Pyodide clearly won't be able to manage any of those non pure-python packages, as you may have seen in other comments :/ you may have more luck with Pyinstaller but I find packaging Streamlit with Pyinstaller to be extra painful..
Unfortunately, I don't think it will be easy to install multiple non-python binaries on non tech-saavy people's computers, and for now my preferred way of doing would be to Dockerize the app or install it yourself on a private server/in a VM in the cloud and provide an URL to your audience. If I find any other easy way I'll write it down in a community post
Have a nice day!
Hello, When executing the command 'run npm servewindows, the error is returned: "ModuleNotFoundError: No module named 'ssl'". Does anyone know the solution?
The finale was so exciting that I need to recover first. Don't you want to be a Marvel screenwriter?
🙃 Maybe that was my dream job all along
Have you watched my Epic Book Trailer ( ua-cam.com/video/xubQ0lsiV44/v-deo.html ) ? I feel this one was the most intense I produced 😆
I like your videos. Very funny, simple and easy to understand all things. Keep going.
Glad you like them, will keep going :)
sir am i have hosted my streamlit app using streamlit cloud. its running on desktop not on phonne
Hi and thanks for the useful implementation. Following your procedure, at the point where I run the command "npm run serve" I obtain an ENOENT error saying that a file is missing in the stlite-manifest.json. Any idea what could be the issue?
Hello! Hmmm I never had that and I can't imagine where it comes from...I don't know if there was a new version of stlite that is missing such file, can you try writing your issue on the original repo: github.com/whitphx/stlite/issues ?
Sir pyodide suport tensorflow?
google packages not built yet :(
Will the cv2.VideoCapture() still function after the .exe compilation?
It should since opencv is listed in packages supported by pyodide, but you never know until you try 🤔...do tell us if you try!
I am getting script execution error: 'Attribute' object has no attribute 'id' when electron app is opened using npm run serveWindows
Hey! It's been a while since I used stlite...I'm currently out of work schedule for a while, so your best bet for now would be to post your issue on github.com/whitphx/stlite/issues 🤔
That "Attribute" thing is strange, not sure it would be your fault so I hope the author of the package will find a better explanation for the problem!
Great video!
However it is not working for me (stlite-manifest.json is missing).
Do you know if the steps are the same if large files are in the repo? I built an LLM chatbot (locally downloaded open-source model). Would be cool to see a wallthrough!
Hey there! I don't know if there was a recent update that change the behavior of stlite-manifest.json or something, you could try asking on github.com/whitphx/stlite/issues
I haven't tried to package a downloaded HF model in an .exe though, I don't know if that would be easy...I'll try a bit on my side later on, do tell us if you make progress, I'd love to know
Same issue on my side with latest package.json file (@stlite/desktop :0.39.0)
Update : It worked on my personnal laptop. I wonder if that's related to vpn restriction 🤔
Nice more reasons to use streamlit 🥳🥳🔥
I guess! I have to check if I can run those in Github actions now!
I am making an exe that checks if python is installed in the computer and i am making the exe in python.. is it possible ?? if so how ?
@Fanilo Andrianasolo
streamlit app , converted to exe file i can open the setup exe file but in other system 'exe file' its not opening ?
Hey, from memory the stlite build is not cross-platform, so you’re building on windows for other windows machines, but need to build on a Mac for Mac machines and Linux for Linux
You could do that using GitHub actions for example, by having a build step on multiple operating systems.
And you need to change the os target in the electron-builder configuration, I remember I talk about this at the end of the video 🤔 (it was a long time ago already..)
Will this be fast for running a semi intensive polars dataframe' process?
Hmmm I don't think Polars is supported by Pyodide? You'll have to double-check..
Next level! Thank you good Sir.
Looking forward to your deployed app :)
I am facing an issue of " no module named matplotlib" , even tho I am using the version specified in pyodide, also I am unable to use folium because of the same reason. Help would be appreciated 😊
Hey! It's been a while since I used stlite...I'm currently out of work schedule for a while, so your best bet for now would be to post your issue on github.com/whitphx/stlite/issues 🤔
Hopefully he can get your dependency versions solved!
i am getting "module not found error" in the step "Error during boot up"
can u plz help where to install
i tried all combinations
it gives error
streamlit v17 already available so can't install v22
not sure how to debug... wasted 2 full days on this... :-( any help appreciated
Hey!
I may have forgotten to mention in the video...you can't install a newer version of Streamlit in stlite (there's a pyodide issue preventing users to install a newer version of a package), so the version of stlite hardcodes the version of Streamlit. For now you may have to remove Streamlit for the list of requirements.txt.
Yuichiro, author of stlite, would need to build a new stlite version for the new Streamlit v1.22 version, see this github.com/whitphx/stlite/issues/557
Hope it helps!
Great tutorial!! Thank you ! Will a streamlip app that web-scrapes live data from websites (using requests, beautifulSoup etc), still work when converted to a standalone executable?
Thanks for the support!
The list of Pyodide maintained packages can be found here pyodide.org/en/stable/usage/packages-in-pyodide.html which beautifulsoup is in, and to that you'll have to add all pure Python packages. I believe requests is pure python but I haven't tried, maybe you can try packaging a very small requests-beautifulsoup4 app to test it out
If you do let us know :) I'd love to hear back, that looks like a very interesting use case!
I'm trying to create a streamlit application that reads files from a folder on the local machine, but from within npm the application cannot find the path to the external folder, returning error 44. Can anyone help me?
Hey! I just checked and if you want to read a file from the built app, I don't think that's possible for now given this new issue: github.com/whitphx/stlite/issues/789
If you have some boilerplate code, maybe you could add a new issue on the repo and link back to this issue?
But if it's including files during the build phase it should work only for files inside the streamlit_app folder, not other external locations, though I haven't tested :/ github.com/whitphx/stlite/tree/main/packages/desktop
@@andfanilo Hey, thank you very much for helping me with my questions! I'm a big fan of your work!
I am facing a bunch of issues. Well, I succeeded having an executable. But problem 1: The exe cannot read files from paths given in the code which is crucial in my app (FileNotFoundError (44, 'No such file or directory')). Problem 2: In one of my pages I am using st_aggrid which raises a ModuleNotFoundError. Is this module not working with stlite? Problem 3: It is not even recognizing st.header correctly: TypeError: HeadingMixin.header() got an unexpected keyword argument 'divider'. Do you have any ideas on theses issues?
Hey there! It's been a long time since I played with stlite, you will have more luck writing the issues on Yuichiro's stlite package 🤔 github.com/whitphx/stlite/issues
though from memory 1/ I think it is actually not possible right now, or not implemented yet given github.com/whitphx/stlite/issues/541
2/ Strange, I think it should, I know it's being tested on the package github.com/whitphx/stlite/pull/874
3/ ok this one is strange and definitely warrants an issue :/
Sorry I couldn't be more helpful, but hopefully Yuichiro will be of better help!
@@andfanilo Hi Fanilo, thank you very much for your reply! Though it is not as positive as I hoped for... Probably I will leave the exe-idea behind me and go for another approach. Great videos by the way! Keep going 🙂
@@charlottepetters283 I think this is for the best...if you really need the .exe, maybe Flet is a better choice, though I haven't tested their .exe implementation.
Otherwise, deploying on an internal server, sharing the URL to colleagues and if need be manage user permissions is my usual advice, though I understand it's not always possible
Thanks for the support 🙂 see you on the next video
Hi Fanilo,
This is really a brillant work.
I'm facing a problem using the same method.
My streamlit app downloads a csv or data file of the calculation I do but when I convert it into exe it doesn't download the file to disk.
Can you help me in that.
Thanks for excellent demo. I am getting error couldn't find python pure wheel for my library pypylon. Even though the .whl files are present in the PyPi. Any suggestions plz
Hey! That's odd :/ could you write down the list of commands you run and the full error on github.com/whitphx/stlite/issues ? That'll be easier to debug!
Have a nice day
Is it possible to use the .exe on a smartphone as well?
Hello! If I change the main page file name from "streamlit_app.py" to something else, do I need to change anything in the .json files or something else?
Unfortunately the streamlit_app.py name is not configureable github.com/whitphx/stlite/tree/main/packages/desktop I think it is hardcoded for now 😕
@@andfanilo Hey, thank you very much for helping me with my questions! I'm a big fan of your work!
I have troubles with libraries while running the app, is it possible to do this with docker ?
Sure, I do think Docker is the better option if everyone has it. Check out docs.streamlit.io/deploy/tutorials/docker
How do you enable data update to the app?
Hey, what do you mean by data update?
Thankyou, will try these later
Let us know how it goes ;)
Hi there, my progress so far is stuck to can't connect to http url because the ssl module is not available.
Any suggestion?
@@andfanilo ssl error resolved, pyodide_http do the trick.
Nice video. Does this process work for a multipage streamlit app that uses several other packages like streamlit extras, streamlit drawable canvas, st_aggrid, tensorflow, some pre-trained deep learning based libraries/modules etc?
Thanks for the support!
It works until you use a Python package that does not have a Pyodide counterpart. I haven't tested Tensorflow but I don't think this one would work for example.
It unfortunately then becomes a game of testing each package...if you're doing a really complex app with a lot of dependencies, maybe you're better off hosting it in the Cloud or on an on-premise server, until the Pyodide ecosystem gets bigger :/
I couldn't turn my app into an executable, could it be because of the libraries? I'm using geopandas and others.
It's possible :/ make sure your packages are in the list of possible pyodide packages by checking the following list: pyodide.org/en/stable/usage/packages-in-pyodide.html
Hope it helps!
Could you please make a slow speaking and step by step detailed description guide video for noobs like me.
How to install stlite, npm everything is confusing. 😢
Hello! Damn this video is a bit old already, I'll probably do a slower version in the future behind a paywall to keep it updated
The most detailed tutorial you'll have for this is github.com/whitphx/stlite/tree/main/packages/desktop in the meantime (npm is installed at the same time as you install nodejs)
ImportError: Can't connect to HTTPS URL because the SSL module is not available.😭😭😭
You solved this problem?
Hi Thanks for the great video. I unfortunately get a boot up error after running the "npm run servewindows". The windows opens and loads for a while and then gives the error that "No module called altair.vegalite.v4 found". I installed altair==4.0, but it still give me the error.
Could you please help?
Hey! shoot, I think an earlier viewer commented the same issue if you scroll in the comments :/ I'm going to copy part of the answer here. There is a fix going on with github.com/streamlit/streamlit/pull/6618 which should enable Altair 5 to work with Streamit when merged in around 2 weeks I think... unfortunately Altair 5 is installed by default by stlite and conflicts with the current altair.vegalite.v4, and you can't downgrade it
So I think you'll have to wait for 2 weeks, or ask the stlite developer to release a version with a downgraded version of altair (which I don't honestly think he will, but we never know). Sorry :/
@@andfanilo ok. Thanks for the fast response :)
Need network to use app ?
Hello, i tried using the requests module after converting the streamlet app to an exe and it does not send the request to the API. is this an issue you faced? thank you
Haven't tried, I'll put this in my todo list and come back to you :/
Also check github.com/whitphx/stlite/issues maybe there is an issue around requests there
Have a nice day!
I'm trying to create an app that saves few files on the user computer, but it seems that pyodide can't access user files or folders. Is there anyway I can use your method to save files in the downloads folder or any folder specified by the user??
Hey!
I know this issue is tracked somewhere, let me find it...ah, github.com/whitphx/stlite/issues/463
As you say, I don't think it's possible to interact with the user computer for now. Maybe saving in a remote Cloud resource is the only option for now 🥲
You can try bringing what you tried in this issue to ping it up
Have a nice day!
Hey, Fanilo, great video!! It worked for me as long as the packages are supported by Pyodide. Unfortunately, in my case Pyodbc isn't :( I'm looking for another way to generate an exe Any ideas are very welcome :D
Hey thanks for watching! Yeah unfortunately it's not easy to find which packages are not supported by Pyodide until you actually try it. There is a long post around PyInstaller that I've never been able to make work of ( discuss.streamlit.io/t/using-pyinstaller-or-similar-to-create-an-executable/902 ) and some Electron based tests here: github.com/streamlit/streamlit/issues/1370#issuecomment-1272624057
But alas it's a hard to topic to navigate...so no one fits all answer for now 😐
i love u man. GJ!
Thanks for the support :D
I love your video, but I need to play it in slow motion to grab everything!!
Yeah...you can read the README if needed: github.com/whitphx/stlite/blob/main/packages/desktop/README.md
In my mind this was meant to be more of a quick overview than a fully fledged tutorial, I'll think about your comment for next time :)
Have a nice day!
Hey,
Thanks for the great contents!
Any plans to make similar stuff with shiny for python?
Hey! Thanks for the support, I'm grateful :)
I've been playing around with Shiny for Python. I like it, I'm trying to establish whether I have time going deeper for full videos, if I stay very superficial with quick start videos (which is not really what I do on this channel but is possible if I want to talk about more frameworks) or if I share my insights in a future newsletter so I can go deep without spending too much time
What do you think? Would you like a Shiny quick start or would you rather have deeper Shiny tutorials?
Have a nice day!
Hey @andfalino,
I would prefer and watch Shiny quick start 😊
Have a great day!
Is it possible to convert Gradio app to .exe the same way ?
Should be possible thanks to Gradio-lite (just like electron-builder packs stlite, it could pack gradio-lite)
Though no work has been done yet for priority reasons, it’s described in on github.com/gradio-app/gradio/issues/7032#issuecomment-2160631327
@@andfanilo thanks. I did it using Pyinstaller
@@MasterMan2015 Nice, glad it worked! Do you have a writeup or tutorial to share other people :) ?
Very well done
Thanks for watching, hope to see you around :)
Hi, Great tutorial. I have a request. I built an app on streamlit and now my UI team has built an interface on React. Now how do I integrate my streamlit app into UI? like how to create API endpoints? Please make some video on this. It will be of great help _/\_ .
Hey there!
I'm not totally sure I understood your question, so sorry if I miss the mark. From what I understood I imagine two ways to integrate your Streamlit app into React. They revolve around the fact that Streamlit works over the Tornado Python webserver
1. stlite is Serverless Streamlit, it detaches Streamlit UI from Tornado, so for Streamlit code that doesn't use more complex Python packages, you can integrate Streamlit code in HTML directly in a new React route. It sounds easy, but there are quite some limitations if you're using packages like Pandas pyodide.org/en/stable/usage/packages-in-pyodide.html
2. Otherwise, you'll have to host your Streamlit + Tornado somewhere (Streamlit Cloud, HF Spaces, your own platform) and your app in a HTML page in your React app as a separate route or in an existing route (one example docs.streamlit.io/streamlit-community-cloud/share-your-app/embed-your-app if your app is on Streamlit Cloud). Note that your Streamlit and React app can't easily pass information, you won't be able to get Streamlit slider variable from your React app, Streamlit is fully embedded and independent
Hope this helps a little; have a nice day,
Fanilo
Great video, but i still prefer pyinstaller instructions in the streamlit forums
Well...As long as you get a solution to your problem 🙂
😭😭😭electron: Failed to load URL: localhost:3000/ with error: ERR_CONNECTION_REFUSED
Oh that's odd...do you have more logs before this line?
I would suggest putting the full logs and eventual smaller reproducible project on github.com/whitphx/stlite/issues, easier to debug than in UA-cam comments :/
hello @gekacrazy, did you find any solution because I am also facing the same issue. Thank you in advance.
Same here 😭. Did you find any solutions?
Fanilo, can you make a video on using Django and streamlit?
Hello!
What would you mean, something like embedding a Streamlit app in a Django page with an IFrame? What usecase are you thinking about :) ?
Have a nice day!
@@andfanilo I was thinking more in terms of beautification of streamlit application using other web frames.
Didn't work for me. It got stuck in Install [3 .whl files ] while trying "npm run dump streamlit_app -- -r requirements.txt"
Ah shoot 😯 for better support you could open an issue on github.com/whitphx/stlite/issues with your environment and dependencies you're trying to have added.
The dump is mostly copying files to tmp directories and downloading Pyodide versions of dependencies from the web, so one of those 2 may be stuck...
Hey, great tuto ! Very funny. But i'm encountering something. While dumping my project who have github package (full python) the wheel can't be found because, the micropip is python 3.10. Is it possible to spécify a python ? Thanks and keep up your good work :)
Hey! From memory you're stuck on Python 3.10 for now, I read this somewhere on the stlite docs but can't find the link right now :/
I know Pyodide and Streamlit independently integrated Python 3.11 end of January. Maybe you can ask on github.com/whitphx/stlite/issues for a 3.11 version.
Have a nice day!
@@andfanilo Thanks for the quick responce. Unfortunaly i didn't saw that 'socket' package is not supported. My app is mainly focused on this point haha.
Have a nice day too :)
This is wonderful, i want to know will it work without the internet?
It should yeah as all the resources are embedded in the built stlite app. My computer at the end did not have Internet
On rigole, on essaye d'apprendre à jongler et on va au futsal avec les collègues, ET PAF
8 ans plus tard on se retrouve à prendre des leçons de packaging Streamlit par Fanilo. Super. T'aurais pas pu m'apprendre ça y'a 8 ans ? Parce que je sais toujours pas jongler, pour info !
Is streamlit dead? I ask because the Streamlit team has not announced any further progress on this framework since December 2022, the project seems to have stopped. Greetings
I don't think so? Streamlit 1.17 (discuss.streamlit.io/t/version-1-17-0/36056) and 1.18 (discuss.streamlit.io/t/version-1-18-0/37501) were released in January and February of 2023. 1.18 is especially exciting because it has static serving, print as PDF, endpoints conflicting with GCP were renamed, and caching primitives are out of experimental (blog.streamlit.io/p/c0a90231-9848-47ec-a40c-ad4a344e4de1/)
Nested columns are coming, + as Creators we had access to exciting beta features that are in the roadmap, which by the way was also updated so you can see there what is coming (roadmap.streamlit.app/)
Multiple Github issues have been triaged 3 days ago to give an idea on which features will be prioritized/dropped down, so still a lot of activity.
They are also preparing for Snowflake Summit in April, which will come with some more announcements I think (I'm not in the dev team, they don't tell me those kinds of secrets ^^).
I didn't make a video about 1.18 yet, because I'm a little slow, but it'll be coming!
Build stuff, stop exploring libraries
@@denisblack9897stoooopidiest advice EVER.
great video as always sir.
I tried your method but I get an error in the step " npm run dump streamlit_app ".
The error is : ModuleNotFoundError: The module 'micropip' is included in the Pyodide distribution, but it is not installed.
Could you help me with this error please
I also experience this issue. Anyone able to solved this?
Use the requirements.txt method
Why
Nice work dude. This is the content I was searching for. But, can you please add the code of package.json for macos. Also, the altair issue is still repeating even though I've upgraded my streamlit version to latest one. Thanks in advance
Hey!
> macos
I don't have a Mac here so can't test, I think I do talk about completing the "build" level of
package.json, and add the mac configuration from www.electron.build/configuration/mac. I can't test that right now, but hope it gets you kickstarted
> Altair
Still not resolved by the latest stlite/streamlit release, see the pinned comment for one resolution example, or wait for yet another Streamlit release :/
Nice.
Thanks for the support :)
asante sana
I got some problems, when I use "npm serverwindows" app runs correctly but my download buttons don't work. I tried to build an app anyway. When I run exe I get this error: ModuleNotFoundError: No module named 'altair.vegalite.v4'
Hey! shoot, I think an earlier viewer commented the same issue if you scroll in the comments :/ I'm going to copy part of the answer here. There is a fix going on with github.com/streamlit/streamlit/pull/6618 which should enable Altair 5 to work with Streamit when merged in around 2 weeks I think... unfortunately Altair 5 is installed by default by stlite and conflicts with the current altair.vegalite.v4, and you can't downgrade it
So I think you'll have to wait for 2 weeks, or ask the stlite developer to release a version with a downgraded version of altair (which I don't honestly think he will, but we never know). Sorry :/
EDIT: Or check the pinned comment for a quick workaround
@@andfanilo Thanks for help :)
😍😍💕💕💕💕🥰🥰💕💕
Glad you liked it :D
Why would you not user docker. How is an exe useful. Shoehorning a web app into a bs windows executable is just lame
I agree with you
readSitePackagesSnapshot': [Error: ENOENT: no such file or directory, open 'C:\Users\shubh\wall\build\site-packages-snapshot.tar.gz'] {
errno: -4058,
code: 'ENOENT',
syscall: 'open',
path: 'C:\\Users\\shubh\\wall\\build\\site-packages-snapshot.tar.gz'
Which command gives the error?
Hey I am getting the below ERROR
raceback (most recent call last):
File "/lib/python3.10/asyncio/futures.py", line 201, in result
raise self._exception
File "/lib/python3.10/asyncio/tasks.py", line 232, in __step
result = coro.send(None)
File "/lib/python3.10/_pyodide/_base.py", line 532, in eval_code_async
await CodeRunner(
File "/lib/python3.10/_pyodide/_base.py", line 355, in run_async
coroutine = eval(self.code, globals, locals)
File "", line 2, in
File "/lib/python3.10/site-packages/streamlit/__init__.py", line 55, in
from streamlit.delta_generator import DeltaGenerator as _DeltaGenerator
File "/lib/python3.10/site-packages/streamlit/delta_generator.py", line 45, in
from streamlit.elements.arrow_altair import ArrowAltairMixin
File "/lib/python3.10/site-packages/streamlit/elements/arrow_altair.py", line 36, in
from altair.vegalite.v4.api import Chart
M
Hey! shoot, I think an earlier viewer commented the same issue if you scroll in the comments :/ I'm going to copy part of the answer here. There is a fix going on with github.com/streamlit/streamlit/pull/6618 which should enable Altair 5 to work with Streamit when merged in around 2 weeks I think... unfortunately Altair 5 is installed by default by stlite and conflicts with the current altair.vegalite.v4, and you can't downgrade it
So I think you'll have to wait for 2 weeks, or ask the stlite developer to release a version with a downgraded version of altair (which I don't honestly think he will, but we never know). Sorry :/
@@andfanilo Thanks for response