srush / streambook

Live Python Notebooks with any Editor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issue With Getting Started

BeeGass opened this issue · comments

commented

when trying to get started and running , streambook run example.py, I received this error.

Traceback (most recent call last):
  File "/home/beegass/.virtualenvs/dl_1/bin/streambook", line 5, in <module>
    from streambook.cli import app
  File "/home/beegass/.virtualenvs/dl_1/lib/python3.8/site-packages/streambook/__init__.py", line 1, in
<module>
    from .lib import *  # noqa: F401,F403
  File "/home/beegass/.virtualenvs/dl_1/lib/python3.8/site-packages/streambook/lib.py", line 4, in <modu
le>
    from streamlit.report_thread import REPORT_CONTEXT_ATTR_NAME
ModuleNotFoundError: No module named 'streamlit.report_thread'

I haven't looked into it for very long but the quick fix was to downgrade to streamlit==1.3.1 according to this.

Thanks. I fixed the requirements.txt at 1.3 https://github.com/srush/streambook/blob/main/requirements.txt . Hopefully streamlit fixes this issue soon. This part of the code is to capture stdout, which may be unnecessary in practice.

Hi @srush I think you only changed the requirements in https://github.com/srush/streambook/blob/120311b7e87e525557719cfe2a943d24a1c59e2a/requirements.txt?rgh-link-date=2022-03-08T14%3A07%3A40Z but that didn't affect the pypi package because setup.py doesn't use it:

install_requires=["streamlit", "jupytext", "watchdog", "in_place", "mistune", "typer"],

Here's a small shell script that shows the issue in docker:

build_oci_img() {
  docker build "$@" - <<EOF
  FROM python:3.8-slim
  RUN pip install streambook && pip list
EOF
}

build_oci_img
docker run --rm --interactive --tty "$(build_oci_img -q)" pip show streamlit

If you also run pip download streambook and then cat the wheel metadata using something like unzip -p streambook*whl streambook-0.3.dist-info/METADATA, you will see the version constraints are missing.

However, more generally streamlit don't see the import change as an issue because they consider it an internal API.
I will soon submit a PR that pins the version requirements and fixes the issue for the latest versions of the libraries.