Can't seem to import BayesianOptimization form bayes_opt. There is a problem with 'just_fix_windows_console' from 'colorama'. This was working 5 days ago so I'm not if one of the packages has been updated, but I can't seem to get it to work.
!pip install -U colorama
!pip install PyYAML
!pip install rsa
!pip install -U bayesian-optimization
Keyring is skipped due to an exception: 'keyring.backends' Requirement already satisfied: colorama in /opt/conda/lib/python3.7/site-packages (0.4.6) WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv Keyring is skipped due to an exception: 'keyring.backends' Requirement already satisfied: PyYAML in /opt/conda/lib/python3.7/site-packages (5.4) WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv Keyring is skipped due to an exception: 'keyring.backends' Requirement already satisfied: rsa in /opt/conda/lib/python3.7/site-packages (4.7) Requirement already satisfied: pyasn1>=0.1.3 in /opt/conda/lib/python3.7/site-packages (from rsa) (0.4.8) WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv Keyring is skipped due to an exception: 'keyring.backends' Requirement already satisfied: bayesian-optimization in /opt/conda/lib/python3.7/site-packages (1.4.2) Requirement already satisfied: scikit-learn>=0.18.0 in /opt/conda/lib/python3.7/site-packages (from bayesian-optimization) (0.22.1) Requirement already satisfied: colorama>=0.4.6 in /opt/conda/lib/python3.7/site-packages (from bayesian-optimization) (0.4.6) Requirement already satisfied: scipy>=1.0.0 in /opt/conda/lib/python3.7/site-packages (from bayesian-optimization) (1.4.1) Requirement already satisfied: numpy>=1.9.0 in /opt/conda/lib/python3.7/site-packages (from bayesian-optimization) (1.21.6) Requirement already satisfied: joblib>=0.11 in /opt/conda/lib/python3.7/site-packages (from scikit-learn>=0.18.0->bayesian-optimization) (0.14.1) WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
from bayes_opt import BayesianOptimization, UtilityFunction
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-6-82de8ae0708e> in <module>
----> 1 from bayes_opt import BayesianOptimization, UtilityFunction
/opt/conda/lib/python3.7/site-packages/bayes_opt/__init__.py in <module>
----> 1 from .bayesian_optimization import BayesianOptimization, Events
2 from .domain_reduction import SequentialDomainReductionTransformer
3 from .util import UtilityFunction
4 from .logger import ScreenLogger, JSONLogger
5 from .constraint import ConstraintModel
/opt/conda/lib/python3.7/site-packages/bayes_opt/bayesian_optimization.py in <module>
3 from bayes_opt.constraint import ConstraintModel
4
----> 5 from .target_space import TargetSpace
6 from .event import Events, DEFAULT_EVENTS
7 from .logger import _get_default_logger
/opt/conda/lib/python3.7/site-packages/bayes_opt/target_space.py in <module>
2
3 import numpy as np
----> 4 from .util import ensure_rng, NotUniqueError
5 from .util import Colours
6
/opt/conda/lib/python3.7/site-packages/bayes_opt/util.py in <module>
3 from scipy.stats import norm
4 from scipy.optimize import minimize
----> 5 from colorama import just_fix_windows_console
6
7
ImportError: cannot import name 'just_fix_windows_console' from 'colorama' (/opt/conda/lib/python3.7/site-packages/colorama/__init__.py)
I had this issue and fixed it with %pip install bayesian-optimization==1.4.1
. There was a new release recently (v1.4.2) which may have caused dependency issues.