I am trying to run a python code which uses pandas library. I am getting an error saying that bz2 can not be found. I do not have root access and can not install anything. Is there a way to use pandas in another way? There are similar questions to mine in stackoverflow but they require root access to install bz2.
Importing pandas (Python 3.8.3, CentOS Linux release 7.6.1810 (Core)):
import pandas as pd
output:
Traceback (most recent call last):
File "tmp.py", line 1, in <module>
import pandas as pd
File "/home/myusername/src/dataprocessing/.venv/lib/python3.8/site-packages/pandas/__init__.py", line 22, in <module>
from pandas.compat import is_numpy_dev as _is_numpy_dev # pyright: ignore # noqa:F401
File "/home/myusername/src/dataprocessing/.venv/lib/python3.8/site-packages/pandas/compat/__init__.py", line 24, in <module>
import pandas.compat.compressors
File "/home/myusername/src/dataprocessing/.venv/lib/python3.8/site-packages/pandas/compat/compressors.py", line 7, in <module>
import bz2
ModuleNotFoundError: No module named 'bz2'
If
bz2is not mandatory, you can try to catch the exception:Update
You can also copy
bz2.pymodule fromGitHub