Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tunnel not found error Pyngrok streamlit collab

I was developing an ui in streamlit and using pyngrok from Colab. everything was working fine till few days earlier the tunnel not found error started occurring. I am using below code. I have also upgraded pyngrok and tried but same problem persisted. Fairly new to the whole UI building and Colab pyngrok seemed most convenient way to learn. But now that this stopped working if anyone can suggest any other methods too or what am doing wrong that would be great


!pip install streamlit
!pip install pyngrok==4.1.1
import streamlit as st
from pyngrok import ngrok
# !ngrok authtoken (mykey)

# writefile app.py

def main():
  # app body
  pass

if __name__=='__main__':
  main()

!streamlit run app.py &>/dev/null&
public_url = ngrok.connect(port='8501')
public_url


#the log is also attached below after running above code which runs without errors as can be seen
#output below
2021-01-30 09:30:44.197 INFO    pyngrok.process: ngrok process starting: 1106
2021-01-30 09:30:44.218 INFO    pyngrok.process: t=2021-01-30T09:30:44+0000 lvl=info msg="no configuration paths supplied"

2021-01-30 09:30:44.220 INFO    pyngrok.process: t=2021-01-30T09:30:44+0000 lvl=info msg="using configuration at default config path" path=/root/.ngrok2/ngrok.yml

2021-01-30 09:30:44.224 INFO    pyngrok.process: t=2021-01-30T09:30:44+0000 lvl=info msg="open config file" path=/root/.ngrok2/ngrok.yml err=nil

2021-01-30 09:30:44.227 INFO    pyngrok.process: t=2021-01-30T09:30:44+0000 lvl=info msg="starting web service" obj=web addr=127.0.0.1:4040

2021-01-30 09:30:45.021 INFO    pyngrok.process: t=2021-01-30T09:30:45+0000 lvl=info msg="tunnel session started" obj=tunnels.session

2021-01-30 09:30:45.026 INFO    pyngrok.process: t=2021-01-30T09:30:45+0000 lvl=info msg="client session established" obj=csess id=a37f21d64392

2021-01-30 09:30:45.031 INFO    pyngrok.process: ngrok process has started: http://127.0.0.1:4040
2021-01-30 09:30:45.044 INFO    pyngrok.process: t=2021-01-30T09:30:45+0000 lvl=info msg=start pg=/api/tunnels id=39c5cfa99a0ab7d7

2021-01-30 09:30:45.051 INFO    pyngrok.process: t=2021-01-30T09:30:45+0000 lvl=info msg=end pg=/api/tunnels id=39c5cfa99a0ab7d7 status=200 dur=386.416µs

2021-01-30 09:30:45.057 INFO    pyngrok.process: t=2021-01-30T09:30:45+0000 lvl=info msg=start pg=/api/tunnels id=9e57507bfe0794a8

2021-01-30 09:30:45.059 INFO    pyngrok.process: t=2021-01-30T09:30:45+0000 lvl=info msg=end pg=/api/tunnels id=9e57507bfe0794a8 status=200 dur=159.931µs

2021-01-30 09:30:45.063 INFO    pyngrok.process: t=2021-01-30T09:30:45+0000 lvl=info msg=start pg=/api/tunnels id=121fc98244651186

2021-01-30 09:30:45.418 INFO    pyngrok.process: t=2021-01-30T09:30:45+0000 lvl=info msg="started tunnel" obj=tunnels name="http-8501-b9a57eaf-a9ac-4dd9-be80-7b1a5e4af344 (http)" addr=http://localhost:8501 url=http://c25e18c565f2.ngrok.io

2021-01-30 09:30:45.422 INFO    pyngrok.process: t=2021-01-30T09:30:45+0000 lvl=info msg="started tunnel" obj=tunnels name=http-8501-b9a57eaf-a9ac-4dd9-be80-7b1a5e4af344 addr=http://localhost:8501 url=https://c25e18c565f2.ngrok.io

2021-01-30 09:30:45.428 INFO    pyngrok.process: t=2021-01-30T09:30:45+0000 lvl=info msg=end pg=/api/tunnels id=121fc98244651186 status=201 dur=374.833924ms

http://c25e18c565f2.ngrok.io

Error:

enter image description here

like image 506
Devrup Banerjee Avatar asked Jan 30 '21 09:01

Devrup Banerjee


People also ask

Is it possible to use pyngrok in streamlit with Colab?

I was developing an ui in streamlit and using pyngrok from Colab. everything was working fine till few days earlier the tunnel not found error started occurring. I am using below code. I have also upgraded pyngrok and tried but same problem persisted. Fairly new to the whole UI building and Colab pyngrok seemed most convenient way to learn.

What port does pyngrok use to start streamlit?

This will start streamlit on the normal default port of 8501 which we will use for the next section in pyngrok. As we learnt earlier ngrok allows us to create a secure tunnel for accessing our local apps and webhooks.

How to run streamlit app in background using ngrok?

you should 1st run !streamlit run app.py >/dev/null, then go for by doing that you are running the streamlit app in the background 1st and then you are creating a tunnel using ngrok for exposing. source .If I am wrong here, please correct me.

Can I run streamlit apps in a Google Colab Jupyter Notebook?

For educational use, I’m trying to run Streamlit apps within a Google Colab Jupyter notebook.* You can run my setup here. This worked consistently a few weeks ago. Now, the app only loads correctly about 5% of the time. The other 95% I’m getting an error like this (similar to this question ):


1 Answers

I am the developer of pyngrok, and I wanted to reach out to let you know that I've seen reports of this pop up on our issue tracker, several on here, on Colab's issue tracker, etc. a lot in the last week. I reached out to ngrok, as that appeared to be where the issue was, and they just got back to me. They confirmed that they had inadvertently started blocking connections to Colab recently, and they have now fixed this. I just tested this again myself as well, and sure enough, it's fixed!

like image 153
alexdlaird Avatar answered Oct 13 '22 12:10

alexdlaird