Summary
Hi Guys. I am trying to use sketch library (sketch ¡ PyPI) in a streamlit app but I am not able to run the app if I am importing sketch. The problem comes the moment I try to import the sketch library itself. To install sketch, you could run this command âpip install sketchâ. I am able to use sketch in normal python applications and with jupyter notebook but not with streamlit.
Steps to reproduce
Code snippet:
import streamlit as st
import sketch
st.write(âhelloâ)
Expected behavior:
You should be able to run the streamlit application saying hello.
Actual behavior:
2023-03-29 13:24:23.820 Uncaught app exception
Traceback (most recent call last):
File â/Users/rharneja/Library/Python/3.10/lib/python/site-packages/streamlit/runtime/scriptrunner/script_runner.pyâ, line 565, in _run_script
exec(code, module.dict)
File â/Users/rharneja/Documents/python_workspace/streamlit_sketch.pyâ, line 2, in
import sketch
File â/Users/rharneja/Library/Python/3.10/lib/python/site-packages/sketch/init.pyâ, line 2, in
from .pandas_extension import SketchHelper # noqa
File â/Users/rharneja/Library/Python/3.10/lib/python/site-packages/sketch/pandas_extension.pyâ, line 16, in
import lambdaprompt
File â/Users/rharneja/Library/Python/3.10/lib/python/site-packages/lambdaprompt/init.pyâ, line 7, in
nest_asyncio.apply()
File â/Users/rharneja/Library/Python/3.10/lib/python/site-packages/nest_asyncio.pyâ, line 16, in apply
loop = loop or asyncio.get_event_loop()
File â/Users/rharneja/Library/Python/3.10/lib/python/site-packages/nest_asyncio.pyâ, line 45, in _get_event_loop
loop = events.get_event_loop_policy().get_event_loop()
File â/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/events.pyâ, line 656, in get_event_loop
raise RuntimeError(âThere is no current event loop in thread %r.â
RuntimeError: There is no current event loop in thread âScriptRunner.scriptThreadâ.
Debug info
- Streamlit version: Streamlit, version 1.19.0
- Python version: Python 3.10.1
- Using PipEnv
- OS version: Mac OS Monterey V12.6.1
- Browser version: Google Chrome Version 111.0.5563.110 (Official Build) (x86_64)