I am trying to use ML Ensemble. You can see installation details here: http://ml-ensemble.com/info/start/install.html.
I would run in terminal:
pip3 install sklearn
pip3 install mlens
pip3 install pandas
pip3 install -U mlens
and I have Python 3.11.3 installed as well as the newest version of pip. I would then run the attached python file, which would fail at the line from mlens.ensemble import SuperLearner
.
The error I get is:
[MLENS] backend: threading
Traceback (most recent call last):
File "/Users/missybridgwater/Developer/mii/whi/practice/init_iris.py", line 5, in <module>
from mlens.ensemble import SuperLearner
File "/Users/missybridgwater/Developer/mii/whi/whivenv/lib/python3.11/site-packages/mlens/ensemble/__init__.py", line 12, in <module>
from .super_learner import SuperLearner
File "/Users/missybridgwater/Developer/mii/whi/whivenv/lib/python3.11/site-packages/mlens/ensemble/super_learner.py", line 12, in <module>
from .base import BaseEnsemble
File "/Users/missybridgwater/Developer/mii/whi/whivenv/lib/python3.11/site-packages/mlens/ensemble/base.py", line 20, in <module>
from ..parallel import Layer, ParallelProcessing, make_group
File "/Users/missybridgwater/Developer/mii/whi/whivenv/lib/python3.11/site-packages/mlens/parallel/__init__.py", line 15, in <module>
from .learner import Learner, EvalLearner, Transformer, EvalTransformer
File "/Users/missybridgwater/Developer/mii/whi/whivenv/lib/python3.11/site-packages/mlens/parallel/learner.py", line 24, in <module>
from ..metrics import Data
File "/Users/missybridgwater/Developer/mii/whi/whivenv/lib/python3.11/site-packages/mlens/metrics/__init__.py", line 10, in <module>
from ..externals.sklearn.scorer import make_scorer
File "/Users/missybridgwater/Developer/mii/whi/whivenv/lib/python3.11/site-packages/mlens/externals/sklearn/scorer.py", line 33, in <module>
from .type_of_target import type_of_target
File "/Users/missybridgwater/Developer/mii/whi/whivenv/lib/python3.11/site-packages/mlens/externals/sklearn/type_of_target.py", line 10, in <module>
from collections import Sequence
ImportError: cannot import name 'Sequence' from 'collections' (/opt/homebrew/Cellar/python@3.11/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/collections/__init__.py)
When I open the init.py file, there seems to be some errors with how it is working. For example, there is this line:
import _collections_abc
import sys as _sys
from itertools import chain as _chain
from itertools import repeat as _repeat
from itertools import starmap as _starmap
from keyword import iskeyword as _iskeyword
from operator import eq as _eq
from operator import itemgetter as _itemgetter
from reprlib import recursive_repr as _recursive_repr
from _weakref import proxy as _proxy
try:
from _collections import deque
except ImportError:
pass
else:
_collections_abc.MutableSequence.register(deque)
try:
from _collections import defaultdict
except ImportError:
pass
and it underlines _collections (i.e. it is not recognizing it). Is this an error with Python3 or with ML Ensemble?
I have messed around a bit with the init.py file, but that does not seem to be solving it. Is this an error with ML Ensemble or Python? Should I try uninstalling and reinstalling python3? How can I go about resolving this import error?