Tpot: 'path' must be None or a list, not <class '_frozen_importlib_external._NamespacePath'>

Created on 3 Oct 2018  路  3Comments  路  Source: EpistasisLab/tpot

I'm trying to run this following code from my SPYDER

from tpot import TPOTClassifier
from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
import numpy as np
iris = load_iris()
X_train, X_test, y_train, y_test = train_test_split(iris.data.astype(np.float64),
iris.target.astype(np.float64), train_size=0.75, test_size=0.25)
tpot = TPOTClassifier(generations=5, population_size=50, verbosity=2)
tpot.fit(X_train, y_train)
print(tpot.score(X_test, y_test))
tpot.export('tpot_iris_pipeline.py')

I'm getting this error
WHEN I RUN

C:Anaconda3libimportlib_bootstrap.py:219: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__
return f(args, *kwds)
Traceback (most recent call last):
File "", line 1, in
tpot.fit(X_train, y_train)

File "C:Anaconda3libsite-packagestpotbase.py", line 577, in fit
self._fit_init()

File "C:Anaconda3libsite-packagestpotbase.py", line 485, in _fit_init
ArgBaseClass=ARGType

File "C:Anaconda3libsite-packagestpotoperator_utils.py", line 159, in TPOTOperatorClassFactory
import_str, op_str, op_obj = source_decode(opsourse)

File "C:Anaconda3libsite-packagestpotoperator_utils.py", line 72, in source_decode
exec('from {} import {}'.format(import_str, op_str))

File "", line 1, in

File "", line 971, in _find_and_load

File "", line 951, in _find_and_load_unlocked

File "", line 890, in _find_spec

File "", line 864, in _find_spec_legacy

File "C:Anaconda3libsite-packagespyximportpyximport.py", line 253, in find_module
fp, pathname, (ext,mode,ty) = imp.find_module(fullname,package_path)

File "C:Anaconda3libimp.py", line 271, in find_module
"not {}".format(type(path)))

RuntimeError: 'path' must be None or a list, not

Please, I need urgent help... I 've tried to search online for the past 2 days, I can't find the solution.
I want to use tpot to classifier my dataset, but I'm just running this example first to see how to work.

question

Most helpful comment

Can you please try to run the example codes on python console or ipython console instead from Spyder? It seems a import error.

All 3 comments

Can you please try to run the example codes on python console or ipython console instead from Spyder? It seems a import error.

Thanks so much.... It's working on ipython.
Please, I want to ask if I can turn my result into a model and use it at API on Flask to build an application for my web? or I can only use the exported (tpot.export) for API?

Can I apply Feature Scaling and Feature Selection using PCA/LDA before training my data?

Note, this was an issue with Spyder.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

windowshopr picture windowshopr  路  4Comments

100330706 picture 100330706  路  5Comments

beijingtl picture beijingtl  路  4Comments

crawles picture crawles  路  5Comments

jonathanng picture jonathanng  路  3Comments