cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to open Streamlit URL that is hosted by Databricks in local web browser?

Akshay_127877
New Contributor II

I have run this webapp code on Databricks notebook. It works properly without any errors.

With databricks acting as server, I am unable open this link on my browser for this webapp.

But when I run the code on my local IDE, I am able to just open the URL on my browser.

Is there a way that I can access the webapp using this URL generated by Databricks?

image

8 REPLIES 8

Anonymous
Not applicable

@Akshay Aravinnakshan​ :

Yes, there are a few steps you can follow to access the web app hosted on Databricks:

  1. Make sure that the Databricks cluster is running and that the web app is running on the cluster.
  2. In the Databricks notebook, check the port on which the web app is running. You can find this in the output of the command that started the web app.
  3. Configure your Databricks cluster's network settings to allow inbound traffic on the port that the web app is running on. You can do this by going to the Azure portal and navigating to the Network Security Group associated with your Databricks cluster. Then, add an inbound security rule that allows traffic on the port that the web app is running on.
  4. Use the public IP address of your Databricks cluster to access the web app. To find the public IP address, go to the Azure portal and navigate to the Databricks workspace. Then, click on the "Networking" tab and look for the "Public IP address" field.
  5. Open your browser and navigate to the URL of the web app, using the public IP address and the port number. For example, if the public IP address is 1.2.3.4 and the web app is running on port 8080, you would navigate to http://1.2.3.4:8080.

Note that the steps above assume that your Databricks cluster is running in an Azure Virtual Network (VNet) and is accessible from the internet. If your cluster is not in a VNet or is not accessible from the internet, you may need to set up a Virtual Private Network (VPN) or a ExpressRoute connection to access the web app.

Thank you for the reply. I am unfortunately facing some issues still.

What I did till now based on your reply:

1) Created VNet called "Akshay_2_vnet" and added two subnets Private and Public.

image2) Created my databricks instance (Akshay_2_Databricks) on that Vnet.

The Network configuration looks like this

imageThe summary of the Databricks instance before creation looks like this.

image3) (As per step 3 in your answer) I found my NSG for the public subnet by clicking on this:

imageI added the inbound security rule as follows for port 8501:

The configuration of the inbound rule looks like this:

imageAfter saving the inbound rule:

image 

4) Then I started my cluster and ran the code. I ran my webapp on the port 8501

imageBut, the networking tab of my Databricks workspace is freezed (as seen above). So I am not able to perform your step 4 in your answer. As a workaround, I used the public IP address(as seen in Screenshot of step 3.).

So now the webapp is hosted on the address : http://10.0.1.0:8501

But it still does not allow me to access to the web app in the browser. Could you please guide me where I am going wrong.

Thanks in advance 🙂

------------------------------------------------------------------------

Also when I ran the streamlit code, databricks suggested to run the following command to open the streamlit app in browser. Could you please explain me what this command means?

!streamlit run /databricks/python_shell/scripts/db_ipykernel_launcher.py

Aarsh
New Contributor II

Hello Akshay,

I am also facing the same issue. are you noe able to use streamlit with Databricks

Hi Aarsh,

Unfortunately no. As you can see I did not get any help on this regards from Databricks comunity on this topic. Also, I wasn't able resolve it on my own as well.

I did a work around actually, I ran the databricks notebooks using Databricks-cli on my streamlit app and stored the app on github.

I then used Azure-app services to launch my app stored in github.

Hope it helps!!!

AlexG
New Contributor II

Hi @Akshay_127877 , did you get this to work? Snowflake will be releasing an integrated Streamlit feature next month. Wondering if Databricks is working on a similar solution. I like databricks, but will move to Snowflake if the Streamlit feature works as expected. Screenshot is from a preview demo on Youtube.

Hi Akshay - Could you share the steps for the workaround you found? Any info you could share would be super helpful. Thank you!

Anonymous
Not applicable

Hi @Akshay Aravinnakshan​ 

Thank you for posting your question in our community!

Your input matters! Help our community thrive by coming back and marking the most helpful and accurate answers. Together, we can make a difference!

navallyemul
New Contributor III

@Akshay_127877 : Were you able to resolve this issue?

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group