Permission Denied to create .streamlit

Hi all,

I am trying to run streamlit on a kubertnet cluster. The docker image works on my local machine, but when running on the cluster I face the following error:

Traceback (most recent call last):  
  File "/usr/local/bin/streamlit", line 10, in <module>  
    sys.exit(main())  
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 764, in __call__  
    return self.main(*args, **kwargs)  
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 717, in main  
    rv = self.invoke(ctx)  
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1137, in invoke  
    return _process_result(sub_ctx.command.invoke(sub_ctx))  
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 956, in invoke  
    return ctx.invoke(self.callback, **ctx.params)  
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 555, in invoke  
    return callback(*args, **kwargs)  
  File "/usr/local/lib/python3.7/site-packages/streamlit/cli.py", line 154, in main_run  
    _main_run(file_or_url, args)  
  File "/usr/local/lib/python3.7/site-packages/streamlit/cli.py", line 173, in _main_run  
    Credentials.get_current().check_activated(auto_resolve=True)  
  File "/usr/local/lib/python3.7/site-packages/streamlit/credentials.py", line 90, in get_current  
    Credentials()  
  File "/usr/local/lib/python3.7/site-packages/streamlit/credentials.py", line 102, in __init__  
    self._conf_file = util.get_streamlit_file_path("credentials.toml")  
  File "/usr/local/lib/python3.7/site-packages/streamlit/util.py", line 419, in get_streamlit_file_path  
    os.makedirs(st_path)  
  File "/usr/local/lib/python3.7/os.py", line 221, in makedirs  
    mkdir(name, mode)  
PermissionError: [Errno 13] Permission denied: '/.streamlit' 

Is there a way to avoid streamlit from creating that folder, or point to an existing folder?

Hi @ebonet

There’s no way to avoid creating ~/.streamlit right now, but I submitted a bug report here. We’ll get to that soon.

One thing that’s odd about your logs, though, is that it says /.streamlit rather than ~/.streamlit. So I wonder if the problem isn’t related to the $USER's $HOME folder being set to the root (/) somehow?

If you can’t figure out why that’s happening, another thing to try is: just create the folder yourself inside your Dockerfile :smiley:

RUN mkdir /.streamlit

(But you need to make sure the USER in the Dockerfile has access to / at that point in the file. Or you can put a sudo in front of that line)