Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
realsaintsteven opened this issue Oct 3, 2018 · 4 comments
Labels

Comments

@realsaintsteven
Copy link

realsaintsteven commented Oct 3, 2018

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:\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)
Traceback (most recent call last):
File "", line 1, in
tpot.fit(X_train, y_train)

File "C:\Anaconda3\lib\site-packages\tpot\base.py", line 577, in fit
self._fit_init()

File "C:\Anaconda3\lib\site-packages\tpot\base.py", line 485, in _fit_init
ArgBaseClass=ARGType

File "C:\Anaconda3\lib\site-packages\tpot\operator_utils.py", line 159, in TPOTOperatorClassFactory
import_str, op_str, op_obj = source_decode(opsourse)

File "C:\Anaconda3\lib\site-packages\tpot\operator_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:\Anaconda3\lib\site-packages\pyximport\pyximport.py", line 253, in find_module
fp, pathname, (ext,mode,ty) = imp.find_module(fullname,package_path)

File "C:\Anaconda3\lib\imp.py", line 271, in find_module
"not {}".format(type(path)))

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

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.

@weixuanfu
Copy link
Contributor

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

@realsaintsteven
Copy link
Author

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?

@Harmon758
Copy link

Note, this was an issue with Spyder.

@tharun22-kumar
Copy link

code :
from fbprophet import Prophet

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

Please resolve my error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants