Unable to install pickle5 from requirements.txt

Unsure where this error originates from. It used to work, but was suddenly broken sometime last week (we did not redeploy the app at the time).

App:
https://share.streamlit.io/stechlab/voterfraud2020-analysis/main/app.py
requirements.txt and app source code:

On set up it looks like pickle5 is installed correctly:

...
Collecting pickle5
  Downloading pickle5-0.0.11.tar.gz (132 kB)
...

but we get this error at runtime… I tried reboot to no avail.

2022-02-07 22:39:02.729 Uncaught app exception
Traceback (most recent call last):
  File "/home/appuser/venv/lib/python3.8/site-packages/streamlit/script_runner.py", line 379, in _run_script
    exec(code, module.__dict__)
  File "/app/voterfraud2020-analysis/app.py", line 8, in <module>
    from interface.explore_data import get_explore_data_page
  File "/app/voterfraud2020-analysis/interface/explore_data.py", line 5, in <module>
    from interface.df_utils import load_pickled_df
  File "/app/voterfraud2020-analysis/interface/df_utils.py", line 2, in <module>
    import pickle5 as pickle
ModuleNotFoundError: No module named 'pickle5'

I am pretty sure that pickle comes pre-installed with python.
pickle5 was meant to backport some of the functionalities that comes built in with pickle in python 3.8.3 and above.
So I would suggest you to use pickle instead of pickle5 (just the import statement would change, functions are same) and choose python 3.8 or 3.9 while deploying the app.
It should work fine then.

Hope this helps
Kanak

Thanks Kanak, but I think that suggestion doesn’t really address the issue of why Streamlit is unable to install pickle5 which is available through pip.

We use pickle5 for backwards compatibility with Python 3.7, and ideally would not like to remove it.