Tpot: ImportWarning when import tpot modules

Created on 28 Feb 2018  路  4Comments  路  Source: EpistasisLab/tpot

[provide general introduction to the issue and why it is relevant to this repository]

Context of the issue

I install tpot following http://epistasislab.github.io/tpot/installing/, and I use Anaconda3 installed my python3 environment. I try to test the examples from
http://epistasislab.github.io/tpot/examples/, but run into import errors.

Process to reproduce the issue

[ordered list the process to finding and recreating the issue, example below]

import these code

from tpot import TPOTClassifier 
from sklearn.datasets import load_digits  
from sklearn.model_selection import train_test_split  

Expected result

import these packages correctly.

Current result

C:\Anaconda3\lib\site-packages\deap\tools_hypervolume\pyhv.py:33: ImportWarning: Falling back to the python version of hypervolume module. Expect this to be very slow.
"module. Expect this to be very slow.", ImportWarning)
C:\Anaconda3\lib\importlib_bootstrap.py:219: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__
return f(args, *kwds)
C:\Anaconda3\lib\importlib_bootstrap.py:219: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__
return f(args, *kwds)
C:\Anaconda3\lib\importlib_bootstrap.py:219: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__
return f(args, *kwds)
C:\Anaconda3\lib\importlib_bootstrap.py:219: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__
return f(args, *kwds)
C:\Anaconda3\lib\importlib_bootstrap.py:219: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__
return f(args, *kwds)

question

Most helpful comment

It seems the issue is about importing deap package. I think maybe this issue is only for Windows OS as we discussed before in this deap issue .

You could try to install deap 1.0.2.post2 instead via the command pip install deap==1.0.2.post2

All 4 comments

It seems the issue is about importing deap package. I think maybe this issue is only for Windows OS as we discussed before in this deap issue .

You could try to install deap 1.0.2.post2 instead via the command pip install deap==1.0.2.post2

Yes, it works! Thanks for such a quick and valid solution! cheers!

I'm running in this issue as well, although I'm using Ubuntu instead of Windows. I don't have XGBoost installed.

Output:

/usr/local/lib/python3.5/dist-packages/deap/tools/_hypervolume/pyhv.py:33: ImportWarning: Falling back to the python version of hypervolume module. Expect this to be very slow.
  "module. Expect this to be very slow.", ImportWarning)
Exception during training: Error: could not import xgboost.XGBClassifier.
No module named 'xgboost'
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/tpot/operator_utils.py", line 76, in source_decode
    exec('from {} import {}'.format(import_str, op_str))
  File "<string>", line 1, in <module>
ImportError: No module named 'xgboost'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/program/train", line 67, in train
    clf.fit(train_X, train_y)
  File "/usr/local/lib/python3.5/dist-packages/tpot/base.py", line 562, in fit
    self._fit_init()
  File "/usr/local/lib/python3.5/dist-packages/tpot/base.py", line 470, in _fit_init
    verbose=self.verbosity
  File "/usr/local/lib/python3.5/dist-packages/tpot/operator_utils.py", line 170, in TPOTOperatorClassFactory
    import_str, op_str, op_obj = source_decode(opsourse, verbose=verbose)
  File "/usr/local/lib/python3.5/dist-packages/tpot/operator_utils.py", line 80, in source_decode
    raise ImportError('Error: could not import {}.\n{}'.format(sourcecode, e))
ImportError: Error: could not import xgboost.XGBClassifier.
No module named 'xgboost'

Pip list:

# pip list
Package         Version
--------------- --------
certifi         2019.3.9
chardet         3.0.4
Click           7.0
deap            1.2.2
Flask           1.0.2
gevent          1.4.0
greenlet        0.4.15
gunicorn        19.9.0
idna            2.8
itsdangerous    1.1.0
Jinja2          2.10
joblib          0.13.2
MarkupSafe      1.1.1
numpy           1.16.2
pandas          0.24.2
pip             19.0.3
python-dateutil 2.8.0
pytz            2018.9
requests        2.21.0
scikit-learn    0.20.3
scipy           1.2.1
setuptools      40.8.0
six             1.12.0
stopit          1.1.2
TPOT            0.9.6
tqdm            4.31.1
update-checker  0.16
urllib3         1.24.1
Werkzeug        0.15.1
wheel           0.33.1

I'm simply calling the TPOTClassifier with:

clf = TPOTClassifier(generations=5, population_size=5, cv=5, verbosity=3)
clf.fit(train_X, train_y)

@nielsgl

There is no xgboost in the running environment and the verbosity=3. You may install xgboost or set verbosity=2 for ignoring this ImportError.

Please check #806 for more details.

Was this page helpful?
0 / 5 - 0 ratings