3

I have a pretty simple Prophet script that I'm running on a RHEL 6.6 Santiago system. When I run it, I get this traceback

Traceback (most recent call last):
  File "working_v1_runSplunkProphet.py", line 7, in <module>
    import pandas as pd
  File "/home/scadmin/prophet/lib/python3.6/site-packages/pandas/__init__.py", line 30, in <module>
    from pandas._libs import hashtable as _hashtable, lib as _lib, tslib as _tslib
  File "/home/scadmin/prophet/lib/python3.6/site-packages/pandas/_libs/__init__.py", 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 "/home/scadmin/prophet/lib/python3.6/site-packages/pandas/_libs/tslibs/__init__.py", line 30, in <module>
    from .conversion import OutOfBoundsTimedelta, localize_pydatetime
  File "pandas/_libs/tslibs/conversion.pyx", line 1, in init pandas._libs.tslibs.conversion
  File "pandas/_libs/tslibs/timezones.pyx", line 7, in init pandas._libs.tslibs.timezones
  File "/usr/local/lib/python3.6/dateutil/tz.py", line 78
    `self._name`,
    ^
SyntaxError: invalid syntax

I'm using python3.6 (3.6.8) and pip 21.0.1 from venv/lib/python3.6.site-packages/pip (python 3.6). I have also tried this outside the virtual env (same versions) and get the same traceback. I'm using pandas 1.1.15 and dateutil 2.8.1.

I've tried doing below as suggested from Pandas import issues.

pip uninstall python-dateutil
pip install python-dateutil --upgrade

I had this problem not too long ago and was able to fix it, but I can't remember what the fix was or seem to find the fix that worked last time.

Any help you can offer is much appreciated.

brehma
  • 206
  • 1
  • 11
  • 1
    Similar thing happened to me, once. I had to manually go delete the package (in your case dateutil) from it's directory (in your case "/usr/local/lib/python3.6/") and then pip install it again. I would recommend you take a copy of the folder before deleting it, though. This can also reveal to you if you are mistakenly using the wrong pip or python. – Ali_MM Apr 10 '21 at 01:24
  • 1
    This backtick syntax is specific to Python 2.x. You need to reinstall. When you use the `pip uninstall` and `pip uninstall` commands, make sure that you are using the `pip` that is associated with this specific Python installation. Since you are using a venv, this should be as simple as making sure the venv is active; but you can make sure by using `python -m pip` instead of `pip` (as long as `python` pulls up the right one, anyway). – Karl Knechtel Apr 10 '21 at 01:43
  • @KarlKnechtel I have read many articles on pointing to the correct version, but I've done everything I've read/know to do. When I do `which python` in the venv it points to `~/venv/bin/python` and `python -V` gives `Python 3.6.8`, but I still get the same error with that python 2.x syntax. I also did what you and Ali_MM suggested. `python -m pip install python-dateutil` gives `Requirement already satisfied: python-dateutil in ./lib/python3.6/site-packages (2.8.1) Requirement already satisfied: six>=1.5 in ./lib/python3.6/site-packages (from python-dateutil) (1.15.0)` Any other ideas? – brehma Apr 14 '21 at 17:53
  • Did you try creating a new venv and installing to it? – Karl Knechtel Apr 14 '21 at 19:57
  • Yes, deleted it and started fresh twice – brehma Apr 14 '21 at 20:00

0 Answers0