Application that works in local but not online, I can't find any explicit reason

Hello,

Since the new version of Streamlit, my application does not want to start anymore.

I removed some Python libraries but nothing works, I can’t find any explicit reason.

Thanks for your advice

My logs :
[ UTC ] Logs for voltek62-codex-app-gallery-streamlit-app-b5f3sp.streamlitapp.com/

────────────────────────────────────────────────────────────────────────────────────────

[20:56:25] Starting up repository: ‘codex-app-gallery’, branch: ‘main’, main module: ‘streamlit_app.py’

[20:56:25] Cloning repository…

[20:56:27] ! Cloning into ‘/app/codex-app-gallery’…

[20:56:27] ! Cloned repository!

[20:56:27] ! Pulling code changes from Github…

[20:56:28] ! Processing dependencies…

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 118.7/118.7 KB 198.8 MB/s eta 0:00:00[2022-06-26 21:44:28.882347]

Successfully installed PyWavelets-1.3.0 PyYAML-6.0 Send2Trash-1.8.0 absl-py-1.1.0 altair-4.2.0 argon2-cffi-21.3.0 argon2-cffi-bindings-21.2.0 arviz-0.12.1 astor-0.8.1 asttokens-2.0.5 astunparse-1.6.3 attrs-21.4.0 backcall-0.2.0 base58-2.1.1 beautifulsoup4-4.11.1 bleach-5.0.0 blinker-1.4 cachetools-5.2.0 causalimpact-0.2.4 certifi-2022.6.15 cffi-1.15.0 cftime-1.6.0 charset-normalizer-2.0.12 click-7.1.2 cycler-0.11.0 debugpy-1.6.0 decorator-5.1.1 defusedxml-0.7.1 deprecat-2.1.1 dill-0.3.5.1 entrypoints-0.4 et-xmlfile-1.1.0 executing-0.8.3 fastjsonschema-2.15.3 fastprogress-1.0.2 filelock-3.7.1 flatbuffers-1.12 fonttools-4.33.3 gast-0.4.0 gitdb-4.0.9 gitpython-3.1.27 google-auth-2.8.0 google-auth-oauthlib-0.4.6 google-pasta-0.2.0 grpcio-1.47.0 h5py-3.7.0 htmlmin-0.1.12 idna-3.3 imagehash-4.2.1 importlib-metadata-4.12.0 ipykernel-6.15.0 ipython-8.4.0 ipython-genutils-0.2.0 ipywidgets-7.7.1 jedi-0.18.1 jinja2-3.1.2 joblib-1.1.0 jsonschema-4.6.0 jupyter-client-7.3.4 jupyter-core-4.10.0 jupyterlab-pygments-0.2.2 jupyterlab-widgets-1.1.1 keras-2.9.0 keras-preprocessing-1.1.2 kiwisolver-1.4.3 libclang-14.0.1 markdown-3.3.7 markupsafe-2.1.1 matplotlib-3.5.2 matplotlib-inline-0.1.3 missingno-0.5.1 mistune-0.8.4 multimethod-1.8 nbclient-0.6.4 nbconvert-6.5.0 nbformat-5.4.0 nest-asyncio-1.5.5 netcdf4-1.6.0 networkx-2.8.4 notebook-6.4.12 numpy-1.22.1 oauthlib-3.2.0 openai-0.20.0 openpyxl-3.0.10 opt-einsum-3.3.0 packaging-21.3 pandas-1.4.2 pandas-profiling-3.2.0 pandas-stubs-1.4.2.220622 pandocfilters-1.5.0 parso-0.8.3 patsy-0.5.2 pexpect-4.8.0 phik-0.12.2 pickleshare-0.7.5 pillow-9.1.1 plotly-5.9.0 prometheus-client-0.14.1 prompt-toolkit-3.0.29 protobuf-3.19.4 psutil-5.9.1 ptyprocess-0.7.0 pure-eval-0.2.2 pyarrow-8.0.0 pyasn1-0.4.8 pyasn1-modules-0.2.8 pycparser-2.21 pydantic-1.9.1 pydeck-0.7.1 pygments-2.12.0 pymc3-3.11.5 pyparsing-3.0.9 pyrsistent-0.18.1 python-dateutil-2.8.2 pytz-2022.1 pytz-deprecation-shim-0.1.0.post0 pyzmq-23.2.0 requests-2.28.0 requests-oauthlib-1.3.1 rsa-4.8 scipy-1.7.3 seaborn-0.11.2 semver-2.13.0 setuptools-62.6.0 six-1.16.0 smmap-5.0.0 soupsieve-2.3.2.post1 stack-data-0.3.0 statsmodels-0.13.2 streamlit-1.1.0 tangled-up-in-unicode-0.2.0 tenacity-8.0.1 tensorboard-2.9.1 tensorboard-data-server-0.6.1 tensorboard-plugin-wit-1.8.1 tensorflow-2.9.1 tensorflow-estimator-2.9.0 tensorflow-io-gcs-filesystem-0.26.0 termcolor-1.1.0 terminado-0.15.0 theano-pymc-1.1.2 tinycss2-1.1.1 toml-0.10.2 toolz-0.11.2 torch-1.11.0 tornado-6.1 tqdm-4.64.0 traitlets-5.3.0 typing-extensions-4.2.0 tzdata-2022.1 tzlocal-4.2 urllib3-1.26.9 validators-0.20.0 visions-0.7.4 watchdog-2.1.9 wcwidth-0.2.5 webencodings-0.5.1 werkzeug-2.1.2 wheel-0.37.1 widgetsnbextension-3.6.1 wrapt-1.14.1 xarray-2022.3.0 xarray-einstats-0.3.0 zipp-3.8.0

