Skip to content

Undeclared build dependency on Cython (regression of #15298) #19068

Closed

Description

@jackjansen

I have the feeling issue #15298 has re-appeared with release scikit-learn 0.24.

As of a few days ago I see CI/CD builds failing for a project that has a deep indirect dependency on scikit-learn, with the ModuleNotFound error reported above. Sorry, I don't even know which package has the dependency on scikit-learn...

I can tell you the CI/CD machine runs Python 3.6 on Ubuntu 18.04.

Activity

  1. glemaitre commented on Dec 24, 2020

    @glemaitre
    Member

    Could you paste the traceback of the install?

  2. jackjansen commented on Dec 24, 2020

    @jackjansen
    Author
  3. jackjansen commented on Dec 24, 2020

    @jackjansen
    Author

    In the mean time I have found out that I use open3d which uses sklearn which uses scikit-learn. The last dependency is unversioned, so I'm now pre-installing "scikit-learn>=0.23,!=0.24.0".

    That workaround works for my problem at hand (installing 0.23.3), which I guess shows that my feeling that this problem was correct.

  4. glemaitre commented on Dec 24, 2020

    @glemaitre
    Member

    Collecting sklearn

    You should not install scikit-learn via pip install sklearn but pip install scikit-learn. This would need to be corrected in the open3d I assume.

    Downloading https://files.pythonhosted.org/packages/db/e2/9c0bde5f81394b627f623557690536b12017b84988a4a1f98ec826edab9e/scikit-learn-0.24.0.tar.gz

    It seems that the source is downloaded instead of a wheel. It explains why scikit-learn try to import Cython because the install would require to build scikit-learn from the source.

  5. glemaitre commented on Dec 24, 2020

    @glemaitre
    Member

    So the good news (at least for us) is that the Cython ModuleError is indeed properly raised.

  6. alfaro96 commented on Dec 29, 2020

    @alfaro96
    Member

    Closing as the original issue seems to be solved: isl-org/Open3D-ML#200.

  7. tibco-slolla commented on Jan 19, 2021

    @tibco-slolla

    This issue does not appear to be resolved in 0.24.1.

  8. glemaitre commented on Jan 19, 2021

    @glemaitre
    Member

    @tibco-slolla Could you be more explicit: basically how scikit-learn was intended to be installed and what is the full traceback such that we can know what is indeed happening.

  9. tibco-slolla commented on Jan 19, 2021

    @tibco-slolla

    @glemaitre, sure. I am trying to install scikit-learn 0.24.1 on Python 3.6.8 using: pip3 install scikit-learn==0.24.1 --user

    I encounter " ModuleNotFoundError: No module named 'Cython'" caused by " ModuleNotFoundError: Please install Cython with a version >= 0.28.5 in order to build a scikit-learn from source.".

    > Collecting scikit-learn==0.24.1
    >   Using cached https://files.pythonhosted.org/packages/f4/7b/d415b0c89babf23dcd8ee631015f043e2d76795edd9c7359d6e63257464b/scikit-learn-0.24.1.tar.gz
    > Requirement already satisfied: numpy>=1.13.3 in ./.local/lib/python3.6/site-packages (from scikit-learn==0.24.1)
    > Requirement already satisfied: scipy>=0.19.1 in ./.local/lib/python3.6/site-packages (from scikit-learn==0.24.1)
    > Requirement already satisfied: joblib>=0.11 in ./.local/lib/python3.6/site-packages (from scikit-learn==0.24.1)
    > Requirement already satisfied: threadpoolctl>=2.0.0 in ./.local/lib/python3.6/site-packages (from scikit-learn==0.24.1)
    > Installing collected packages: scikit-learn
    >   Running setup.py install for scikit-learn ... error
    >     Complete output from command /usr/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-butscc67/scikit-learn/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-sr0oc4ux-record/install-record.txt --single-version-externally-managed --compile --user --prefix=:
    >     Partial import of sklearn during the build process.
    >     Traceback (most recent call last):
    >       File "/tmp/pip-build-butscc67/scikit-learn/sklearn/_build_utils/__init__.py", line 27, in _check_cython_version
    >         import Cython
    >     ModuleNotFoundError: No module named 'Cython'
    > 
    >     The above exception was the direct cause of the following exception:
    > 
    >     Traceback (most recent call last):
    >       File "<string>", line 1, in <module>
    >       File "/tmp/pip-build-butscc67/scikit-learn/setup.py", line 306, in <module>
    >         setup_package()
    >       File "/tmp/pip-build-butscc67/scikit-learn/setup.py", line 302, in setup_package
    >         setup(**metadata)
    >       File "/home/jsmith/.local/lib/python3.6/site-packages/numpy/distutils/core.py", line 135, in setup
    >         config = configuration()
    >       File "/tmp/pip-build-butscc67/scikit-learn/setup.py", line 186, in configuration
    >         _check_cython_version()
    >       File "/tmp/pip-build-butscc67/scikit-learn/sklearn/_build_utils/__init__.py", line 30, in _check_cython_version
    >         raise ModuleNotFoundError(message) from e
    >     ModuleNotFoundError: Please install Cython with a version >= 0.28.5 in order to build a scikit-learn from source.
    
  10. alfaro96 commented on Jan 20, 2021

    @alfaro96
    Member

    pip is installing scikit-learn from source.

    Can you provide the output of the following snippet:

    import platform; print(platform.platform())
    import sys; print("Python", sys.version)
    
  11. glemaitre commented on Jan 20, 2021

    @glemaitre
    Member

    @alfaro96 was faster :). Indeed, we need to know about your platform to understand why no wheel was fetched for the install (a wheel will avoid recompiling scikit-learn and thus Cython is not required).

  12. tibco-slolla commented on Jan 20, 2021

    @tibco-slolla

    @glemaitre, @alfaro96: here you go.

    [jsmith@4738a66b3b21 /]$ python3
    Python 3.6.8 (default, Aug 24 2020, 17:57:11)
    [GCC 8.3.1 20191121 (Red Hat 8.3.1-5)] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import platform; print(platform.platform())
    Linux-4.19.128-microsoft-standard-x86_64-with-centos-8.3.2011
    >>> import sys; print("Python", sys.version)
    Python 3.6.8 (default, Aug 24 2020, 17:57:11)
    [GCC 8.3.1 20191121 (Red Hat 8.3.1-5)]
    >>>

  13. jackjansen commented on Jan 21, 2021

    @jackjansen
    Author

    The problem has also re-appeared for me (OP).

    As I see this happening in a CI/CD I can tell you that everything worked a week ago and does not work now.

    The culprit seems to be the release of 0.24.1: my carefully crafted requirements.txt has scikit-learn!=0.24.0,>=0.23, which used to resolve to 0.23.2 but now resolves to 0.24.1.

    Python 3.6 on Ubuntu 18.04.

  14. alfaro96 commented on Jan 25, 2021

    @alfaro96
    Member

    The issue may be resolved by #19235.

  15. glemaitre commented on Jan 25, 2021

    @glemaitre
    Member

    An additional note: using pip>=19.3 should allow fetching the manylinux2010 wheel. We are going to upload the manylinux1 wheels but you could check on your side which version of pip do you work with.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions