Reputation: 171
In python3.6
, when executing the following command:
from sklearn.model_selection import GridSearchCV
Reported Error:
from _bz2 import BZ2Compressor, BZ2Decompressor
ModuleNotFoundError: No module named '_bz2'
However, issue is that I don't have root access to machine to use the solutions posted on the same issue on stackoverflow.
On trying to locate libbz2.so
, I received following:
/usr/lib64/libbz2.so.1
/usr/lib64/libbz2.so.1.0.6
To be noted: in my bash_profile
the LIBRARY_PATH
did not have '/usr/lib64' explicitly specified when I compiled python3.6
from source.
Upvotes: 0
Views: 14416
Reputation: 879671
bz2
is an optional dependency of python, but sklearn
assumes your python installation has this module.
There are at least two possible ways to fix this:
bz2
optional. (Thanks to sascha for pointing this out.)libbz2
and then re-build python3.6.Upvotes: 3