After upgrading pandas version, I cannot import pandas anymore. The error traces to module ‘typing’: AttributeError: module 'typing' has no attribute '_ClassVar'
Unfortunately this workaround does not work in swan-k8s. It returns this error:
Traceback (most recent call last):
File "/cvmfs/sft.cern.ch/lcg/views/LCG_99cuda/x86_64-centos7-gcc8-opt/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 3296, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-6-027d28fa2663>", line 3, in <module>
import pandas as pd
File "/eos/user/s/sandrean/.local/lib/python3.7/site-packages/pandas/__init__.py", line 51, in <module>
from pandas.core.api import (
File "/eos/user/s/sandrean/.local/lib/python3.7/site-packages/pandas/core/api.py", line 31, in <module>
from pandas.core.groupby import Grouper, NamedAgg
File "/eos/user/s/sandrean/.local/lib/python3.7/site-packages/pandas/core/groupby/__init__.py", line 1, in <module>
from pandas.core.groupby.generic import DataFrameGroupBy, NamedAgg, SeriesGroupBy
File "/eos/user/s/sandrean/.local/lib/python3.7/site-packages/pandas/core/groupby/generic.py", line 65, in <module>
from pandas.core.frame import DataFrame
File "/eos/user/s/sandrean/.local/lib/python3.7/site-packages/pandas/core/frame.py", line 119, in <module>
from pandas.core import algorithms, common as com, generic, nanops, ops
File "/eos/user/s/sandrean/.local/lib/python3.7/site-packages/pandas/core/generic.py", line 112, in <module>
from pandas.io.formats import format as fmt
File "/eos/user/s/sandrean/.local/lib/python3.7/site-packages/pandas/io/formats/format.py", line 77, in <module>
from pandas.io.common import stringify_path
File "/eos/user/s/sandrean/.local/lib/python3.7/site-packages/pandas/io/common.py", line 6, in <module>
import dataclasses
File "/cvmfs/sft.cern.ch/lcg/views/LCG_99/x86_64-centos7-gcc8-opt/lib/python3.8/dataclasses.py", line 996
def dataclass(cls=None, /, *, init=True, repr=True, eq=True, order=False,
^
SyntaxError: invalid syntax
I notice k8s uses python 3.7. Is there any solution for this particular case?
We just removed the non standard lib dataclasses.py from all the LCG_99 and LCG_99cuda views on cvmfs, it will probably take a couple hours to propagate.