How to run Streamlit version 1.24

Solved!
Marlan
How to run Streamlit version 1.24

Hi all,

Any suggestions on how to run Streamlit version 1.24.0 in a Code Studio? I'd like to use the chat_message and chat_input elements introduced in that version to build an LLM chat UI.

I am running the Dataiku hosted edition, version 12.1.0. 

I've tried creating a separate code environment for use in the code studio template but wasn't able to create a code environment with Streamlit version 1.24 in it (when I specified that version, the environment failed with a Jupyter support installation failed error.

I was able to create a code environment with an older version of Streamlit and include it in a code studio template but then the Code Studio start up never finished.

Thanks for any suggestions.

Marlan

cc @info-rchitect@importthepandas, @AlexT 

1 Solution
Marlan
Author

OK, I figured out a solution - at least for the cloud version of Dataiku. 

Create streamlit code studio template as follows:

Step 1: Add a Append to Dockerfile block. Specify the following statement in the dockerfile text box:

 

RUN python3.9 -m venv /home/dataiku/streamlit-v125-env && (source /home/dataiku/streamlit-v125-env/bin/activate && pip install streamlit==1.25.0 "numpy==1.23.1" "urllib3<2" "altair==4.2.2")

 

I worked this out by looking at docker files for other code studio templates; I've not used docker files before so could be I'm doing something really dumb - if so let me know please! - but it does work.

Note that I added the numpy==1.23.1 because without this importing dataiku results in an invalid use of np.bool error. 

I didn't test whether it is necessary to put this block before the Streamlit. I'd guess it doesn't matter.

Step 2: Add the Streamlit block

Specify the following settings:

Code env mode: Manually installed [advanced]

Code env path: /home/dataiku/streamlit-v125-env

Leave everything else at the default settings.

The code environment path should match the path used in the Append to Dockerfile statement. 

Step 3: Add the Visual Studio code block with the default settings.

View solution in original post

2 Replies
Marlan
Author

OK, I figured out a solution - at least for the cloud version of Dataiku. 

Create streamlit code studio template as follows:

Step 1: Add a Append to Dockerfile block. Specify the following statement in the dockerfile text box:

 

RUN python3.9 -m venv /home/dataiku/streamlit-v125-env && (source /home/dataiku/streamlit-v125-env/bin/activate && pip install streamlit==1.25.0 "numpy==1.23.1" "urllib3<2" "altair==4.2.2")

 

I worked this out by looking at docker files for other code studio templates; I've not used docker files before so could be I'm doing something really dumb - if so let me know please! - but it does work.

Note that I added the numpy==1.23.1 because without this importing dataiku results in an invalid use of np.bool error. 

I didn't test whether it is necessary to put this block before the Streamlit. I'd guess it doesn't matter.

Step 2: Add the Streamlit block

Specify the following settings:

Code env mode: Manually installed [advanced]

Code env path: /home/dataiku/streamlit-v125-env

Leave everything else at the default settings.

The code environment path should match the path used in the Append to Dockerfile statement. 

Step 3: Add the Visual Studio code block with the default settings.

June
Level 3

We tried this in our on-premise Dataiku node and it works.  Thank you for the workaround!