Submit your innovative use case or inspiring success story to the 2023 Dataiku Frontrunner Awards! LET'S GO

Getting streamlit code studio to use the project code environment

info-rchitect
Level 5
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

0 Kudos
5 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 5
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.

0 Kudos
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

0 Kudos