Skip to content

Commit b4fe3fc

Browse files
committed
Revert "DEPS: Add warning if pyarrow is not installed (pandas-dev#56896)"
This reverts commit 5c2a407
1 parent b2b1aae commit b4fe3fc

File tree

4 files changed

+10
-58
lines changed

4 files changed

+10
-58
lines changed

.github/workflows/unit-tests.yml

+1-4
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,7 @@ jobs:
6464
- name: "Numpy Dev"
6565
env_file: actions-311-numpydev.yaml
6666
pattern: "not slow and not network and not single_cpu"
67-
# Currently restricted the warnings that error to Deprecation Warnings from numpy
68-
# done since pyarrow isn't compatible with numpydev always
69-
# TODO: work with pyarrow to revert this?
70-
test_args: "-W error::DeprecationWarning:numpy -W error::FutureWarning:numpy"
67+
test_args: "-W error::DeprecationWarning -W error::FutureWarning"
7168
- name: "Pyarrow Nightly"
7269
env_file: actions-311-pyarrownightly.yaml
7370
pattern: "not slow and not network and not single_cpu"

pandas/__init__.py

+9-27
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import annotations
22

3+
import os
34
import warnings
45

56
__docformat__ = "restructuredtext"
@@ -190,36 +191,17 @@
190191
__git_version__ = v.get("full-revisionid")
191192
del get_versions, v
192193

193-
# DeprecationWarning for missing pyarrow
194-
from pandas.compat.pyarrow import pa_version_under10p1, pa_not_found
195-
196-
if pa_version_under10p1:
197-
# pyarrow is either too old or nonexistent, warn
198-
from pandas.compat._optional import VERSIONS
199-
200-
if pa_not_found:
201-
pa_msg = "was not found to be installed on your system."
202-
else:
203-
pa_msg = (
204-
f"was too old on your system - pyarrow {VERSIONS['pyarrow']} "
205-
"is the current minimum supported version as of this release."
206-
)
207-
194+
# GH#55043 - deprecation of the data_manager option
195+
if "PANDAS_DATA_MANAGER" in os.environ:
208196
warnings.warn(
209-
f"""
210-
Pyarrow will become a required dependency of pandas in the next major release of pandas (pandas 3.0),
211-
(to allow more performant data types, such as the Arrow string type, and better interoperability with other libraries)
212-
but {pa_msg}
213-
If this would cause problems for you,
214-
please provide us feedback at https://github.com/pandas-dev/pandas/issues/54466
215-
""", # noqa: E501
216-
DeprecationWarning,
197+
"The env variable PANDAS_DATA_MANAGER is set. The data_manager option is "
198+
"deprecated and will be removed in a future version. Only the BlockManager "
199+
"will be available. Unset this environment variable to silence this warning.",
200+
FutureWarning,
217201
stacklevel=2,
218202
)
219-
del VERSIONS, pa_msg
220-
221-
# Delete all unnecessary imported modules
222-
del pa_version_under10p1, pa_not_found, warnings
203+
# Don't allow users to use pandas.os or pandas.warnings
204+
del os, warnings
223205

224206
# module level doc-string
225207
__doc__ = """

pandas/compat/pyarrow.py

-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import pyarrow as pa
99

1010
_palv = Version(Version(pa.__version__).base_version)
11-
pa_not_found = False
1211
pa_version_under10p1 = _palv < Version("10.0.1")
1312
pa_version_under11p0 = _palv < Version("11.0.0")
1413
pa_version_under12p0 = _palv < Version("12.0.0")
@@ -17,7 +16,6 @@
1716
pa_version_under14p1 = _palv < Version("14.0.1")
1817
pa_version_under15p0 = _palv < Version("15.0.0")
1918
except ImportError:
20-
pa_not_found = True
2119
pa_version_under10p1 = True
2220
pa_version_under11p0 = True
2321
pa_version_under12p0 = True

pandas/tests/test_common.py

-25
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
import numpy as np
99
import pytest
1010

11-
import pandas.util._test_decorators as td
12-
1311
import pandas as pd
1412
from pandas import Series
1513
import pandas._testing as tm
@@ -255,26 +253,3 @@ def test_bz2_missing_import():
255253
code = textwrap.dedent(code)
256254
call = [sys.executable, "-c", code]
257255
subprocess.check_output(call)
258-
259-
260-
@td.skip_if_installed("pyarrow")
261-
@pytest.mark.parametrize("module", ["pandas", "pandas.arrays"])
262-
def test_pyarrow_missing_warn(module):
263-
# GH56896
264-
response = subprocess.run(
265-
[sys.executable, "-c", f"import {module}"],
266-
capture_output=True,
267-
check=True,
268-
)
269-
msg = """
270-
Pyarrow will become a required dependency of pandas in the next major release of pandas (pandas 3.0),
271-
(to allow more performant data types, such as the Arrow string type, and better interoperability with other libraries)
272-
but was not found to be installed on your system.
273-
If this would cause problems for you,
274-
please provide us feedback at https://github.com/pandas-dev/pandas/issues/54466
275-
""" # noqa: E501
276-
stderr_msg = response.stderr.decode("utf-8")
277-
# Split by \n to avoid \r\n vs \n differences on Windows/Unix
278-
# https://stackoverflow.com/questions/11989501/replacing-r-n-with-n
279-
stderr_msg = "\n".join(stderr_msg.splitlines())
280-
assert msg in stderr_msg

0 commit comments

Comments
 (0)