0

Hi just updated my version of python from 3.7 to 3.8 I am using pycharm IDE and sklearn was working perfectly fine in the previous version but now when I try to run code that was

However after updating my version it keeps giving the following error.

    "C:\Program Files\Python\python.exe" C:/Users/SmithyB/Desktop/test/K-Means.py
Traceback (most recent call last):
  File "C:/Users/SmithyB/Desktop/test/K-Means.py", line 6, in <module>
    from sklearn.cluster import KMeans
  File "C:\Program Files\Python\lib\site-packages\sklearn\__init__.py", line 80, in <module>
    from .base import clone
  File "C:\Program Files\Python\lib\site-packages\sklearn\base.py", line 21, in <module>
    from .utils import _IS_32BIT
  File "C:\Program Files\Python\lib\site-packages\sklearn\utils\__init__.py", line 20, in <module>
    from scipy.sparse import issparse
  File "C:\Program Files\Python\lib\site-packages\scipy\__init__.py", line 119, in <module>
    from scipy._lib._ccallback import LowLevelCallable
  File "C:\Program Files\Python\lib\site-packages\scipy\_lib\_ccallback.py", line 1, in <module>
    from . import _ccallback_c
ImportError: cannot import name '_ccallback_c' from 'scipy._lib' (C:\Program Files\Python\lib\site-packages\scipy\_lib\__init__.py)

I have made sure that the interpreter is correct. I have made sure that I have uninstalled older versions of python from my computer but unfortunately still no luck.

I will really appreciate it if someone can point out how to solve this problem.

Thanks

SmithyB
  • 7
  • 2
  • 1
    could you please share what all you were importing? Thanks – jimmie_roggers Jun 21 '20 at 12:00
  • 1
    Does this answer your question? [ImportError: cannot import name '\_ccallback\_c'](https://stackoverflow.com/questions/46721713/importerror-cannot-import-name-ccallback-c) – sentence Jun 21 '20 at 14:06

2 Answers2

0
  1. Try removing Scipy folder from C:/Users/SmithyB/AppData/Roaming/Python/Python36/site-packages/scipy

  2. Reinstall using pip install scipy

Dwight
  • 124
  • 2
  • 12
0

Thanks for all your input, I couldn't have solved the problem without you guys.

I am posting how I solved the problem with the hope that it will be helpful to someone.

Since the problem was originally with using the SK-Learn library I uninstalled scikit-learn

pip uninstall scikit-learn

and then reinstalled it.

pip install scikit-learn

the error did not go away after that so I followed the suggestion of uninstalling scipy

pip uninstall scipy

and then reinstalling it.

pip install scipy

I ran a code that I had written which uses sklearn previously and it worked.

SmithyB
  • 7
  • 2