出于教育目的,我试图在谷歌Colab木星笔记本中运行Streamlit应用程序。
您可以运行我的安装程序这里。几个星期前,一直这样做。
现在,该应用程序只正确加载大约5%的时间。另外95%的错误是这样的(类似于这个问题):
未能完成隧道连接 到67567754f01f.ngrok.io的连接已成功地隧道到ngrok客户端,但客户端未能建立到本地地址localhost:80的连接。 确保web服务在localhost:80上运行,并且它是一个有效的地址。 遇到的错误是:拨号tcp 127.0.0.1:80: connection :connection拒绝连接
对修复有什么建议吗?
*动机:我使用Colab,这样我就可以共享文件,让学生完全在浏览器中查看和编辑应用程序,而不需要安装。框架挑战欢迎如果有更好的方式来实现这一点!
版本:
完整代码和输出:
代码:
!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
代码:
%%writefile app.py
import streamlit as st
st.title(“hi”)
输出:
Writing app.py
代码:
from pyngrok import ngrok
public_url = ngrok.connect(port=‘80’)
print (public_url)
!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!
RequestsDependencyWarning)
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”
https://stackoverflow.com/questions/64918649
复制相似问题