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

prevent ImportError due to scikit-optimize and sklearn incompatibility #278

Merged
merged 3 commits into from
May 20, 2020

Conversation

basnijholt
Copy link
Member

@basnijholt basnijholt commented May 20, 2020

Description

All tests fail with

______________ ERROR collecting adaptive/tests/test_learnernd.py ______________
ImportError while importing test module 'D:\a\1\s\adaptive\tests\test_learnernd.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
.tox\py36-alldeps\lib\site-packages\_pytest\python.py:511: in _importtestmodule
    mod = self.fspath.pyimport(ensuresyspath=importmode)
.tox\py36-alldeps\lib\site-packages\py\_path\local.py:701: in pyimport
    __import__(modname)
.tox\py36-alldeps\lib\site-packages\_pytest\assertion\rewrite.py:152: in exec_module
    exec(co, module.__dict__)
adaptive\tests\test_learnernd.py:7: in <module>
    from .test_learners import generate_random_parametrization, ring_of_fire
.tox\py36-alldeps\lib\site-packages\_pytest\assertion\rewrite.py:152: in exec_module
    exec(co, module.__dict__)
adaptive\tests\test_learners.py:31: in <module>
    from adaptive.learner.skopt_learner import SKOptLearner
adaptive\learner\skopt_learner.py:4: in <module>
    from skopt import Optimizer
.tox\py36-alldeps\lib\site-packages\skopt\__init__.py:54: in <module>
    from .searchcv import BayesSearchCV
.tox\py36-alldeps\lib\site-packages\skopt\searchcv.py:16: in <module>
    from sklearn.utils.fixes import MaskedArray
E   ImportError: cannot import name 'MaskedArray'

See scikit-optimize/scikit-optimize#902

Checklist

  • Fixed style issues using pre-commit run --all (first install using pip install pre-commit)
  • pytest passed

Type of change

Check relevant option(s).

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Copy link
Contributor

@akhmerov akhmerov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please open an issue to track the regression, and add a TODO comment in the code with the explanation why we catch import error and referring to the issue.

Also: did you find this problem reported upstream? If yes, please link the upstream bug report, otherwise please report it.

@codecov-commenter
Copy link

codecov-commenter commented May 20, 2020

Codecov Report

Merging #278 into master will increase coverage by 0.18%.
The diff coverage is 83.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #278      +/-   ##
==========================================
+ Coverage   80.49%   80.67%   +0.18%     
==========================================
  Files          34       34              
  Lines        4588     4591       +3     
  Branches      828      828              
==========================================
+ Hits         3693     3704      +11     
+ Misses        768      764       -4     
+ Partials      127      123       -4     
Impacted Files Coverage Δ
adaptive/learner/learnerND.py 59.72% <ø> (ø)
adaptive/notebook_integration.py 18.32% <ø> (ø)
adaptive/tests/test_learners.py 98.70% <0.00%> (ø)
adaptive/tests/test_runner.py 94.93% <ø> (+2.25%) ⬆️
adaptive/runner.py 70.56% <66.66%> (+1.09%) ⬆️
adaptive/learner/average_learner.py 86.20% <83.33%> (+2.48%) ⬆️
adaptive/tests/test_average_learner.py 94.44% <100.00%> (+1.58%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1c60897...b71c6e8. Read the comment docs.

@basnijholt
Copy link
Member Author

I've already linked the upstream issue and I will add a todo in the code referring to this PR.

@basnijholt basnijholt mentioned this pull request May 20, 2020
@basnijholt basnijholt merged commit 06a084c into master May 20, 2020
@basnijholt basnijholt deleted the skopt-importerror branch May 20, 2020 08:44
@basnijholt basnijholt added the bug label Jun 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants