Error: cannot import name 'SpearmanRConstantInputWarning' from 'scipy.stats'

Question:

I’m getting an error when importing the skbio package on Google Colab. The error message is related to SpearmanRConstantInputWarning of the scipy.stats package. What should I do to solve this problem?
I’ve tried to uninstall and install skbio and scipy, but it has not worked.

enter image description here

Asked By: kvratto

||

Answers:

Seems to be some issue with the version. If you run

pip install scikit-bio==0.5.6

it shouldn’t show that problem, at least it worked when I tried for 0.5.6 and 0.5.5 in Colab.

Answered By: 3991santiago

I had a similar problem, but could not downgrade to scikit-bio==0.5.6 as it conflicted with my Python version (3.10). An alternative workaround is downgrading scipy:

conda install -c conda-forge scipy=1.8

Presumably which package to downgrade will depend on your circumstances.

(Would have added as a comment to 3991santiago’s answer but I do not have the reputation)

Answered By: BaileyA