AxeldeRomblay / MLBox

MLBox is a powerful Automated Machine Learning python library.

Home Page:https://mlbox.readthedocs.io/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ModuleNotFoundError: No module named 'mlbox' - pip install looks OK, but import mlbox fails

BobbyMadasu opened this issue · comments

MlBox is installed but still it is giving modulenotfound error

_mlbox_error

commented

Hello @BobbyMadasu,
Can you please give more details (log of pip install mlbox command, python version, os, ...) ? Thanks !

python version: 3.7
OS: ubuntu

pip install mlbox

Requirement already satisfied: mlbox in ./anaconda3/lib/python3.7/site-packages (0.8.1)
Requirement already satisfied: scikit-learn==0.21.3 in ./.local/lib/python3.7/site-packages (from mlbox) (0.21.3)
Requirement already satisfied: numpy==1.17.0 in ./.local/lib/python3.7/site-packages (from mlbox) (1.17.0)
Requirement already satisfied: lightgbm==2.2.3 in ./anaconda3/lib/python3.7/site-packages (from mlbox) (2.2.3)
Requirement already satisfied: Keras==2.2.4 in ./.local/lib/python3.7/site-packages (from mlbox) (2.2.4)
Requirement already satisfied: joblib==0.13.2 in ./.local/lib/python3.7/site-packages (from mlbox) (0.13.2)
Requirement already satisfied: tables==3.5.2 in ./.local/lib/python3.7/site-packages (from mlbox) (3.5.2)
Requirement already satisfied: xlrd==1.2.0 in ./.local/lib/python3.7/site-packages (from mlbox) (1.2.0)
Requirement already satisfied: tensorflow==1.14.0 in ./.local/lib/python3.7/site-packages (from mlbox) (1.14.0)
Requirement already satisfied: hyperopt==0.1.2 in ./.local/lib/python3.7/site-packages (from mlbox) (0.1.2)
Requirement already satisfied: scipy==1.3.0 in ./.local/lib/python3.7/site-packages (from mlbox) (1.3.0)
Requirement already satisfied: matplotlib==3.0.3 in ./.local/lib/python3.7/site-packages (from mlbox) (3.0.3)
Requirement already satisfied: pandas==0.25.0 in ./.local/lib/python3.7/site-packages (from mlbox) (0.25.0)
Requirement already satisfied: keras-preprocessing>=1.0.5 in ./.local/lib/python3.7/site-packages (from Keras==2.2.4->mlbox) (1.1.0)
Requirement already satisfied: six>=1.9.0 in ./.local/lib/python3.7/site-packages (from Keras==2.2.4->mlbox) (1.12.0)
Requirement already satisfied: keras-applications>=1.0.6 in ./.local/lib/python3.7/site-packages (from Keras==2.2.4->mlbox) (1.0.8)
Requirement already satisfied: h5py in ./.local/lib/python3.7/site-packages (from Keras==2.2.4->mlbox) (2.9.0)
Requirement already satisfied: pyyaml in ./.local/lib/python3.7/site-packages (from Keras==2.2.4->mlbox) (5.1.2)
Requirement already satisfied: numexpr>=2.6.2 in ./.local/lib/python3.7/site-packages (from tables==3.5.2->mlbox) (2.7.0)
Requirement already satisfied: mock>=2.0 in ./.local/lib/python3.7/site-packages (from tables==3.5.2->mlbox) (3.0.5)
Requirement already satisfied: absl-py>=0.7.0 in ./.local/lib/python3.7/site-packages (from tensorflow==1.14.0->mlbox) (0.8.0)
Requirement already satisfied: wheel>=0.26 in ./.local/lib/python3.7/site-packages (from tensorflow==1.14.0->mlbox) (0.33.6)
Requirement already satisfied: tensorflow-estimator<1.15.0rc0,>=1.14.0rc0 in ./.local/lib/python3.7/site-packages (from tensorflow==1.14.0->mlbox) (1.14.0)
Requirement already satisfied: tensorboard<1.15.0,>=1.14.0 in ./.local/lib/python3.7/site-packages (from tensorflow==1.14.0->mlbox) (1.14.0)
Requirement already satisfied: wrapt>=1.11.1 in ./.local/lib/python3.7/site-packages (from tensorflow==1.14.0->mlbox) (1.11.2)
Requirement already satisfied: astor>=0.6.0 in ./.local/lib/python3.7/site-packages (from tensorflow==1.14.0->mlbox) (0.8.0)
Requirement already satisfied: protobuf>=3.6.1 in ./.local/lib/python3.7/site-packages (from tensorflow==1.14.0->mlbox) (3.9.1)
Requirement already satisfied: grpcio>=1.8.6 in ./.local/lib/python3.7/site-packages (from tensorflow==1.14.0->mlbox) (1.23.0)
Requirement already satisfied: termcolor>=1.1.0 in ./.local/lib/python3.7/site-packages (from tensorflow==1.14.0->mlbox) (1.1.0)
Requirement already satisfied: gast>=0.2.0 in ./.local/lib/python3.7/site-packages (from tensorflow==1.14.0->mlbox) (0.2.2)
Requirement already satisfied: google-pasta>=0.1.6 in ./.local/lib/python3.7/site-packages (from tensorflow==1.14.0->mlbox) (0.1.7)
Requirement already satisfied: pymongo in ./.local/lib/python3.7/site-packages (from hyperopt==0.1.2->mlbox) (3.9.0)
Requirement already satisfied: tqdm in ./.local/lib/python3.7/site-packages (from hyperopt==0.1.2->mlbox) (4.35.0)
Requirement already satisfied: future in ./.local/lib/python3.7/site-packages (from hyperopt==0.1.2->mlbox) (0.17.1)
Requirement already satisfied: networkx in ./.local/lib/python3.7/site-packages (from hyperopt==0.1.2->mlbox) (2.3)
Requirement already satisfied: cycler>=0.10 in ./.local/lib/python3.7/site-packages (from matplotlib==3.0.3->mlbox) (0.10.0)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in ./.local/lib/python3.7/site-packages (from matplotlib==3.0.3->mlbox) (2.4.2)
Requirement already satisfied: kiwisolver>=1.0.1 in ./.local/lib/python3.7/site-packages (from matplotlib==3.0.3->mlbox) (1.1.0)
Requirement already satisfied: python-dateutil>=2.1 in ./.local/lib/python3.7/site-packages (from matplotlib==3.0.3->mlbox) (2.8.0)
Requirement already satisfied: pytz>=2017.2 in ./.local/lib/python3.7/site-packages (from pandas==0.25.0->mlbox) (2019.2)
Requirement already satisfied: setuptools>=41.0.0 in ./.local/lib/python3.7/site-packages (from tensorboard<1.15.0,>=1.14.0->tensorflow==1.14.0->mlbox) (41.2.0)
Requirement already satisfied: markdown>=2.6.8 in ./.local/lib/python3.7/site-packages (from tensorboard<1.15.0,>=1.14.0->tensorflow==1.14.0->mlbox) (3.1.1)
Requirement already satisfied: werkzeug>=0.11.15 in ./.local/lib/python3.7/site-packages (from tensorboard<1.15.0,>=1.14.0->tensorflow==1.14.0->mlbox) (0.15.5)
Requirement already satisfied: decorator>=4.3.0 in ./.local/lib/python3.7/site-packages (from networkx->hyperopt==0.1.2->mlbox) (4.4.0)

commented

I think the problem is with your pip... It installs mlbox in the wrong repo. Can you try to upgrade pip or use pip3 instead ? Also can you try to import mlbox using python3 in the terminal :
$ python3
>>> import mlbox

Python 3.7.3 (default, Mar 27 2019, 22:11:17)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.

import mlbox
Using TensorFlow backend.
/home/ubuntu/.local/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
/home/ubuntu/.local/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/home/ubuntu/.local/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:518: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
/home/ubuntu/.local/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/home/ubuntu/.local/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint32 = np.dtype([("qint32", np.int32, 1)])
/home/ubuntu/.local/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_resource = np.dtype([("resource", np.ubyte, 1)])
/home/ubuntu/.local/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:541: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
/home/ubuntu/.local/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:542: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/home/ubuntu/.local/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:543: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
/home/ubuntu/.local/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:544: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/home/ubuntu/.local/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:545: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint32 = np.dtype([("qint32", np.int32, 1)])
/home/ubuntu/.local/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:550: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_resource = np.dtype([("resource", np.ubyte, 1)])
Traceback (most recent call last):
File "", line 1, in
File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/mlbox/init.py", line 9, in
from .prediction import *
File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/mlbox/prediction/init.py", line 1, in
from .predictor import *
File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/mlbox/prediction/predictor.py", line 15, in
matplotlib.use('TkAgg')
AttributeError: module 'matplotlib' has no attribute 'use'

Thanks for your patience, I was not available this month. Apparently the problem comes from matplotlib

File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/mlbox/prediction/predictor.py", line 15, in
matplotlib.use('TkAgg')
AttributeError: module 'matplotlib' has no attribute 'use'

Thus mlbox cannot be imported.

Open a terminal and copy paste the following
import matplotlib
matplotlib.use('TkAgg')

Does it raise any error ?

If in any case you solved the problem, thanks to share your solution and to close the issue :)

commented

Normally it has been fixed. See #82