1

I am working on a Python package for which I use CI through Travis. This package has pandas as a dependency and is tested in both Python3.6 and Python3.7. The unit tests performed by Travis run fine in Python3.7, but don't start at all in Python3.6, as the import of pandas raises a whole lot of errors like the following

__________________ ERROR collecting tests/test_procedures.py ___________________

../../../virtualenv/python3.6.10/lib/python3.6/site-packages/_pytest/python.py:511: in _importtestmodule
    mod = self.fspath.pyimport(ensuresyspath=importmode)

../../../virtualenv/python3.6.10/lib/python3.6/site-packages/py/_path/local.py:701: in pyimport
    __import__(modname)

<frozen importlib._bootstrap>:971: in _find_and_load
    ???

<frozen importlib._bootstrap>:955: in _find_and_load_unlocked
    ???

<frozen importlib._bootstrap>:665: in _load_unlocked
    ???

../../../virtualenv/python3.6.10/lib/python3.6/site-packages/_pytest/assertion/rewrite.py:152: in exec_module
    exec(co, module.__dict__)

tests/test_procedures.py:2: in <module>
    from high_dimensional_sampling import procedures as proc

high_dimensional_sampling/__init__.py:4: in <module>
    from .experiments import (PosteriorSamplingExperiment,  # noqa: F401

high_dimensional_sampling/experiments.py:11: in <module>
    from .functions import TestFunction, MLFunction

high_dimensional_sampling/functions.py:6: in <module>
    import pandas as pd

../../../virtualenv/python3.6.10/lib/python3.6/site-packages/pandas-1.2.0rc0-py3.6-linux-x86_64.egg/pandas/__init__.py:51: in <module>
    from pandas.core.api import (

../../../virtualenv/python3.6.10/lib/python3.6/site-packages/pandas-1.2.0rc0-py3.6-linux-x86_64.egg/pandas/core/api.py:6: in <module>
    from pandas.core.dtypes.dtypes import (

../../../virtualenv/python3.6.10/lib/python3.6/site-packages/pandas-1.2.0rc0-py3.6-linux-x86_64.egg/pandas/core/dtypes/dtypes.py:27: in <module>
    from pandas.core.dtypes.base import ExtensionDtype, register_extension_dtype

../../../virtualenv/python3.6.10/lib/python3.6/site-packages/pandas-1.2.0rc0-py3.6-linux-x86_64.egg/pandas/core/dtypes/base.py:12: in <module>
    from pandas.core.dtypes.generic import ABCDataFrame, ABCIndexClass, ABCSeries

E     File "/home/travis/virtualenv/python3.6.10/lib/python3.6/site-packages/pandas-1.2.0rc0-py3.6-linux-x86_64.egg/pandas/core/dtypes/generic.py", line 2
E       from __future__ import annotations
E                                        ^
E   SyntaxError: future feature annotations is not defined

It seems to me like the problem is related to the one discussed here: Can't import annotations from __future__. The solution proposed hinted at there is to alter the code such that the dependency on this __future__ module is removed. However, in my problem the error is in the pandas dependency (at least: I think it is?).

The version of pandas that is used is 1.2.0rc0 and the used Python version is 3.6.10.

Is my assessment right (i.e. that the problem is in pandas)? And if so, (how) can I work around this issue?

Bob
  • 11
  • 3

0 Answers0