Skip to content

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

Merged
basnijholt merged 3 commits into
masterfrom
skopt-importerror
May 20, 2020
Merged

prevent ImportError due to scikit-optimize and sklearn incompatibility#278
basnijholt merged 3 commits into
masterfrom
skopt-importerror

Conversation

@basnijholt

@basnijholtbasnijholt commented May 20, 2020

Copy link
Copy Markdown
Member

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

@akhmerovakhmerov left a comment

Copy link
Copy Markdown
Contributor

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

codecov-commenter commented May 20, 2020

Copy link
Copy Markdown

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 FilesCoverage Δ
adaptive/learner/learnerND.py59.72% <ø> (ø)
adaptive/notebook_integration.py18.32% <ø> (ø)
adaptive/tests/test_learners.py98.70% <0.00%> (ø)
adaptive/tests/test_runner.py94.93% <ø> (+2.25%)⬆️
adaptive/runner.py70.56% <66.66%> (+1.09%)⬆️
adaptive/learner/average_learner.py86.20% <83.33%> (+2.48%)⬆️
adaptive/tests/test_average_learner.py94.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
Copy Markdown
MemberAuthor

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

Comment threadadaptive/tests/test_learners.py Outdated
@basnijholtbasnijholt mentioned this pull request May 20, 2020
@basnijholt
basnijholt merged commit 06a084c into masterMay 20, 2020
@basnijholt
basnijholt deleted the skopt-importerror branch May 20, 2020 08:44
Sign up for freeto 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

@basnijholt@codecov-commenter@akhmerov