WARNING: You are using pip version 22.0.3; however, version 22.1.2 is available.

You should consider upgrading via the ‘/home/appuser/venv/bin/python -m pip install --upgrade pip’ command.

Checking if Streamlit is installed

2022-06-26 21:46:42.333 INFO matplotlib.font_manager: generated new fontManager

Found Streamlit version 1.1.0 in the environment

Streamlit 1.1.0 is present. Installing click 8

Collecting click==8

Downloading click-8.0.0-py3-none-any.whl (96 kB)

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 96.9/96.9 KB 6.6 MB/s eta 0:00:00[2022-06-26 21:46:44.443053]

Installing collected packages: click

Attempting uninstall: click

Found existing installation: click 7.1.2

Uninstalling click-7.1.2:

Successfully uninstalled click-7.1.2

ERROR: pip’s dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.

streamlit 1.1.0 requires click<8.0,>=7.0, but you have click 8.0.0 which is incompatible.

Successfully installed click-8.0.0

WARNING: You are using pip version 22.0.3; however, version 22.1.2 is available.

You should consider upgrading via the ‘/home/appuser/venv/bin/python -m pip install --upgrade pip’ command.

Streamlit 1.1.0 is present. Installing protobuf 3.20.1

Collecting protobuf==3.20.1

Downloading protobuf-3.20.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl (1.0 MB)

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.0/1.0 MB 21.1 MB/s eta 0:00:00[2022-06-26 21:46:47.014307]

Installing collected packages: protobuf

Attempting uninstall: protobuf

Found existing installation: protobuf 3.19.4

Uninstalling protobuf-3.19.4:

Successfully uninstalled protobuf-3.19.4

ERROR: pip’s dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.

tensorflow 2.9.1 requires protobuf<3.20,>=3.9.2, but you have protobuf 3.20.1 which is incompatible.

tensorboard 2.9.1 requires protobuf<3.20,>=3.9.2, but you have protobuf 3.20.1 which is incompatible.

streamlit 1.1.0 requires click<8.0,>=7.0, but you have click 8.0.0 which is incompatible.

Successfully installed protobuf-3.20.1

WARNING: You are using pip version 22.0.3; however, version 22.1.2 is available.

You should consider upgrading via the ‘/home/appuser/venv/bin/python -m pip install --upgrade pip’ command.

────────────────────────────────────────────────────────────────────────────────────────

[21:46:49] ! Python dependencies were installed from /app/codex-app-gallery/requirements.txt using pip.

[21:46:49] ! Processed dependencies!

[21:46:54] ! Updated app!

[11:15:23] ! Preparing system…

[11:15:23] !Spinning up manager process…

1 Like

Salut Vincent!

Thanks for reporting that issue.

I can’t quite pinpoint what the problem may be, yet I’ve passed this issue to the Devs.

Meanwhile, may I suggest you pin your app to a legacy version of Streamlit and see if the problem persists?

Best,
Charly

From the logs, it seems that you are pinning Streamlit version 1.1.0. Can you please upgrade to the latest version of streamlit (1.10)?

Hopefully, that should solve the issue.

Let me know

Charly

It is better but now, I caught this error :

Downloading ImageHash-3.0.tar.gz (5.1 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
  Downloading ImageHash-2.2.tar.gz (4.9 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
  Downloading ImageHash-2.1.tar.gz (4.8 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
INFO: This is taking longer than usual. You might need to provide the dependency resolver with stricter constraints to reduce runtime. See https://pip.pypa.io/warnings/backtracking for guidance. If you want to abort this run, press Ctrl + C.
  Downloading ImageHash-2.0.tar.gz (4.8 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
  Downloading ImageHash-1.0.tar.gz (4.1 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
  Downloading ImageHash-0.3.tar.gz (4.0 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
  Downloading ImageHash-0.2.tar.gz (3.5 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
  Downloading ImageHash-0.1.tar.gz (2.5 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'error'
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [6 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-4u7tnuvd/imagehash_9eb189ea894644aeaa8fa242795d2046/setup.py", line 13, in <module>
          long_description=open('README.rst').read(),
      FileNotFoundError: [Errno 2] No such file or directory: 'README.rst'
      [end of output]
1 Like

Thanks Vincent

I can see the following error:

FileNotFoundError: [Errno 2] No such file or directory: 'README.rst'

Could adding a README.rst fix this issue?

Thanks,
Charly

Please share a link to your public github repo.

Thanks, Franky!

The repo is private currently, yet I can give you access if you dm me your email?

Charly

@Vincent_Terrasi, I managed to make it work again :slight_smile:

App: https://codex-for-seo.streamlitapp.com/
Repo: https://github.com/CharlyWargnier/codex-app-gallery

It seems it was due to get_report_ctx, a Streamlit module that was renamed in the later versions.

So I replaced this code snippet in various parts of the code:

def _get_session():
    import streamlit.report_thread as ReportThread
    from streamlit.server.server import Server
    session_id = get_report_ctx().session_id
    session_info = Server.get_current()._get_session_info(session_id)
    if session_info is None:
        raise RuntimeError("Couldn't get your Streamlit Session object.")
    return str(session_info.session)[50:64]

With that one:

from streamlit.scriptrunner.script_run_context import get_script_run_ctx
from streamlit.server.server import Server

def _get_session():
    session_id = get_script_run_ctx().session_id
    session = Server.get_current().get_session_by_id(session_id)
    if session is None:
        raise RuntimeError("Couldn't get your Streamlit Session object.")
    return str(session)[50:64]

Thanks to @okld for the guidance on this :pray:

@Vincent_Terrasi: I’ve not tested the various modules yet. Please give it a try, hopefully, they work fine.

Best,
Charly

2 Likes

You made my day :

It is perfect

2 Likes