Changing of port and multiple streamlit app

Hi, can I check if it’s possible to use other port besides the default 8501? If so, how do I set it? Can I also run multiple streamlit app on a VM, assuming I can set different ports?

Thanks!

Hi @zhun_t. Great question!

You can change the port by setting:

[server]
port=9988

in your ~/.streamlit/config.toml.

Currently, you cannot set the port separately for multiple apps, but you won’t have to wait long! That feature has been implemented and is expected to land in 0.48 which will be released next week. Please follow that issue on Github for up-to-date information.

If you need a workaround right now, you could override ~/.streamlit/config.toml right before launching each server.

By the way, if you’re interested, you can see the full set of config options by running:

streamlit config show

from the command line.

Hi there,
with Streamlit, version 0.56.0, I dont see the option for multiple servers. Neither --server.port nor --port. They both return no such option.
Thanks for ideas.
JM

Can you show us the command you’re using to run a streamlit app? I can’t seem to reproduce your error.

> streamlit --server.port 8503 run str.py                  
Usage: streamlit [OPTIONS] COMMAND [ARGS]...
Try "streamlit --help" for help.

Error: no such option: --server.port

just after your curiosity I tried

streamlit run str.py --server.port 8503

and this worked. Sorry, thank you.
JM

4 Likes

Yeah, the order was incorrect. Glad you managed to fix it :slight_smile:

1 Like

streamlit run NTUT-AutoML-v1.1.py --server.port 443

I was trying to use port 443, but get error: Permission denied. Please help! (Running in AWS EC2: Window Server 2019 with ubuntu installed. Which means I ran ubuntu inside Windows Server)

(autosklearn) ntut@EC2AMAZ-CMJJ1M4:~$ streamlit run NTUT-AutoML-v1.1.py --server.port 443
Traceback (most recent call last):
File “/home/ntut/anaconda3/envs/autosklearn/bin/streamlit”, line 8, in
sys.exit(main())
File “/home/ntut/anaconda3/envs/autosklearn/lib/python3.7/site-packages/click/core.py”, line 829, in call
return self.main(*args, **kwargs)
File “/home/ntut/anaconda3/envs/autosklearn/lib/python3.7/site-packages/click/core.py”, line 782, in main
rv = self.invoke(ctx)
File “/home/ntut/anaconda3/envs/autosklearn/lib/python3.7/site-packages/click/core.py”, line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/ntut/anaconda3/envs/autosklearn/lib/python3.7/site-packages/click/core.py”, line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/ntut/anaconda3/envs/autosklearn/lib/python3.7/site-packages/click/core.py”, line 610, in invoke
return callback(*args, **kwargs)
File “/home/ntut/anaconda3/envs/autosklearn/lib/python3.7/site-packages/streamlit/cli.py”, line 228, in main_run
_main_run(target, args)
File “/home/ntut/anaconda3/envs/autosklearn/lib/python3.7/site-packages/streamlit/cli.py”, line 256, in _main_run
bootstrap.run(file, command_line, args)
File “/home/ntut/anaconda3/envs/autosklearn/lib/python3.7/site-packages/streamlit/bootstrap.py”, line 254, in run
server.start(_on_server_start)
File “/home/ntut/anaconda3/envs/autosklearn/lib/python3.7/site-packages/streamlit/server/server.py”, line 301, in start
start_listening(app)
File “/home/ntut/anaconda3/envs/autosklearn/lib/python3.7/site-packages/streamlit/server/server.py”, line 145, in start_listening
start_listening_tcp_socket(http_server)
File “/home/ntut/anaconda3/envs/autosklearn/lib/python3.7/site-packages/streamlit/server/server.py”, line 164, in start_listening_tcp_socket
http_server.listen(port, address)
File “/home/ntut/anaconda3/envs/autosklearn/lib/python3.7/site-packages/tornado/tcpserver.py”, line 151, in listen
sockets = bind_sockets(port, address=address)
File “/home/ntut/anaconda3/envs/autosklearn/lib/python3.7/site-packages/tornado/netutil.py”, line 174, in bind_sockets
sock.bind(sockaddr)
PermissionError: [Errno 13] Permission denied

Here is some solutions to the Permission denied : https://serverfault.com/questions/112795/how-to-run-a-server-on-port-80-as-a-normal-user-on-linux
I found the “redir” solution the most convenient for testing :
sudo redir --laddr=127.0.0.1 --lport=80 --caddr=127.0.0.1 --cport=8501