How to start a server on Cloudera CDSW?

On Cloudera CDSW I am able to run R Shiny apps as described here.

Can I do the same with streamlit? In particular, is there away to write a python script of the folllowing form instead of streamlit run app.py?

import os
import streamlit as st
st.runApp(port=os.environ["CDSW_READONLY_PORT"], 
                 host="127.0.0.1", 
                 launch.browser="FALSE")

Hi @LucaMingarelli, welcome to the Streamlit community!

It’s an interesting question. For your first part, there isn’t a st.runApp() function, we’ve expected that users could start their application from a terminal. But I wonder if you could do something like

os.system(f"""streamlit run app.py' --server.port {os.environ["CDSW_READONLY_PORT"]}""" )

Thanks @randyzwitch, unfortunately the following is what I get.

That’s weird per se, since I am able to import streamlit in python, and also able to run in in the terminal window
image
The trouble with the latter is that the CDSW_READONLY_PORT cannot be set from there (I get a ‘port x is already in use’), plus in the corporate environment I’m working in I get logged off regularly, getting the terminal session disconnected.
Can you maybe think of any other workaround?

Unfortunately, not having access to CDSW, I don’t have too much else to suggest, but it looks like you are close. Do you have a Cloudera sales engineer who might be able to help?

Usually, when a shell command says streamlit: not found, it indicates that the Python environment you are in isn’t the one where Streamlit is installed. You might try to specify the exact location if you know it, like /home/randy/miniconda/myenv/bin/streamlit run ui.py (obviously, with whatever the correct value might be)