You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We'd like import_optional_dependency to correctly handle submodule imports AND to be able to import a specified minimum version of the dependency (for when a particular feature requires higher than global minimum version).
In [14]: import pandas as pd
...: from pandas.compat._optional import import_optional_dependency
...: import_optional_dependency("pyarrow.csv", min_version="3.0")
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-14-7cfc85634756> in <module>
1 import pandas as pd
2 from pandas.compat._optional import import_optional_dependency
----> 3 import_optional_dependency("pyarrow.csv", min_version="3.0")
~/repos/pandas/pandas/compat/_optional.py in import_optional_dependency(name, extra, raise_on_missing, on_version, min_version)
ImportError: Pandas requires version '3.0' or newer of 'pyarrow.csv' (version '2.0.0' currently installed).
In [16]: import_optional_dependency("pyarrow.csv", min_version="3.0", on_version="warn")
/Users/andrewwieteska/repos/pandas/pandas/compat/_optional.py:137: UserWarning: Pandas requires version '3.0' or newer of 'pyarrow.csv' (version '2.0.0' currently installed).
The text was updated successfully, but these errors were encountered:
xref #38370 (comment)
We'd like
import_optional_dependency
to correctly handle submodule imports AND to be able to import a specified minimum version of the dependency (for when a particular feature requires higher than global minimum version).cc @lithomas1
Expected Output
The text was updated successfully, but these errors were encountered: