question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Undeclared build dependency on cython

See original GitHub issue

Description

pip install scikit-learn --no-binary :all: fails to install scikit because of missing cython build dependency. Once cython is installed manually the above command works and installs scikit-learn.

Steps/Code to Reproduce

pip install scikit-learn --no-binary :all: it’s also the case for python implementations that don’t have scikit-learn wheels available (PyPy3, Python3.8)

Expected Results

scikit-learn installs successfully

Actual Results

  Running setup.py install for scikit-learn ... error
    Complete output from command /home/user/pypy3-venv/bin/pypy3-c -u -c "import setuptools, tokenize;__file__='/var/tmp/pip-install-zf4xear5/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 /var/tmp/pip-record-k9u2qwff/install-record.txt --single-version-externally-managed --compile --install-headers /home/user/pypy3-venv/include/site/python3.6/scikit-learn:
    Partial import of sklearn during the build process.
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/var/tmp/pip-install-zf4xear5/scikit-learn/setup.py", line 290, in <module>
        setup_package()
      File "/var/tmp/pip-install-zf4xear5/scikit-learn/setup.py", line 286, in setup_package
        setup(**metadata)
      File "/home/user/pypy3-venv/site-packages/numpy/distutils/core.py", line 137, in setup
        config = configuration()
      File "/var/tmp/pip-install-zf4xear5/scikit-learn/setup.py", line 174, in configuration
        config.add_subpackage('sklearn')
      File "/home/user/pypy3-venv/site-packages/numpy/distutils/misc_util.py", line 1035, in add_subpackage
        caller_level = 2)
      File "/home/user/pypy3-venv/site-packages/numpy/distutils/misc_util.py", line 1004, in get_subpackage
        caller_level = caller_level + 1)
      File "/home/user/pypy3-venv/site-packages/numpy/distutils/misc_util.py", line 941, in _get_configuration_from_setup_py
        config = setup_module.configuration(*args)
      File "sklearn/setup.py", line 62, in configuration
        config.add_subpackage('utils')
      File "/home/user/pypy3-venv/site-packages/numpy/distutils/misc_util.py", line 1035, in add_subpackage
        caller_level = 2)
      File "/home/user/pypy3-venv/site-packages/numpy/distutils/misc_util.py", line 1004, in get_subpackage
        caller_level = caller_level + 1)
      File "/home/user/pypy3-venv/site-packages/numpy/distutils/misc_util.py", line 941, in _get_configuration_from_setup_py
        config = setup_module.configuration(*args)
      File "sklearn/utils/setup.py", line 8, in configuration
        from Cython import Tempita
    ModuleNotFoundError: No module named 'Cython'
    
    ----------------------------------------
Command "/home/user/pypy3-venv/bin/pypy3-c -u -c "import setuptools, tokenize;__file__='/var/tmp/pip-install-zf4xear5/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 /var/tmp/pip-record-k9u2qwff/install-record.txt --single-version-externally-managed --compile --install-headers /home/user/pypy3-venv/include/site/python3.6/scikit-learn" failed with error code 1 in /var/tmp/pip-install-zf4xear5/scikit-learn/

Versions

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:6
  • Comments:14 (12 by maintainers)

github_iconTop GitHub Comments

6reactions
jackjansencommented, Dec 24, 2020

I have the feeling this bug 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.

0reactions
jackjansencommented, Dec 30, 2020

@adrinjalali no need to reopen. The issue has been solved, see #19068.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Source Files and Compilation - Cython's Documentation
The cython command takes a .py or .pyx file and compiles it into a C/C++ file. ... Another option is to make Cython...
Read more >
Cython build resulting in undefined symbol - Stack Overflow
Also, gcc's linker is a one pass linker which means the order of library flags matters. You want to list the libraries in...
Read more >
undeclared name not built in errors - Google Groups
build, instead of letting users run their own version of Cython on it, ... dependencies I'm trying to get an Nvidia cuda emulator...
Read more >
1895315 – Cython generates Python 3.10 incompatible code ...
Bug 1895315 - Cython generates Python 3.10 incompatible code: undefined symbol: ... A build failure prevents us from testing all dependent packages ...
Read more >
Problem with Cython - Support - Brian simulator - Discourse
To make this quicker (if Cython compilation fails, a lot of tests will fail), you can run: ... **error:** **use of undeclared identifier...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found