Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 917013 - sci-libs/scikit-learn-1.3.2 failed (compile phase): TypeError: '>' not supported between instances of 'str' and 'int'
Summary: sci-libs/scikit-learn-1.3.2 failed (compile phase): TypeError: '>' not suppor...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal major (vote)
Assignee: Gentoo Science Related Packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-11-07 20:44 UTC by Erik Quaeghebeur
Modified: 2023-11-10 18:26 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
output of emerge -pqv '=sci-libs/scikit-learn-1.3.2::gentoo' (emerge-pqv,127 bytes, text/plain)
2023-11-07 20:45 UTC, Erik Quaeghebeur
Details
output of emerge --info '=sci-libs/scikit-learn-1.3.2::gentoo' (emerge--info,7.31 KB, text/plain)
2023-11-07 20:45 UTC, Erik Quaeghebeur
Details
build log (scikit-learn-1.3.2:20231107-203011.log,155.98 KB, text/plain)
2023-11-07 20:49 UTC, Erik Quaeghebeur
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Erik Quaeghebeur 2023-11-07 20:44:16 UTC
When emerging sci-libs/scikit-learn-1.3.2, it fails during the compile phase with the following output:

[…]
building 'liblinear-skl' library                                                                                                                                                                                                            
INFO: C compiler: x86_64-pc-linux-gnu-gcc -Wsign-compare -DNDEBUG -march=native -O2 -pipe -DNDEBUG -fPIC                                                                                                                                    
                                                                                                                                                                                                                                            
creating /var/tmp/portage/sci-libs/scikit-learn-1.3.2/work/scikit-learn-1.3.2-python3_11/build/temp.linux-x86_64-cpython-311/sklearn/svm/src/liblinear                                                                                      
INFO: compile options: '-c'
  File "/usr/lib/python-exec/python3.11/gpep517", line 4, in <module>                                                                                                                                                              
    sys.exit(main())                                                                                                                                                                                                                        
             ^^^^^^                                                                                                                                                                                                                         
  File "/usr/lib/python3.11/site-packages/gpep517/__main__.py", line 425, in main                                                                                                                                                           
    return func(args)                                                                                                                                                                                                                       
           ^^^^^^^^^^                                                                                                                                                                                                                       
  File "/usr/lib/python3.11/site-packages/gpep517/__main__.py", line 215, in build_wheel                                                                                                                                                    
    print(build_wheel_impl(args, args.wheel_dir), file=out)                                                                                                                                                                                 
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                            
  File "/usr/lib/python3.11/site-packages/gpep517/__main__.py", line 207, in build_wheel_impl                                                                                                                                               
    wheel_name = backend.build_wheel(str(wheel_dir), args.config_json)                                                                                                                                                                      
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                      
  File "/usr/lib/python3.11/site-packages/setuptools/build_meta.py", line 434, in build_wheel                                                                                                                                               
    return self._build_with_temp_dir(                                                                                                                                                                                                       
           ^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                                       
  File "/usr/lib/python3.11/site-packages/setuptools/build_meta.py", line 419, in _build_with_temp_dir                                                                                                                                      
    self.run_setup()                                                                                                                                                                                                                        
  File "/usr/lib/python3.11/site-packages/setuptools/build_meta.py", line 507, in run_setup                                                                                                                                                 
    super(_BuildMetaLegacyBackend, self).run_setup(setup_script=setup_script)                                                                                                                                                               
  File "/usr/lib/python3.11/site-packages/setuptools/build_meta.py", line 341, in run_setup                                                                                                                                                 
    exec(code, locals())                                                                                                                                                                                                                    
  File "<string>", line 633, in <module>                                                                                                                                                                                                    
  File "<string>", line 629, in setup_package                                                                                                                                                                                               
  File "/usr/lib/python3.11/site-packages/setuptools/__init__.py", line 103, in setup                                                                                                                                                       
    return distutils.core.setup(**attrs)                                                                                                                                                                                                    
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                                    
  File "/usr/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 185, in setup                                                                                                                                                
    return run_commands(dist)                                                                                                                                                                                                               
           ^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
    dist.run_commands()
  File "/usr/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python3.11/site-packages/setuptools/dist.py", line 989, in run_command
    super().run_command(command)
  File "/usr/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
    cmd_obj.run()
  File "/usr/lib/python3.11/site-packages/wheel/bdist_wheel.py", line 364, in run
    self.run_command("build")
  File "/usr/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
    self.distribution.run_command(command)
  File "/usr/lib/python3.11/site-packages/setuptools/dist.py", line 989, in run_command
    super().run_command(command)
  File "/usr/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
    cmd_obj.run()
  File "/usr/lib/python3.11/site-packages/setuptools/_distutils/command/build.py", line 131, in run
    self.run_command(cmd_name)
  File "/usr/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
    self.distribution.run_command(command)
  File "/usr/lib/python3.11/site-packages/setuptools/dist.py", line 989, in run_command
    super().run_command(command)
  File "/usr/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
    cmd_obj.run()
  File "/usr/lib/python3.11/site-packages/setuptools/_distutils/command/build_clib.py", line 111, in run
    self.build_libraries(self.libraries)
  File "/usr/lib/python3.11/site-packages/setuptools/command/build_clib.py", line 85, in build_libraries
    self.compiler.compile(
  File "/usr/lib/python3.11/site-packages/numpy/distutils/ccompiler.py", line 91, in <lambda>
    m = lambda self, *args, **kw: func(self, *args, **kw)
                                  ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/numpy/distutils/ccompiler.py", line 360, in CCompiler_compile
    if len(build) > 1 and jobs > 1:
                          ^^^^^^^^
TypeError: '>' not supported between instances of 'str' and 'int'

Reproducible: Always
Comment 1 Erik Quaeghebeur 2023-11-07 20:45:11 UTC
Created attachment 874271 [details]
output of emerge -pqv '=sci-libs/scikit-learn-1.3.2::gentoo'
Comment 2 Erik Quaeghebeur 2023-11-07 20:45:47 UTC
Created attachment 874272 [details]
output of emerge --info '=sci-libs/scikit-learn-1.3.2::gentoo'
Comment 3 Erik Quaeghebeur 2023-11-07 20:49:21 UTC
Created attachment 874273 [details]
build log
Comment 4 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2023-11-08 06:59:13 UTC
What's the dev-python/numpy version?
Comment 5 Erik Quaeghebeur 2023-11-08 09:53:00 UTC
(In reply to Michał Górny from comment #4)
> What's the dev-python/numpy version?
1.26.1 with lapack flag and python target python3_11
Comment 6 Andrew Nowa Ammerlaan gentoo-dev 2023-11-08 09:55:36 UTC
>  *   dev-python/cython             : 3.0.2-r1

Could you retry with cython 3.0.4 or 3.0.5? It worked for me earlier with the same numpy version.
Comment 7 Erik Quaeghebeur 2023-11-08 10:16:55 UTC
(In reply to Andrew Ammerlaan from comment #6)
> >  *   dev-python/cython             : 3.0.2-r1
> 
> Could you retry with cython 3.0.4 or 3.0.5? It worked for me earlier with
> the same numpy version.
Neither 3.0.4 or 3.0.5 work for me. The build fails in the same way.
Comment 8 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2023-11-08 10:51:37 UTC
My only other suspicion right now is stefantalpalaru repo -- it seems to override a lot...
Comment 9 Erik Quaeghebeur 2023-11-08 10:58:33 UTC
(In reply to Michał Górny from comment #8)
> My only other suspicion right now is stefantalpalaru repo -- it seems to
> override a lot...
I only have dev-qt/qtwebkit installed from there.
Comment 10 Erik Quaeghebeur 2023-11-08 11:24:02 UTC
Looking at the code, the function get_num_build_jobs from numpy.distutils.misc_util is what generates the problematic jobs variable. When I run that code myself, it seems to do the right thing.

---
# python -c 'from numpy.distutils.misc_util import get_num_build_jobs; jobs = get_num_build_jobs(); print("***\n"); print(jobs, type(jobs))'
<string>:1: DeprecationWarning: 

  `numpy.distutils` is deprecated since NumPy 1.23.0, as a result
  of the deprecation of `distutils` itself. It will be removed for
  Python >= 3.12. For older Python versions it will remain present.
  It is recommended to use `setuptools < 60.0` for those Python versions.
  For more details, see:
    https://numpy.org/devdocs/reference/distutils_status_migration.html 


***

8 <class 'int'>
---
Comment 11 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2023-11-08 14:18:48 UTC
Note that we're setting DIST_EXTRA_CONFIG var, so perhaps it affects it.
Comment 12 Aleksander Zatserkovnyy 2023-11-09 01:49:20 UTC
For me (cython 3.0.2-r1, numpy-1.26.1, python-3.10.13,3.11.5), scikit-learn-1.3.2.ebuild works after commenting the strings: 
#DISTUTILS_EXT=1
#DISTUTILS_USE_PEP517=setuptools 
.
Comment 13 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2023-11-09 04:14:09 UTC
As you have probably guessed, I can't reproduce this.  The primary question then is: what is special about your system?  I suppose you're running an up-to-date system, with no p.masked packages left over?

My first ideas would be:
- PYTHONPATH including third-party modules
- orphan files in /usr/lib/python3.11/site-packages
- distutils/setuptools plugins (that we don't have installed), i.e. paste:

  $ find /usr/lib/python3.11/site-packages/ -name entry_points.txt | xargs grep '\[distutils\|\[setuptools'
Comment 14 Erik Quaeghebeur 2023-11-09 10:28:49 UTC
(In reply to Michał Górny from comment #13)
> […] I suppose you're running an up-to-date system, with no p.masked packages left over?
Indeed, and I try to minimize testing/unstable packages.

---
# eix --installed-masked
No matches found
---

> My first ideas would be:
> - PYTHONPATH including third-party modules
How can I check for this? In a shell, I get

---
# echo $PYTHONPATH

---

But I guess this variable may be set differently during package installation.

> - orphan files in /usr/lib/python3.11/site-packages
How can I check for this?

> - distutils/setuptools plugins (that we don't have installed), i.e. paste:
> 
>   $ find /usr/lib/python3.11/site-packages/ -name entry_points.txt | xargs
> grep '\[distutils\|\[setuptools'
---
# find /usr/lib/python3.11/site-packages/ -name entry_points.txt | xargs grep '\[distutils\|\[setuptools'
/usr/lib/python3.11/site-packages/calver-2023.5.4.dist-info/entry_points.txt:[distutils.setup_keywords]
/usr/lib/python3.11/site-packages/pbr-5.11.1.dist-info/entry_points.txt:[distutils.setup_keywords]
/usr/lib/python3.11/site-packages/incremental-22.10.0.dist-info/entry_points.txt:[distutils.setup_keywords]
/usr/lib/python3.11/site-packages/isort-5.12.0.dist-info/entry_points.txt:[distutils.commands]
/usr/lib/python3.11/site-packages/wheel-0.41.2.dist-info/entry_points.txt:[distutils.commands]
/usr/lib/python3.11/site-packages/setuptools_rust-1.7.0.dist-info/entry_points.txt:[distutils.commands]
/usr/lib/python3.11/site-packages/setuptools_rust-1.7.0.dist-info/entry_points.txt:[distutils.setup_keywords]
/usr/lib/python3.11/site-packages/setuptools_rust-1.7.0.dist-info/entry_points.txt:[setuptools.finalize_distribution_options]
/usr/lib/python3.11/site-packages/setuptools-68.2.2.dist-info/entry_points.txt:[distutils.commands]
/usr/lib/python3.11/site-packages/setuptools-68.2.2.dist-info/entry_points.txt:[distutils.setup_keywords]
/usr/lib/python3.11/site-packages/setuptools-68.2.2.dist-info/entry_points.txt:[setuptools.finalize_distribution_options]
/usr/lib/python3.11/site-packages/setuptools_scm-8.0.4.dist-info/entry_points.txt:[distutils.setup_keywords]
/usr/lib/python3.11/site-packages/setuptools_scm-8.0.4.dist-info/entry_points.txt:[setuptools.file_finders]
/usr/lib/python3.11/site-packages/setuptools_scm-8.0.4.dist-info/entry_points.txt:[setuptools.finalize_distribution_options]
/usr/lib/python3.11/site-packages/setuptools_scm-8.0.4.dist-info/entry_points.txt:[setuptools_scm.files_command]
/usr/lib/python3.11/site-packages/setuptools_scm-8.0.4.dist-info/entry_points.txt:[setuptools_scm.files_command_fallback]
/usr/lib/python3.11/site-packages/setuptools_scm-8.0.4.dist-info/entry_points.txt:[setuptools_scm.local_scheme]
/usr/lib/python3.11/site-packages/setuptools_scm-8.0.4.dist-info/entry_points.txt:[setuptools_scm.parse_scm]
/usr/lib/python3.11/site-packages/setuptools_scm-8.0.4.dist-info/entry_points.txt:[setuptools_scm.parse_scm_fallback]
/usr/lib/python3.11/site-packages/setuptools_scm-8.0.4.dist-info/entry_points.txt:[setuptools_scm.version_scheme]
/usr/lib/python3.11/site-packages/cffi-1.16.0.dist-info/entry_points.txt:[distutils.setup_keywords]
/usr/lib/python3.11/site-packages/Babel-2.13.1.dist-info/entry_points.txt:[distutils.commands]
/usr/lib/python3.11/site-packages/Babel-2.13.1.dist-info/entry_points.txt:[distutils.setup_keywords]
---
Comment 15 Erik Quaeghebeur 2023-11-09 10:34:23 UTC
(In reply to Aleksander Zatserkovnyy from comment #12)
> For me (cython 3.0.2-r1, numpy-1.26.1, python-3.10.13,3.11.5),
> scikit-learn-1.3.2.ebuild works after commenting the strings: 
> #DISTUTILS_EXT=1
> #DISTUTILS_USE_PEP517=setuptools 
Do you otherwise get the same error as I reported?
Comment 16 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2023-11-09 17:07:55 UTC
(In reply to Erik Quaeghebeur from comment #14)
> (In reply to Michał Górny from comment #13)
> > […] I suppose you're running an up-to-date system, with no p.masked packages left over?
> Indeed, and I try to minimize testing/unstable packages.

Hmm, so it's a mixed stable/~arch system?  Perhaps we're missing lower bound (>= dep) on one of the dependencies.

> > - orphan files in /usr/lib/python3.11/site-packages
> How can I check for this?

$ find /usr/lib/python3.11/site-packages -type f -print0 | xargs -0 qfile -o

You need to install portage-utils for that.  You may get some '*-pytest-*.pyc' files, these are harmless.

> 
> > - distutils/setuptools plugins (that we don't have installed), i.e. paste:
> > 
> >   $ find /usr/lib/python3.11/site-packages/ -name entry_points.txt | xargs
> > grep '\[distutils\|\[setuptools'
> ---
> # find /usr/lib/python3.11/site-packages/ -name entry_points.txt | xargs
> grep '\[distutils\|\[setuptools'
> [...]

I have all of them in my test env, so probably none of these are the problem.
Comment 17 Erik Quaeghebeur 2023-11-09 20:46:12 UTC
(In reply to Michał Górny from comment #16)
> > > - orphan files in /usr/lib/python3.11/site-packages
> > How can I check for this?
> 
> $ find /usr/lib/python3.11/site-packages -type f -print0 | xargs -0 qfile -o
Returns nothing (no output).
Comment 18 Aleksander Zatserkovnyy 2023-11-10 00:44:17 UTC
(In reply to Erik Quaeghebeur from comment #15)
> (In reply to Aleksander Zatserkovnyy from comment #12)
> > For me (cython 3.0.2-r1, numpy-1.26.1, python-3.10.13,3.11.5),
> > scikit-learn-1.3.2.ebuild works after commenting the strings: 
> > #DISTUTILS_EXT=1
> > #DISTUTILS_USE_PEP517=setuptools 
> Do you otherwise get the same error as I reported?

Yes, I do. I have checked the workaround on two my hosts. The same error (TypeError: '>' ...) without the comments in the ebuild. And now I have:

 sci-libs/scikit-learn
      Latest version available: 1.3.2-r111
      Latest version installed: 1.3.2-r111
      Size of files: 7 472 KiB
      Homepage:      https://scikit-learn.org/stable/
      Description:   Machine learning library for Python
      License:       BSD
Comment 19 Larry the Git Cow gentoo-dev 2023-11-10 18:26:55 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=99c9650e12f1b7c7f0ede3840220c2e2b5ccfa3c

commit 99c9650e12f1b7c7f0ede3840220c2e2b5ccfa3c
Author:     Patrick McLean <chutzpah@gentoo.org>
AuthorDate: 2023-11-10 02:36:17 +0000
Commit:     Patrick McLean <chutzpah@gentoo.org>
CommitDate: 2023-11-10 18:26:02 +0000

    sci-libs/scikit-learn: Add dep on pythran-0.14.0 (bug #917013)
    
    Closes: https://bugs.gentoo.org/917013
    Signed-off-by: Patrick McLean <chutzpah@gentoo.org>

 .../{scikit-learn-1.3.2.ebuild => scikit-learn-1.3.2-r1.ebuild}          | 1 +
 1 file changed, 1 insertion(+)