Spyder:AttributeError: module ‘pandas‘ has no attribute ‘core‘

created at 06-10-2022 views: 21

What should I do if Spyder can't be opened? Don't panic. In the Anaconda Prompt terminal enter:

spyder --new-instance

Check why it can't be opened, mine is:

Traceback (most recent call last):
  File "C:\Users\ge\Anaconda3\Scripts\spyder-script.py", line 5, in <module>
  File "C:\Users\ge\Anaconda3\lib\site-packages\spyder\app\start.py", line 114, in main
    from spyder.app import mainwindow
  File "C:\Users\ge\Anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 162, in <module>
    from spyder.utils.environ import WinUserEnvDialog
  File "C:\Users\ge\Anaconda3\lib\site-packages\spyder\utils\environ.py", line 20, in <module>
    from spyder.widgets.variableexplorer.collectionseditor import CollectionsEditor
  File "C:\Users\ge\Anaconda3\lib\site-packages\spyder\widgets\variableexplorer\collectionseditor.py", line 46, in <module>
    from spyder.widgets.variableexplorer.importwizard import ImportWizard
  File "C:\Users\ge\Anaconda3\lib\site-packages\spyder\widgets\variableexplorer\importwizard.py", line 26, in <module>
    import pandas as pd
  File "C:\Users\ge\Anaconda3\lib\site-packages\pandas\__init__.py", line 39, in <module>
    from pandas.core.api import *
  File "C:\Users\ge\Anaconda3\lib\site-packages\pandas\core\api.py", line 10, in <module>
    from pandas.core.groupby import Grouper
  File "C:\Users\ge\Anaconda3\lib\site-packages\pandas\core\groupby.py", line 40, in <module>
    from pandas.core.frame import DataFrame
  File "C:\Users\ge\Anaconda3\lib\site-packages\pandas\core\frame.py", line 72, in <module>
    from pandas.core.series import Series
  File "C:\Users\ge\Anaconda3\lib\site-packages\pandas\core\series.py", line 51, in <module>
    import pandas.core.strings as strings
AttributeError: module 'pandas' has no attribute 'core'

At this time, you can uninstall pandas first, and it is important to enter spyder. input the command:

pip uninstall pandas

After deleting it, I found that I can open spyder, and then install pandas back:

pip install pandas

If you are lucky, you can install pandas once successfully without reporting an error, but I throw it here

Installing collected packages: pytz, python-dateutil, pandas
  Attempting uninstall: pytz
    WARNING: Ignoring invalid distribution -atplotlib (c:\users\ge\anaconda3\lib\site-packages)
    Found existing installation: pytz 2016.10
ERROR: Cannot uninstall 'pytz'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

It shows that pytz cannot be uninstalled. pytz is a dependency of many libraries. If you want to uninstall pytz, you can find pytz-2016.6.1-py3.5.egg-info under Anaconda3\Lib\site-packages. Uninstall manually

At this time, installing pandas will not report an error

back to spyder

spyder can be opened, but this pop-up window pops up

You have missing dependencies

nbconvert >=4.0: None (NOK)

Please install them to avoid this message

Just reinstall nbconvert

pip install nbconvert

# OR

conda install nbconvert
created at:06-10-2022
edited at: 06-10-2022: