[MRG + 1] FIX work-around for read only dataframes
diff --git a/sklearn/utils/__init__.py b/sklearn/utils/__init__.py
index e6b38a3fe8fe8..b11feafacf405 100644
--- a/sklearn/utils/__init__.py
+++ b/sklearn/utils/__init__.py
@@ -12,7 +12,7 @@
                          assert_all_finite, warn_if_not_float,
                          check_random_state, column_or_1d, check_array,
                          check_consistent_length, check_X_y, indexable,
-                         check_symmetric)
+                         check_symmetric, DataConversionWarning)
 from .class_weight import compute_class_weight, compute_sample_weight
 from ..externals.joblib import cpu_count
 
@@ -149,7 +149,14 @@ def safe_indexing(X, indices):
     """
     if hasattr(X, "iloc"):
         # Pandas Dataframes and Series
-        return X.iloc[indices]
+        try:
+            return X.iloc[indices]
+        except ValueError:
+            # Cython typed memoryviews internally used in pandas do not support
+            # readonly buffers.
+            warnings.warn("Copying input dataframe for slicing.",
+                          DataConversionWarning)
+            return X.copy().iloc[indices]
     elif hasattr(X, "shape"):
         if hasattr(X, 'take') and (hasattr(indices, 'dtype') and
                                    indices.dtype.kind == 'i'):
diff --git a/sklearn/utils/tests/test_utils.py b/sklearn/utils/tests/test_utils.py
index 622335aacc805..19288fdd6e052 100644
--- a/sklearn/utils/tests/test_utils.py
+++ b/sklearn/utils/tests/test_utils.py
@@ -6,7 +6,7 @@
 
 from sklearn.utils.testing import (assert_equal, assert_raises, assert_true,
                                    assert_almost_equal, assert_array_equal,
-                                   SkipTest)
+                                   SkipTest, assert_warns)
 
 from sklearn.utils import check_random_state
 from sklearn.utils import deprecated
@@ -17,6 +17,7 @@
 from sklearn.utils import shuffle
 from sklearn.utils.extmath import pinvh
 from sklearn.utils.mocking import MockDataFrame
+from sklearn.utils.validation import DataConversionWarning
 
 
 def test_make_rng():
@@ -167,6 +168,14 @@ def test_safe_indexing_pandas():
     X_df_indexed = safe_indexing(X_df, inds)
     X_indexed = safe_indexing(X_df, inds)
     assert_array_equal(np.array(X_df_indexed), X_indexed)
+    # fun with read-only data in dataframes
+    # this happens in joblib memmapping
+    X.setflags(write=False)
+    X_df_readonly = pd.DataFrame(X)
+    X_df_ro_indexed = assert_warns(DataConversionWarning, safe_indexing,
+                                   X_df_readonly, inds)
+
+    assert_array_equal(np.array(X_df_ro_indexed), X_indexed)
 
 
 def test_safe_indexing_mock_pandas():

Fixes the second part of #4597.
Currently I'm raising a DataConversionWarning, which is not really right. It should be a `DataCopyWarning` which we don't have yet. Do we want to add that? In light of #4660? 
