Skip to content

Commit 09d3496

Browse files
committed
ARROW-4260: [Python] NumPy buffer protocol failure
The following error only occurred when both numpy=1.16 and pickle5 was installed. It's a numpy issue numpy/numpy#12745, so skipping the test until it's resolved. ``` ====================================================== FAILURES ======================================================= __________________________________________ test_serialize_deserialize_pandas __________________________________________ ValueError: cannot include dtype 'M' in a buffer The above exception was the direct cause of the following exception: def test_serialize_deserialize_pandas(): # ARROW-1784, serialize and deserialize DataFrame by decomposing # BlockManager df = _fully_loaded_dataframe_example() > _check_serialize_components_roundtrip(df) pyarrow/tests/test_convert_pandas.py:2278: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ pyarrow/tests/test_convert_pandas.py:2268: in _check_serialize_components_roundtrip components = ctx.serialize(df).to_components() pyarrow/serialization.pxi:198: in pyarrow.lib.SerializationContext.serialize return serialize(obj, context=self) pyarrow/serialization.pxi:345: in pyarrow.lib.serialize check_status(SerializeObject(context, wrapped_value, &serialized.data)) pyarrow/serialization.pxi:153: in pyarrow.lib.SerializationContext._serialize_callback serialized_obj = {"data": self.custom_serializers[type_id](obj)} _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ x = MultiIndex(levels=[[2000-01-01 00:00:00, 2000-01-02 00:00:00, 2000-01-03 00:00:00, 2000-01-04 00:00:00, 2000-01-05 00:00:00], ['bar', 'foo']], labels=[[0, 0, 1, 1, 2, 2, 3, 3, 4, 4], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0]]) def _pickle_to_buffer(x): > pickled = builtin_pickle.dumps(x, protocol=builtin_pickle.HIGHEST_PROTOCOL) E SystemError: <built-in function __import__> returned a result with an error set ``` Author: Krisztián Szűcs <szucs.krisztian@gmail.com> Closes apache#3403 from kszucs/travis_numpy_version and squashes the following commits: e3162a8 <Krisztián Szűcs> pin to minor 77e9b64 <Krisztián Szűcs> reason 301226d <Krisztián Szűcs> skip serialize test 39a7161 <Krisztián Szűcs> appveyor ae1f16d <Krisztián Szűcs> pin numpy to 1.14
1 parent 87ac6fd commit 09d3496

4 files changed

Lines changed: 14 additions & 12 deletions

File tree

ci/appveyor-cpp-build.bat

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,12 @@ if "%JOB%" == "Build_Debug" (
9595
exit /B 0
9696
)
9797

98-
conda create -n arrow -q -y ^
98+
conda create -n arrow -q -y -c conda-forge ^
99+
--file=ci\conda_env_python.yml ^
99100
python=%PYTHON% ^
100-
six pytest setuptools numpy pandas cython hypothesis ^
101-
thrift-cpp=0.11.0 boost-cpp ^
102-
-c conda-forge
101+
numpy=1.14 ^
102+
thrift-cpp=0.11 ^
103+
boost-cpp
103104

104105
call activate arrow
105106

@@ -109,9 +110,9 @@ set BOOST_LIBRARYDIR=%CONDA_PREFIX%\Library\lib
109110

110111
if "%JOB%" == "Toolchain" (
111112
@rem Install pre-built "toolchain" packages for faster builds
112-
conda install -q -y --file=ci\conda_env_cpp.yml ^
113-
python=%PYTHON% ^
114-
-c conda-forge
113+
conda install -q -y -c conda-forge ^
114+
--file=ci\conda_env_cpp.yml ^
115+
python=%PYTHON%
115116

116117
set ARROW_BUILD_TOOLCHAIN=%CONDA_PREFIX%\Library
117118
)

ci/cpp-msvc-build-main.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ popd
7272

7373
pushd python
7474

75-
pip install pickle5
75+
pip install -r requirements.txt pickle5
7676

7777
set PYARROW_CXXFLAGS=%ARROW_CXXFLAGS%
7878
set PYARROW_CMAKE_GENERATOR=%GENERATOR%

ci/travis_script_python.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ conda create -y -q -p $CONDA_ENV_DIR \
5050
nomkl \
5151
cmake \
5252
pip \
53-
numpy=1.13.1 \
53+
numpy=1.14 \
5454
python=${PYTHON_VERSION} \
5555
${CONDA_JVM_DEPS}
5656

@@ -124,7 +124,7 @@ $ARROW_CPP_BUILD_DIR/$ARROW_BUILD_TYPE/arrow-python-test
124124
pushd $ARROW_PYTHON_DIR
125125

126126
# Other stuff pip install
127-
pip install -q -r requirements.txt
127+
pip install -r requirements.txt
128128

129129
if [ "$PYTHON_VERSION" == "3.6" ]; then
130130
pip install -q pickle5

python/pyarrow/tests/test_convert_pandas.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
from collections import OrderedDict
2525
from datetime import date, datetime, time, timedelta
26+
from distutils.version import LooseVersion
2627

2728
import hypothesis as h
2829
import hypothesis.extra.pytz as tzst
@@ -2224,8 +2225,6 @@ def test_safe_unsafe_casts(self):
22242225

22252226

22262227
def _fully_loaded_dataframe_example():
2227-
from distutils.version import LooseVersion
2228-
22292228
index = pd.MultiIndex.from_arrays([
22302229
pd.date_range('2000-01-01', periods=5).repeat(2),
22312230
np.tile(np.array(['foo', 'bar'], dtype=object), 5)
@@ -2271,6 +2270,8 @@ def _check_serialize_components_roundtrip(df):
22712270
tm.assert_frame_equal(df, deserialized)
22722271

22732272

2273+
@pytest.mark.skipif(LooseVersion(np.__version__) >= '0.16',
2274+
reason='Until numpy/numpy#12745 is resolved')
22742275
def test_serialize_deserialize_pandas():
22752276
# ARROW-1784, serialize and deserialize DataFrame by decomposing
22762277
# BlockManager

0 commit comments

Comments
 (0)