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
import streamlit as st
You should be able to run the streamlit application saying hello.
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
File “/Users/rharneja/Documents/python_workspace/streamlit_sketch.py”, line 2, in
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
File “/Users/rharneja/Library/Python/3.10/lib/python/site-packages/lambdaprompt/init.py”, line 7, in
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’.
- 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)