BUILD: Getting Syntax error for pandas library import in python If not using virtual env

This issue has been tracked since 2022-09-20.

Installation check



Installation Method

pip install

pandas Version


Python Version


Installation Logs

If I use virtual env then everything is fine But if I run simply then getting syntax error for any kind of library import

Consider a simple pandas library import program

import pandas as pd

Traceback (most recent call last):
  File "C:\Users\Keshav\Desktop\GAN_Assignment\", line 1, in <module>
    import pandas as pd
  File "C:\Users\Keshav\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\", line 22, in <module>
    from pandas.compat import is_numpy_dev as _is_numpy_dev
  File "C:\Users\Keshav\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\compat\", line 15, in <module>      
    from pandas.compat.numpy import (
  File "C:\Users\Keshav\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\compat\numpy\", line 4, in <module> 
    from pandas.util.version import Version
  File "C:\Users\Keshav\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\util\", line 1, in <module>
    from pandas.util._decorators import (  # noqa:F401
  File "C:\Users\Keshav\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\util\", line 14, in <module>     
    from import cache_readonly  # noqa:F401
  File "C:\Users\Keshav\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\_libs\", line 13, 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\Keshav\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\_libs\tslibs\", line 30, in <module>
    from pandas._libs.tslibs.conversion import (
  File "pandas\_libs\tslibs\conversion.pyx", line 1, in init pandas._libs.tslibs.conversion
  File "pandas\_libs\tslibs\timezones.pyx", line 14, in init pandas._libs.tslibs.timezones
  File "C:\Users\Keshav\AppData\Local\Programs\Python\Python310\lib\site-packages\dateutil\", line 78
SyntaxError: invalid syntax


lithomas1 wrote this answer on 2022-09-20

This looks like a problem with dateutil not pandas. Can you try pip uninstalling python-dateutil and reinstalling it?

phofl wrote this answer on 2022-09-29

Closing for now. Please ping to reopen, when you can answer questions

More Details About Repo
Owner Name pandas-dev
Repo Name pandas
Full Name pandas-dev/pandas
Language Python
Created Date 2010-08-24
Updated Date 2022-10-04
Star Count 35430
Watcher Count 1120
Fork Count 15089
Issue Count 3589


Issue Title Created Date Updated Date