Suddenly my python file won’t run anymore due to an ImportError. I already tried updating/reinstalling pandas via conda but this didn’t change anything.
JavaScript
x
24
24
1
File "/p/tmp/user/env/lib/python3.7/site-packages/pandas/__init__.py", line 29, in <module>
2
from pandas._libs import hashtable as _hashtable, lib as _lib, tslib as _tslib
3
File "/p/tmp/user/env/lib/python3.7/site-packages/pandas/_libs/__init__.py", line 13, in <module>
4
from pandas._libs.interval import Interval
5
File "pandas/_libs/interval.pyx", line 1, in init pandas._libs.interval
6
File "pandas/_libs/hashtable.pyx", line 1, in init pandas._libs.hashtable
7
File "pandas/_libs/missing.pyx", line 1, in init pandas._libs.missing
8
File "/p/tmp/user/env/lib/python3.7/site-packages/pandas/_libs/tslibs/__init__.py", line 30, in <module>
9
from .conversion import OutOfBoundsTimedelta, localize_pydatetime
10
File "pandas/_libs/tslibs/conversion.pyx", line 1, in init pandas._libs.tslibs.conversion
11
File "pandas/_libs/tslibs/timezones.pyx", line 7, in init pandas._libs.tslibs.timezones
12
ImportError: cannot import name gettz
13
14
srun: error: cs-g14c06b11: task 0: Exited with exit code 1
15
srun: Terminating job step 19094047.0
16
The above exception was the direct cause of the following exception:
17
18
Traceback (most recent call last):
19
File "/p/tmp/user/file_name.py", line 3, in <module>
20
import pandas as pd
21
File "/p/tmp/user/env/lib/python3.7/site-packages/pandas/__init__.py", line 37, in <module>
22
) from e
23
ImportError: C extension: gettz not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext --force' to build the C extensions first.
24
What could I try to fix this?
Advertisement
Answer
As suggested by furas, installing the package dateutil
fixed the error.