aims-umich / neorl

NeuroEvolution Optimization with Reinforcement Learning
MIT License
51 stars 18 forks source link

Control the sklearn version when pip install neorl==1.6 #6

Closed XuboGU closed 3 years ago

XuboGU commented 3 years ago

Hi Majdi, after installing neorl1.6, if I input neorl for a test, an error will occur show that sklearn has not MaskedArray.

Traceback (most recent call last): File "/usr/local/bin/neorl", line 5, in from neorl.scripts import main File "/usr/local/lib/python3.7/dist-packages/neorl/scripts.py", line 42, in from neorl.tune.runners.gridtune import GRIDTUNE File "/usr/local/lib/python3.7/dist-packages/neorl/tune/init.py", line 2, in from neorl.tune.bayestune import BAYESTUNE File "/usr/local/lib/python3.7/dist-packages/neorl/tune/bayestune.py", line 30, in from skopt import gp_minimize File "/root/.local/lib/python3.7/site-packages/skopt/init.py", line 55, in from .searchcv import BayesSearchCV File "/root/.local/lib/python3.7/site-packages/skopt/searchcv.py", line 16, in from sklearn.utils.fixes import MaskedArray ImportError: cannot import name 'MaskedArray' from 'sklearn.utils.fixes' (/root/.local/lib/python3.7/site-packages/sklearn/utils/fixes.py)

The reason is that the sklearn was installed a version of 1.0 in default. A solution to this issue is to downgrade the sklearn version to 0.24.2: pip install scikit-learn==0.24.2 It will be good to set sklearn to 0.24.2 in requirement.txt.

mradaideh commented 3 years ago

Thank you @XuboGU for catching this issue, yes, it seems the very recent sklearn version was just released. I put a restriction of sklearn <= 0.24.2 during setup. Anyway, sklearn usage in NEORL is very minimal so older releases should be sufficient.