ModuleNotFoundError: No module named '_bz2'

I’ve installed streamlit on my Ubuntu 18.04 LTS with Python 3.9.7 using venv. Tried testing my installation using command:

streamlit hello

and find the following error.
import bz2
File β€œ/usr/local/lib/python3.9/bz2.py”, line 18, in
from _bz2 import BZ2Compressor, BZ2Decompressor
ModuleNotFoundError: No module named β€˜_bz2’

I tried installing bz2file from pypi but to no avail.

Thanks,

Hi @sshesh, welcome to the Streamlit community!

This sounds like a system-level issue, as described here:

Installing bz2 via apt seems to be the solution.

Best,
Randy

Thank you very much @randyzwitch for your help ! It is now working :slightly_smiling_face:

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.