I keep getting [Errno 13] Permission denied: '/.streamlit'

Hello! I am fairly new to HuggingFace Spaces and I am trying to run an application, but keep getting the error [Errno 13] Permission denied: ‘/.streamlit’ . I have searched other topics and currently, even after setting HOME to /tmp/ or /data/. I have also added ENV PYTHONUNBUFFERED=1 \ PORT=8000 \ HF_HOME=/home/user/huggingface to the dockerfile, following another similar topic I have found but for some reason it doesn’t seem to run, or at least does not appear in the logs and I keep getting the same error on the container. Any idea on how to solve this?

1 Like

There are some restrictions on directory access, so it is safer to refer to the official Docker sample. Also, the port to be used is written in README.md.

The final version looks like this.

I have checked and it seems like we have the same configuration. However, the error persists and I still don’t understand why :frowning: Would it help to provide the full log?

1 Like

Hmm… My Dockerfile is just:

FROM python:3.9-slim

WORKDIR /app

RUN apt-get update && apt-get install -y \
    build-essential \
    curl \
    git \
    && rm -rf /var/lib/apt/lists/*

COPY requirements.txt ./
COPY src/ ./src/

RUN pip3 install -r requirements.txt

EXPOSE 8501

HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health

ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]

And README.md:

---
title: Streamlittest1
emoji: 🚀
colorFrom: red
colorTo: red
sdk: docker
app_port: 8501
tags:
- streamlit
pinned: false
short_description: Streamlit template space
---

Strange, exact same as me. Meanwhile I figured out that my file_uploader was not working and figured I needed to create a .streamlit folder with a config.toml file inside it. Placed this folder at the root of the project and wondered if it couldn’t find it because it didn’t exist. However, after creating it, it still raises the same error. The app runs, but I believe this is messing with its correct functioning. Should this folder be in a different place? Are there any other configurations required?

1 Like

The root directory of the virtual machine that is executed is different from the root directory of the repository, so it would be better to modify the Dockerfile rather than the repository file structure.

For example, when specifying directories, it is better to write useradd first.

Ok, I kind of see the point of this, but can you help me understand how does this blends with the default dockerfile? Because it already contains commands such as WORKDIR. Should they be changed or is this something that should compliment what it already there?

1 Like

Should they be changed or is this something that should compliment what it already there?

Yeah. It seems to work fine that way.

Added the user part and it seems to be working! I get a completely different error, but it is something for another topic. Thank you for your help!

1 Like

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.