Su JK
Su JK

Reputation: 171

Missing BZ2 module in python

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

Answers (1)

unutbu
unutbu

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:

  1. update your version of joblib to make its dependence on bz2 optional. (Thanks to sascha for pointing this out.)
  2. or, install libbz2 and then re-build python3.6.

Upvotes: 3

Related Questions