Os.mkdir is not able to create new folder in Space

Hello @serdarakyol,

Issue is your space is running with an unprivileged user while by default during a docker build commands are run as root.

To prevent this issue you need to copy your resources specifying the owner.

FROM python:3.9.7

# Set up a new user named "user" with user ID 1000
RUN useradd -m -u 1000 user

# Switch to the "user" user
USER user

COPY --chown=user ./requirements.txt /api/requirements.txt
COPY --chown=user ./sabiduria_tool_api /api/sabiduria_tool_api

WORKDIR /api

RUN pip install --upgrade pip
RUN pip install -r requirements.txt

CMD ["uvicorn", "sabiduria_tool_api.main:app", "--host", "0.0.0.0", "--port", "7860"]

You’ll find more info regarding permissions issues in the documentation

2 Likes