Survey banner
Share your feedback on the Dataiku documentation with this 5 min survey. Thanks! TAKE THE SURVEY

Getting streamlit code studio to use the project code environment

Solved!
info-rchitect
Level 6
Getting streamlit code studio to use the project code environment

Hi,

 

I made a Python 3.8 code environment in dataiku that mimics the code environement I sue to run my streamlit app on my PC.  However, the Streamlit app on dataiku seems to use a hard-coded code environment.  Is there any way to configure this by the project owner?

 

thx


Operating system used: Windows 10

1 Solution
7 Replies
AlexT
Dataiker

Hi @info-rchitect ,
You can't configure a code env for the Streamlit Code Studio.
You can, however add an additional package to the Streamlit block in the Code Studio template.

Screenshot 2023-05-17 at 8.25.16 PM.png

Hope that helps!

0 Kudos
info-rchitect
Level 6
Author

@AlexT  thx for the reply.  Unfortunately fixing us to Python 3.7 is a non-starter as we need at least 3.81 to take full advantage of our Snowflake Python ecosystem.  Can the default Python version for the Streamlit code studio be changed by our system admin?

0 Kudos
AlexT
Dataiker

Currently, there is no supported way to change Python3.7 for streamlit block,  but we are actively working on making this available in a upcomming release.

raniachk
Level 1

Hello @info-rchitect @AlexT

Can't we solve this problem by appending the following lines in the Dockerfile of the Code Studio templates? We can delete the default version of python which is 3.7 and reinstall python3.10 for example here.

USER root

WORKDIR /opt/dataiku

# Custom streamlit env with python 3.10

RUN rm -rf /opt/dataiku/python-code-envs/pyenv-streamlit

RUN python3.10 -m venv /opt/dataiku/python-code-envs/pyenv-streamlit

RUN source /opt/dataiku/python-code-envs/pyenv-streamlit/bin/activate && pip install streamlit numpy==1.23.5 pandas

USER dataiku

WORKDIR /home/dataiku

AlexT
Dataiker

Hi, 
You could try, but this would void support, and we wouldn't be able to provide any support around Streamlit.

We plan on releasing a more robust way to include a custom code env for streamlit in upcoming releases.

If you check INSTALL_DIR/resources/plugins/code-studio-blocks/python-code-studio-blocks/streamlit/codeStudioBlock.py this is hardcoded to Python37 right now.

Thanks

@AlexT thanks for letting us know code studios are getting some attention. They are wonderful in general but could be much more flexible. The hack above works well for now to get 3.9 installed.

0 Kudos
AlexT
Dataiker

@importthepandas code envs for Streamlit block is now available in 12.1 

https://doc.dataiku.com/dss/latest/release_notes/12.html#code-studios