ddobrinskiy / streamlit-jupyter

Simple Python package to preview and develop streamlit apps in jupyter notebooks
https://ddobrinskiy.github.io/streamlit-jupyter
Apache License 2.0
274 stars 21 forks source link

AttributeError: module 'streamlit' has no attribute 'experimental_data_editor' #46

Open ann8ty opened 2 months ago

ann8ty commented 2 months ago

python 3.11.9 streamlit==1.38.0 streamlit-jupyter==0.2.1

notebook:

import streamlit as st

from streamlit_jupyter import StreamlitPatcher, tqdm

sp = StreamlitPatcher()
sp.jupyter()  # register streamlit with jupyter-compatible wrappers

AttributeError Traceback (most recent call last) Cell In[4], line 6 3 from streamlit_jupyter import StreamlitPatcher, tqdm 5 sp = StreamlitPatcher() ----> 6 sp.jupyter() # register streamlit with jupyter-compatible wrappers

File ~/code/data/data-workflows/.venv/lib/python3.11/site-packages/streamlit_jupyter/core.py:53, in StreamlitPatcher.jupyter(self) 51 # patch streamlit methods from MAPPING property dict 52 for method_name, wrapper in self.MAPPING.items(): ---> 53 self._wrap(method_name, wrapper) 55 self.is_registered = True

File ~/code/data/data-workflows/.venv/lib/python3.11/site-packages/streamlit_jupyter/core.py:79, in _wrap(cls, method_name, wrapper) 69 """make a streamlit method jupyter friendly 70 71 Parameters (...) 76 wrapper function to use 77 """ 78 if IN_IPYTHON: # only patch if in jupyter ---> 79 trg = getattr(st, method_name) # get the streamlit method 80 setattr(st, method_name, wrapper(trg)) # patch the method 81 cls.registered_methods.add(method_name)

AttributeError: module 'streamlit' has no attribute 'experimental_data_editor'

iSevenDays commented 2 months ago

I have the same issue

ahmad88me commented 1 month ago

I had the same problem. I download it directly from the master and it works for me.

pip install git+https://github.com/ddobrinskiy/streamlit-jupyter.git

brunocastroibarburu94 commented 3 weeks ago

I had the same problem. I download it directly from the master and it works for me.

pip install git+https://github.com/ddobrinskiy/streamlit-jupyter.git

This didn't work for me unfortunately

brunocastroibarburu94 commented 3 weeks ago

After some digging it turns out that "experimental_data_editor" has been deprecated in version 1.23.0, the fix should be straightforward as to replace "experimental_data_editor" to data_editor, is this package actively maintained?

https://docs.streamlit.io/1.29.0/develop/api-reference/data/st.experimental_data_editor

DayalStrub commented 3 weeks ago

This didn't work for me unfortunately

@brunocastroibarburu94 it works. the version hasn't been bumped (and the package hasn't been released to pypi). if you uninstall it, and then install it again anew by pointing to github (so it doesn't skip the update because it doesn't see a version change) it should work - it did for me.

From the commit history, the package seems to be "semi" maintained. Indeed this fix is present, but not "released".

I'm surprised this isn't a more common ask from the streamlit community, as i would have assumed a large part of that community overlaps with the jupyter one and would want to develop in this way, ie using jupyter nb, jupytext and streamlit.