'numpy: cannot import name '_CopyMode'

I am getting this error when trying to run my imports:

importError: Unable to import required dependencies: numpy: cannot import name '_CopyMode' from 'numpy._globals'

Here are my inputs, nothing fancy

import sys
sys.path.append(home)      # add home folder to module search path
import pandas as pd
from sklearn import tree
from treeviz import tree_print
from sklearn.metrics import accuracy_score

I believe my numpy is up to date, and I am using python 3.9 if that helps Thank you very much!



Solution 1:[1]

This happens immediately after the libraries are upgraded.

you can use this :

pip uninstall pandas -y
pip uninstall numpy -y
pip install pandas
pip install numpy

or use this:

pip install --upgrade numpy
pip install --upgrade pandas

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Salio