https://www.orchest.io/ logo
t

Tadeo

09/24/2021, 1:27 PM
Hi! Has anyone implemented the streamlit service? Iโ€™m not able to install plotly 1. I installed the package in the environment but it seems to only affect the notebook, and not the streamlit service. 2. I went to Services > Edit Services > Streamlit and replaced the image to the one above (I modified the build to include streamlit and plotly) but I only managed to break the service ๐Ÿฅฒ Can anyone tell me how to install packages for the streamlit service?
y

Yannick

09/24/2021, 2:02 PM
Hi @Tadeo! Your steps sound right to me. Let me quickly look into this for you :)
๐Ÿ™ 1
Alright I found the issue, totally understandable you did not get it to work ๐Ÿ˜ฌ Give me a few minutes to write up the solution for you.
First, it could be that an outdated
protobuf
version is installed in the environment, thereby breaking
streamlit
. To fix this you can add
pip install --upgrade protobuf
to the environment (the one in which you installed
streamlit
and
plotly
). Second, because you are not using the template streamlit service that we offer, there are a few changes you need to make to its configuration. 1. Again go to Services > Edit Services > Streamlit 2. Replace the image by your custom environment (you did this correct!) 3. Change the "Command (optional)" to:
-c 'umask 002 && streamlit run /project-dir/streamlit.py'
4. Add a file called
streamlit.py
in your project directory. You can do this through the JupyterLab UI. 5. Restart the session for the changes to take effect. 6. You should now be able to visit your streamlit dashboard. Example `streamlit.py`:
Copy code
import streamlit as st

st.title("Hello Streamlit")
Let me know whether that does the trick. ๐Ÿ˜„
r

Rick Lamers

09/24/2021, 3:04 PM
A quick note: services are a relatively new feature and we're still very much in the process of streamlining its ergonomics. It can feel a bit "low-level" at times currently.
๐Ÿ‘ 3
t

Tadeo

09/24/2021, 7:30 PM
It works now! Thanks for the fix ๐Ÿ™Œ
๐Ÿ”ฅ 2
y

Yannick

09/24/2021, 8:41 PM
Youโ€™re welcome ๐Ÿ˜„
t

Tadeo

09/25/2021, 2:15 PM
Iโ€™ve got a new one for you๐Ÿ˜‡. It seems the changes in the streamlit.py (done through vscode) are not being propagated to the streamlit service. The pipeline works because the underlying data gets updated but Iโ€™ve modifying the script and the changes are not showing up. I can see the changes through jupyterlab, as well. As a side note, streamlit detects when there is a change in the script and prompts me to re run it, this is not happening. Maybe itโ€™s related to the bug above or itโ€™s the current functionality given that vscodes has the autosave feature on.
๐Ÿ‘€ 1
y

Yannick

09/25/2021, 2:39 PM
You are absolute right Tadeo, my bad... 1. Again go to Services > Edit Services > Streamlit 2. Under the "Mounts" header, change "Project directory (optional)" to
/project-dir
Now you should be able to change the
streamlit.py
and see the changes on reload of the streamlit app. The steps above mount your project directory files to the service container. This you are editing the same
streamlit.py
file (through JupyterLab) as the one that is present in the custom streamlit service.
๐Ÿ‘ 2
t

Tadeo

09/26/2021, 10:43 PM
@Yannick Thanks a lot! It works flawlessly now ๐ŸŽ‰
๐Ÿ”ฅ 2