6

The pypy project is currently adding support for numpy. My impression is that sklearn library is mainly based on numpy. Would I be able to use most of this library or there are other requirements that are not supported yet?

Donbeo
  • 17,067
  • 37
  • 114
  • 188

3 Answers3

8

Officially, none of it. If you want to do a port, go ahead (and please report results on the mailing list), but PyPy is simply not supported because scikit-learn uses many, many parts of NumPy and SciPy as well as having a lot of C, C++ and Cython extension code.

Fred Foo
  • 355,277
  • 75
  • 744
  • 836
  • I know that officially it is not supported at all. I am asking more an advice. Do you think that this will partially work or that we really have to start from 0? – Donbeo Apr 11 '14 at 15:29
  • 1
    @Donbeo I'm betting you can't even import it, because many modules need SciPy. If you trim the imports you might get working pieces. [Cython/PyPy interop](http://docs.cython.org/src/userguide/pypy.html) is also a work in progress; some modules might work, others might not. – Fred Foo Apr 11 '14 at 15:47
  • @FredFoo can't `pypy3 -m pip install sklearn` build it? – Dee Jan 20 '22 at 09:58
  • the answer was 8 years ago? sklearn is supported now (2022) in pypy or no? – Dee Jan 20 '22 at 09:59
0

The official website of sklearn (https://scikit-learn.org/stable/faq.html), see here:

Do you support PyPy?

In case you didn’t know, PyPy is an alternative Python implementation with a built-in just-in-time compiler. Experimental support for PyPy3-v5.10+ has been added, which requires Numpy 1.14.0+, and scipy 1.1.0+.

Also see what pypy has to say (https://www.pypy.org/)

Compatibility: PyPy is highly compatible with existing python code. It supports cffi, cppyy, and can run popular python libraries like twisted, and django. It can also run NumPy, Scikit-learn and more via a c-extension compatibility layer.

Javed Was
  • 56
  • 1
  • 5
0

You have to install Miniforge-pypy( I don't know whether Mambaforge-pypy works). https://github.com/conda-forge/miniforge

Then, you need to copy dlls as following if you use Windows: https://github.com/conda-forge/miniforge/issues/385#issuecomment-1552285097

Create a virtual environment as following:

conda create -n <venv_name> scikit-learn

Now you can use scikit-learn( I don't know a reason but I can't install scikit-learn on a normal way).

Loran
  • 223
  • 2
  • 15