-
-
Notifications
You must be signed in to change notification settings - Fork 25.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cython compilation error with Cython>=3 and scikit-learn<1.2 #26858
Comments
We don't typically support such old versions. My guess is that you have cython 3.0 installed now in your docker image and old versions of scikit-learn do not work with this new version of cython (it was released a few days ago). I'd check which version you have installed and if it is indeed 3.0.0, then manually specify that you want an older version of cython installed when you install your python packages. |
We don't support old versions. If you want to use them, you can install old python and old dependencies and it would install. |
I've pinned this issue in the hopes that it gets found more easily by people. Since cython 3.0 there are a lot of people arriving here reporting that they can't build old versions. |
I'm encountering the same problem using python 3.11 when trying to install scikit-learn==1.0.2 |
In my case I've tried with the Cython I had before (0.29.30) and still does not work. So it must have been something else that I haven't been able to find yet. Thanks |
@opennog we also had this. In our case it is because we are using poetry and each package is built it in it's own venv. So even though we have pinned the Cython version in the main venv, scikit-learn doesn't use that version of Cython when it's built. It's using Cython 3.0.0 I guess because this just specifies greater than 0.29.33 Edit: To give more of a solution - the reason it still didn't work is isolated builds and inaccurate build requirements. You should be able to get around it using --no-build-isolation or --no-use-pep517 with |
yes that indeed solved the issue. Thank you very much! |
I have this problem for scikit-learn==1.1.3 (required by other dependencies.) Using Python 3.8.13. |
-Fixed actigraphy bugs -Added and fixed requirement bug due to cython upgrade scikit-learn/scikit-learn#26858 , have made a temporary fix in docker file to install some packages earlier, must be fixed eventually
The current release (1.3.1) has regressed so the build says it requires Cython<3 again. This is a problem for distro packaging that only includes the latest version, such as on Arch Linux. |
@alerque we have significant performance regressions with Cython>=3, hence the constraint till those issues are fixed on our and Cython's side. |
@alerque: the regression with Cython 3 have been resolved and Cython 3 is now used by default since the merge of #27627. Moreover 1.4.1rc0 is built using Cython 3 thanks to conda-forge/scikit-learn-feedstock#245. |
Hi, I can't install pytorch-forecasting in Python 3.11 under Windows 11. In Python 3.10 it works fine.
This is the line that fails to compile in Python 3.11 |
@mabuimo Clearly that is a different issue than the one being discussed here. Please open a new issue. Appending your new issue to this old one that is closed both gets no triage/diagnosis for your issue and annoys all the people subscribed to the old ones for unrelated reasons. |
Workaround for this issue
➡️ The most likely reason you are reading this issue is that you are using a version of scikit-learn that does not support cython 3.0
The solution is to pin cython to
cython<3
in your environment and usepip install --no-build-isolation scikit-learn
to install scikit-learn.(edit by @betatim to make the solution more visible. Please don't add a comment to this issue if all you are saying is "I also have this problem".)
Note: at the time of writing (September 2023) scikit-learn>=1.2 compiles fine with Cython 3 (latest release is Cython 3.0.2) but this can change with Cython development.
Original issue description
When installing scikit-learn==0.23.2 in a docker I get now the following error. I was not getting it ~1month ago.
I can pip install newer scikit-learn versions (i.e., 1.3.0), however, given that there is no across version compatibility my models do not work.
Thus, I'd like to ask for support to see if you knew why scikit-learn==0.23.2 can not compile and, if possible, to overcome this limitation.
ERROR:
Versions
scikit-learn==0.23.2
python 3.9
I can provide other versions if needed.
The text was updated successfully, but these errors were encountered: