I used pyenv to install python 3.8.2 and to create a virtualenv.
In the virtualenv, I used pipenv to install pandas
.
However, when importing pandas, I'm getting the following:
[...]
File "/home/luislhl/.pyenv/versions/poc-prefect/lib/python3.8/site-packages/pandas/io/common.py", line 3, in <module>
import bz2
File "/home/luislhl/.pyenv/versions/3.8.2/lib/python3.8/bz2.py", line 19, in <module>
from _bz2 import BZ2Compressor, BZ2Decompressor
ModuleNotFoundError: No module named '_bz2'
After some googling, I found out some people suggesting I rebuild Python from source after installing bzip2 library in my system.
However, after trying installing it with sudo dnf install bzip2-devel
I see that I already had it installed.
As far as I know, pyenv builds python from source when installing some version. So, why wasn't it capable of including the bzip2 module when building?
How can I manage to rebuild Python using pyenv in order to make bzip2 available? I'm in Fedora 30
Thanks in advance
UPDATE I tried installing another version of python with pyenv in verbose mode, to see the compilation output.
There is this message in the end of the compilation:
WARNING: The Python bz2 extension was not compiled. Missing the bzip2 lib?
But as I stated before, I checked I already have bzip2 installed in my system. So I don't know what to do.
pip install bzip2
in the virtual env and add the output of that. – Breslaubzip2
doesn't seem to be a valid package: pypi.org/project/bzip2 – Silvanasilvanobz2
– Breslaubz2
doesn't work either:Could not find a version that matches bz2
– Silvanasilvano