r/learnpython • • Sep 12 '26

Unable to import pandas

Everything was working up until a few minutes ago. I'm running python on windows 11, downloaded from python.org yesterday. I did a pip install of pandas, also yesterday, and I was able to run various py scripts, getting the results I wanted. Suddenly this morning, when I ran a script that had run just fine a few minutes ago, I got an error. I reduced my script to this:

import json

import requests

import pandas

and I got the same set of error messages (below). I didn't change anything in the environment, this happened, afaik, spontaneously. I'm a complete python newb, but all was going well until this. Help!

Traceback (most recent call last):

File "C:\Users\John\My Drive\SyncDrive\eBird\test.py", line 3, in <module>

import pandas

File "C:\Users\John\AppData\Local\Python\pythoncore-3.14-64\Lib\site-packages\pandas__init__.py", line 56, in <module>

import pandas.core.config_init # pyright: ignore[reportUnusedImport] # noqa: F401

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "C:\Users\John\AppData\Local\Python\pythoncore-3.14-64\Lib\site-packages\pandas\core\config_init.py", line 31, in <module>

from pandas.errors import Pandas4Warning

File "C:\Users\John\AppData\Local\Python\pythoncore-3.14-64\Lib\site-packages\pandas\errors__init__.py", line 12, in <module>

from pandas._libs.tslibs import (

...<3 lines>...

)

File "C:\Users\John\AppData\Local\Python\pythoncore-3.14-64\Lib\site-packages\pandas_libs__init__.py", line 18, in <module>

from pandas._libs.interval import Interval

File "pandas/_libs/interval.pyx", line 1, in init pandas._libs.interval

File "pandas/_libs/hashtable.pyx", line 1, in init pandas._libs.hashtable

File "pandas/_libs/missing.pyx", line 1, in init pandas._libs.missing

File "C:\Users\John\AppData\Local\Python\pythoncore-3.14-64\Lib\site-packages\pandas_libs\tslibs__init__.py", line 41, in <module>

from pandas._libs.tslibs.conversion import localize_pydatetime

File "pandas/_libs/tslibs/conversion.pyx", line 1, in init pandas._libs.tslibs.conversion

File "pandas/_libs/tslibs/offsets.pyx", line 1, in init pandas._libs.tslibs.offsets

File "pandas/_libs/tslibs/timestamps.pyx", line 1, in init pandas._libs.tslibs.timestamps

File "pandas/_libs/tslibs/timedeltas.pyx", line 1, in init pandas._libs.tslibs.timedeltas

File "pandas/_libs/tslibs/timezones.pyx", line 18, in init pandas._libs.tslibs.timezones

File "C:\Users\John\AppData\Local\Python\pythoncore-3.14-64\Lib\site-packages\dateutil\tz__init__.py", line 2, in <module>

from .tz import *

File "C:\Users\John\AppData\Local\Python\pythoncore-3.14-64\Lib\site-packages\dateutil\tz\tz.py", line 19, in <module>

import six

File "C:\Users\John\My Drive\SyncDrive\eBird\six.py", line 25

return data

^

IndentationError: unindent does not match any outer indentation level

1 Upvotes

17 comments sorted by

View all comments

2

u/transendingAI Sep 25 '26

The key is at the bottom of the traceback: dateutil tries to import the six package, but Python loads your file C:\Users\John\My Drive\SyncDrive\eBird\six.py instead. That file then raises the indentation error.

Rename your local six.py to something that doesn't share a package name, then restart Python and try import pandas again. Fixing its indentation alone would still leave it taking the place of the package that dateutil needs.

1

u/JohnRT54 Sep 25 '26

Thanks. That was it.