Failing nightly tests with PyPy

Observed here:

https://dev.azure.com/scikit-learn/scikit-learn/_build/results?buildId=39570&view=logs&j=0b16f832-29d6-5b92-1c23-eb006f606a66&t=0cdfadab-878f-502c-9df1-54a896e98c4f

Here are the failures:

```
________________ [doctest] sklearn.externals._pilutil.bytescale ________________
[gw1] linux -- Python 3.7.12 /opt/conda/envs/testvenv/bin/python
096 
097     Returns
098     -------
099     img_array : uint8 ndarray
100         The byte-scaled array.
101 
102     Examples
103     --------
104     >>> import numpy as np
105     >>> from scipy.misc import bytescale
UNEXPECTED EXCEPTION: ImportError("cannot import name 'bytescale'")
Traceback (most recent call last):
  File "/opt/conda/envs/testvenv/lib-python/3/doctest.py", line 1339, in __run
    compileflags, 1), test.globs)
  File "<doctest sklearn.externals._pilutil.bytescale[1]>", line 1, in <module>
ImportError: cannot import name 'bytescale'
/io/sklearn/externals/_pilutil.py:105: UnexpectedException
__________________ [doctest] sklearn.externals._lobpcg.lobpcg __________________
[gw0] linux -- Python 3.7.12 /opt/conda/envs/testvenv/bin/python
243 
244     Solve ``A x = lambda x`` with constraints and preconditioning.
245 
246     >>> import numpy as np
247     >>> from scipy.sparse import spdiags, issparse
248     >>> from scipy.sparse.linalg import lobpcg, LinearOperator
249     >>> n = 100
250     >>> vals = np.arange(1, n + 1)
251     >>> A = spdiags(vals, 0, n, n)
252     >>> A.toarray()
Differences (unified diff with -expected +actual):
    @@ -1,7 +1,7 @@
    -array([[  1.,   0.,   0., ...,   0.,   0.,   0.],
    -       [  0.,   2.,   0., ...,   0.,   0.,   0.],
    -       [  0.,   0.,   3., ...,   0.,   0.,   0.],
    +array([[  1,   0,   0, ...,   0,   0,   0],
    +       [  0,   2,   0, ...,   0,   0,   0],
    +       [  0,   0,   3, ...,   0,   0,   0],
            ...,
    -       [  0.,   0.,   0., ...,  98.,   0.,   0.],
    -       [  0.,   0.,   0., ...,   0.,  99.,   0.],
    -       [  0.,   0.,   0., ...,   0.,   0., 100.]])
    +       [  0,   0,   0, ...,  98,   0,   0],
    +       [  0,   0,   0, ...,   0,  99,   0],
    +       [  0,   0,   0, ...,   0,   0, 100]])

/io/sklearn/externals/_lobpcg.py:252: DocTestFailure
_________________ [doctest] sklearn.externals._pilutil.imsave __________________
[gw0] linux -- Python 3.7.12 /opt/conda/envs/testvenv/bin/python
231         Image format. If omitted, the format to use is determined from the
232         file name extension. If a file object was used instead of a file name,
233         this parameter should always be used.
234 
235     Examples
236     --------
237     Construct an array of gradient intensity values and save to file:
238 
239     >>> import numpy as np
240     >>> from scipy.misc import imsave
UNEXPECTED EXCEPTION: ImportError("cannot import name 'imsave'")
Traceback (most recent call last):
  File "/opt/conda/envs/testvenv/lib-python/3/doctest.py", line 1339, in __run
    compileflags, 1), test.globs)


```

Two of those failures seems to be related to the interaction between scipy and pillow. See the details below for the versions of all libs:

<details>

```
System:
    python: 3.7.12 | packaged by conda-forge | (44db2626, Nov 15 2021, 12:53:46) [PyPy 7.3.7 with GCC 9.4.0]
executable: /opt/conda/envs/testvenv/bin/python
   machine: Linux-5.11.0-1028-azure-x86_64-with-debian-bullseye-sid

Python dependencies:
      sklearn: 1.1.dev0
          pip: 22.0.4
   setuptools: 60.9.3
        numpy: 1.21.5
        scipy: 1.7.3
       Cython: 0.29.28
       pandas: None
   matplotlib: 3.5.1
       joblib: 1.1.0
threadpoolctl: 3.1.0

Built with OpenMP: True

threadpoolctl info:
       user_api: blas
   internal_api: openblas
         prefix: libopenblas
       filepath: /opt/conda/envs/testvenv/lib/libopenblasp-r0.3.18.so
        version: 0.3.18
threading_layer: pthreads
   architecture: Haswell
    num_threads: 2

       user_api: openmp
   internal_api: openmp
         prefix: libomp
       filepath: /opt/conda/envs/testvenv/lib/libomp.so
        version: None
    num_threads: 2
# packages in environment at /opt/conda/envs/testvenv:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                      1_llvm    conda-forge
attrs                     21.4.0                   pypi_0    pypi
blas                      2.113                  openblas    conda-forge
blas-devel                3.9.0           13_linux64_openblas    conda-forge
brotli                    1.0.9                h7f98852_6    conda-forge
brotli-bin                1.0.9                h7f98852_6    conda-forge
bzip2                     1.0.8                h7f98852_4    conda-forge
ca-certificates           2021.10.8            ha878542_0    conda-forge
xz                        5.2.5                h516909a_1    conda-forge
zipp                      3.7.0                    pypi_0    pypi
zlib                      1.2.11            h36c2ea0_1013    conda-forge
zstd                      1.5.2                ha95c52a_0    conda-forge
```

</details>

The remaining failure (in the `sklearn.externals._lobpcg.lobpcg`) is apparently unrelated. I did not investigate myself but it does not seem very serious (using ints instead of floats or the opposite).

Note that PyPy is stable still only supporting the Python 3.7 standard lib and features. 3.8 support is still alpha.

COMMENT:
I opened https://github.com/scikit-learn/scikit-learn/pull/22870 to configure pypy to auto open an issue.

Labels: pypy