pythonpython-3.xgoogle-cloud-platformjupyter-notebookimblearn

Why won't imblearn import?


I have successfully installed this package in a Jupyter notebook in GCP in the past multiple times. Now I am getting the following error:

Traceback (most recent call last):

File "/opt/conda/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 3553, in run_code exec(code_obj, self.user_global_ns, self.user_ns)

File "/tmp/ipykernel_1/3172500498.py", line 1, in import imblearn

File "/opt/conda/lib/python3.7/site-packages/imblearn/init.py", line 52, in from . import (

File "/opt/conda/lib/python3.7/site-packages/imblearn/ensemble/init.py", line 6, in from ._bagging import BalancedBaggingClassifier

File "/opt/conda/lib/python3.7/site-packages/imblearn/ensemble/_bagging.py", line 30, in from ..pipeline import Pipeline

File "/opt/conda/lib/python3.7/site-packages/imblearn/pipeline.py", line 22, in from .utils._metadata_requests import (

File "/opt/conda/lib/python3.7/site-packages/imblearn/utils/_metadata_requests.py", line 1492 def process_routing(_obj, _method, /, **kwargs): ^ SyntaxError: invalid syntax

I have tried restarting the kernel. I have tried "pip install -U imbalanced-learn" follow by "conda install -c conda-forge imbalanced-learn". I have tried using an older version of scipy. I am out of ideas

Edit: It looks like a new version of imblearn was launced yesterday. Trying %pip install imblearn==0.11.0 does not work because "version does not exist," but installing imbalanced-learn==0.11.0 fixed the problem


Solution

  • A new version of imblearn was launched. Trying %pip install imblearn==0.11.0 does not work because "version does not exist," but installing imbalanced-learn==0.11.0 fixed the problem