โ12-10-2024 01:47 PM
I am developing a Databricks application using the Streamlit package. I was able to get a "hello world" app deployed successfully, but now I am trying to pass data that exists in the dbfs on the same instance. I try to read a csv saved to the dbfs but get a file not found error. I am assuming there is a virtual environment being setup during deployment and there is an additional step I need to do to configure the path. Thanks in advance.
โ12-10-2024 02:39 PM
Hello Adam,
So you are running something similar to:
import streamlit as st
import pandas as pd
# Path to the CSV file in DBFS
file_path = '/dbfs/path/to/your/file.csv'
# Read the CSV file
df = pd.read_csv(file_path)
# Display the dataframe in Streamlit
st.write(df)
And it is resulting in this file not found issue?
โ12-11-2024 05:44 AM
Yes, exactly. To add more context, the read_csv() line works if I just run it in a notebook with the same path, but it does not work once I try and deploy the application.
a week ago
Hello Walter,
did you have the possibility to look into this?
โ12-11-2024 06:35 AM
What if you try to list the file using dbutils.fs.ls("dbfs:/mnt/path/to/data") does it list it?
โ12-11-2024 07:02 AM
Well, I can't even use dbutils in the app. When I try that, I get a NameError name 'dbutils' is not defined error. Again, this just works in a notebook but not the app.
If I try and do this:
a month ago
Have you found a solution? As far as I can see, the apps run in an environment where DBFS is not mounted.
a month ago
The environment where the app runs does not have the following directories in the root folder:
a week ago - last edited a week ago
Ensure that the environment where Streamlit is running has access to the DBFS paths. This is typically handled by Databricks, but if you are running Streamlit outside of Databricks, you may need to configure access to DBFS.
If you are running Streamlit outside of Databricks, consider using Databricks Connect to interact with Databricks resources
a week ago
That's the point. I am running streamlit from a Databricks App, so I was wondering if they can propose the "right" way to access DBFS. Or if they think that the way to exchange data should be using an SQL Warehouse.
Friday
I have the identical problem in Databricks Apps. I have tried...
None of these methods worked for me and cannot use Apps until I have a solution for this.
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