For educational use, I’m trying to run Streamlit apps within a Google Colab Jupyter notebook.*
Here is my setup. 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 (I edited the links):
Failed to complete tunnel connection
The connection to 67567754f01f[dot]ngrok[dot]io was successfully tunneled to your ngrok client, but the client failed to establish a connection to the local address localhost:80 .
Make sure that a web service is running on localhost:80 and that it is a valid address.
The error encountered was: dial tcp 127.0.0.1:80: connect: connection refused
streamlit 0.71.0 (also tried a couple previous versions)
pyngrok 5.0.0 (also tried 4.2.2. This is a new major version - relevant?)
Complete code and output:
!pip -q install streamlit
!pip -q install pyngrok
Building wheel for watchdog (setup.py) … done
Building wheel for blinker (setup.py) … done
Building wheel for pathtools (setup.py) … done
ERROR: requests 2.23.0 has requirement urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1, but you’ll have urllib3 1.26.2 which is incompatible.
ERROR: google-colab 1.0.0 has requirement ipykernel~=4.10, but you’ll have ipykernel 5.3.4 which is incompatible.
ERROR: datascience 0.10.6 has requirement folium==0.2.1, but you’ll have folium 0.8.3 which is incompatible.
Building wheel for pyngrok (setup.py) … done
import streamlit as st
from pyngrok import ngrok
public_url = ngrok.connect(port=‘80’)
!streamlit run app.py >/dev/null
NgrokTunnel: “http://67567754f01f.ngrok.io” -> “localhost:80”
/usr/local/lib/python3.6/dist-packages/requests/init.py:91: RequestsDependencyWarning: urllib3 (1.26.2) or chardet (3.0.4) doesn’t match a supported version!
t=2020-11-19T18:42:24+0000 lvl=warn msg=“failed to open private leg” id=61fef1ba5d31 privaddr=localhost:80 err=“dial tcp 127.0.0.1:80: connect: connection refused”
t=2020-11-19T18:42:24+0000 lvl=warn msg=“failed to open private leg” id=8da0b078aaa7 privaddr=localhost:80 err=“dial tcp 127.0.0.1:80: connect: connection refused”
Any suggestions for fixes?
*Motivation: I’m using Colab so that I can share files and have students view and edit apps entirely in the browser, with no installation required. Frame challenges welcome if there’s a better way to achieve this!