gatagat / lap

Linear Assignment Problem solver (LAPJV/LAPMOD).
BSD 2-Clause "Simplified" License
211 stars 66 forks source link

Failed to install through pip install lap #45

Open vrij opened 1 year ago

vrij commented 1 year ago

Hi, thank you for providing this project! I was excited to see that it supports matrices with differing cardinalities. Though the installation sadly didn't work. Is there a way to resolve this?

My machine runs OS X Monterey 12.5 on an intel processor. Here are the logs:

~ % pip3 install lap Collecting lap Using cached lap-0.4.0.tar.gz (1.5 MB) Preparing metadata (setup.py) ... done Installing collected packages: lap DEPRECATION: lap is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559 Running setup.py install for lap ... error error: subprocess-exited-with-error

× Running setup.py install for lap did not run successfully. │ exit code: 1 ╰─> [124 lines of output] Partial import of lap during the build process. /private/var/folders/hf/hz17cj_d51v8140lh19jkwg80000gn/T/pip-install-2x4d_xr1/lap_13af42b2b7e649638abf7c3f7c571b5d/setup.py:223: 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

    from numpy.distutils.core import setup
  Generating cython files
  running install
  /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
    warnings.warn(
  running build
  running config_cc
  INFO: unifing config_cc, config, build_clib, build_ext, build commands --compiler options
  running config_fc
  INFO: unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
  running build_src
  INFO: build_src
  INFO: building extension "lap._lapjv" sources
  INFO: building data_files sources
  INFO: build_src: building npy-pkg config files
  running build_py
  creating build
  creating build/lib.macosx-10.9-universal2-cpython-311
  creating build/lib.macosx-10.9-universal2-cpython-311/lap
  copying lap/__init__.py -> build/lib.macosx-10.9-universal2-cpython-311/lap
  copying lap/lapmod.py -> build/lib.macosx-10.9-universal2-cpython-311/lap
  running build_ext
  INFO: customize UnixCCompiler
  INFO: customize UnixCCompiler using build_ext
  WARN: CCompilerOpt.__init__[1016] : unable to detect CPU architecture which lead to disable the optimization. check dist_info:<<
  ('macosx-10.9-universal2', 'clang', '-Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -ftrapping-math')
  >>
  INFO: CCompilerOpt.cc_test_flags[1077] : testing flags (-march=native)
  INFO: C compiler: clang -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -ftrapping-math

  creating /var/folders/hf/hz17cj_d51v8140lh19jkwg80000gn/T/tmpq94prdf8/Library
  creating /var/folders/hf/hz17cj_d51v8140lh19jkwg80000gn/T/tmpq94prdf8/Library/Frameworks
  creating /var/folders/hf/hz17cj_d51v8140lh19jkwg80000gn/T/tmpq94prdf8/Library/Frameworks/Python.framework
  creating /var/folders/hf/hz17cj_d51v8140lh19jkwg80000gn/T/tmpq94prdf8/Library/Frameworks/Python.framework/Versions
  creating /var/folders/hf/hz17cj_d51v8140lh19jkwg80000gn/T/tmpq94prdf8/Library/Frameworks/Python.framework/Versions/3.11
  creating /var/folders/hf/hz17cj_d51v8140lh19jkwg80000gn/T/tmpq94prdf8/Library/Frameworks/Python.framework/Versions/3.11/lib
  creating /var/folders/hf/hz17cj_d51v8140lh19jkwg80000gn/T/tmpq94prdf8/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11
  creating /var/folders/hf/hz17cj_d51v8140lh19jkwg80000gn/T/tmpq94prdf8/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages
  creating /var/folders/hf/hz17cj_d51v8140lh19jkwg80000gn/T/tmpq94prdf8/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/numpy
  creating /var/folders/hf/hz17cj_d51v8140lh19jkwg80000gn/T/tmpq94prdf8/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/numpy/distutils
  creating /var/folders/hf/hz17cj_d51v8140lh19jkwg80000gn/T/tmpq94prdf8/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/numpy/distutils/checks
  INFO: compile options: '-I/Library/Frameworks/Python.framework/Versions/3.11/include/python3.11 -c'
  extra options: '-march=native'
  WARN: CCompilerOpt.dist_test[630] : CCompilerOpt._dist_test_spawn[764] : Command (clang -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -ftrapping-math -I/Library/Frameworks/Python.framework/Versions/3.11/include/python3.11 -c /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/numpy/distutils/checks/test_flags.c -o /var/folders/hf/hz17cj_d51v8140lh19jkwg80000gn/T/tmpq94prdf8/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/numpy/distutils/checks/test_flags.o -MMD -MF /var/folders/hf/hz17cj_d51v8140lh19jkwg80000gn/T/tmpq94prdf8/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/numpy/distutils/checks/test_flags.o.d -march=native) failed with exit status 1 output ->
  clang: error: the clang compiler does not support '-march=native'

  WARN: CCompilerOpt.cc_test_flags[1081] : testing failed
  INFO: CCompilerOpt.cc_test_flags[1077] : testing flags (-O3)
  INFO: C compiler: clang -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -ftrapping-math

  INFO: compile options: '-I/Library/Frameworks/Python.framework/Versions/3.11/include/python3.11 -c'
  extra options: '-O3'
  INFO: CCompilerOpt.cc_test_flags[1077] : testing flags (-Werror=switch)
  INFO: C compiler: clang -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -ftrapping-math

  INFO: compile options: '-I/Library/Frameworks/Python.framework/Versions/3.11/include/python3.11 -c'
  extra options: '-Werror=switch'
  INFO: CCompilerOpt.cc_test_flags[1077] : testing flags (-Werror)
  INFO: C compiler: clang -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -ftrapping-math

  INFO: compile options: '-I/Library/Frameworks/Python.framework/Versions/3.11/include/python3.11 -c'
  extra options: '-Werror'
  WARN: CCompilerOpt.dist_test[630] : CCompilerOpt._dist_test_spawn[764] : Command (clang -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -ftrapping-math -I/Library/Frameworks/Python.framework/Versions/3.11/include/python3.11 -c /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/numpy/distutils/checks/test_flags.c -o /var/folders/hf/hz17cj_d51v8140lh19jkwg80000gn/T/tmpq94prdf8/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/numpy/distutils/checks/test_flags.o -MMD -MF /var/folders/hf/hz17cj_d51v8140lh19jkwg80000gn/T/tmpq94prdf8/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/numpy/distutils/checks/test_flags.o.d -Werror) failed with exit status 1 output ->
  error: overriding currently unsupported use of floating point exceptions on this target [-Werror,-Wunsupported-floating-point-opt]
  1 error generated.

  WARN: CCompilerOpt.cc_test_flags[1081] : testing failed
  INFO: CCompilerOpt.__init__[1786] : check requested baseline
  INFO: CCompilerOpt.__init__[1795] : check requested dispatch-able features
  INFO: CCompilerOpt.__init__[1811] : initialize targets groups
  INFO: CCompilerOpt.__init__[1813] : parse target group simd_test
  INFO: CCompilerOpt._parse_target_tokens[2024] : skip targets (VSX FMA4 NEON ASIMD VX AVX512F VSX2 XOP VXE2 VSX3 SSE42 (FMA3 AVX2) AVX512_SKX SSE2 VXE VSX4) not part of baseline or dispatch-able features
  INFO: CCompilerOpt.generate_dispatch_header[2357] : generate CPU dispatch header: (build/src.macosx-10.9-universal2-3.11/numpy/distutils/include/npy_cpu_dispatch_config.h)
  WARN: CCompilerOpt.generate_dispatch_header[2366] : dispatch header dir build/src.macosx-10.9-universal2-3.11/numpy/distutils/include does not exist, creating it
  INFO: customize UnixCCompiler
  WARN: #### ['clang', '-Wsign-compare', '-Wunreachable-code', '-fno-common', '-dynamic', '-DNDEBUG', '-g', '-fwrapv', '-O3', '-Wall', '-arch', 'arm64', '-arch', 'x86_64', '-g'] #######
  INFO: customize UnixCCompiler using build_ext
  INFO: building 'lap._lapjv' extension
  INFO: compiling C++ sources
  INFO: C compiler: clang++ -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -ftrapping-math

  creating build/temp.macosx-10.9-universal2-cpython-311/lap
  INFO: compile options: '-I/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/numpy/core/include -Ilap -I/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/numpy/core/include -Ibuild/src.macosx-10.9-universal2-3.11/numpy/distutils/include -I/Library/Frameworks/Python.framework/Versions/3.11/include/python3.11 -c'
  INFO: clang++: lap/_lapjv.cpp
  INFO: clang++: lap/lapmod.cpp
  INFO: clang++: lap/lapjv.cpp
  warning: overriding currently unsupported use of floating point exceptions on this target [-Wunsupported-floating-point-opt]
  warning: overriding currently unsupported use of floating point exceptions on this target [-Wunsupported-floating-point-opt]
  warning: overriding currently unsupported use of floating point exceptions on this target [-Wunsupported-floating-point-opt]
  1 warning generated.
  lap/_lapjv.cpp:181:12: fatal error: 'longintrepr.h' file not found
    #include "longintrepr.h"
             ^~~~~~~~~~~~~~~
  1 warning generated.
  1 warning and 1 error generated.
  error: Command "clang++ -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -ftrapping-math -I/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/numpy/core/include -Ilap -I/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/numpy/core/include -Ibuild/src.macosx-10.9-universal2-3.11/numpy/distutils/include -I/Library/Frameworks/Python.framework/Versions/3.11/include/python3.11 -c lap/_lapjv.cpp -o build/temp.macosx-10.9-universal2-cpython-311/lap/_lapjv.o -MMD -MF build/temp.macosx-10.9-universal2-cpython-311/lap/_lapjv.o.d" failed with exit status 1
  INFO:
  ########### EXT COMPILER OPTIMIZATION ###########
  INFO: Platform      :
    Architecture: unsupported
    Compiler    : clang

  CPU baseline  :
    Requested   : optimization disabled
    Enabled     : none
    Flags       : none
    Extra checks: none
    Requested   : optimization disabled

  CPU dispatch  :
    Enabled     : none
    Generated   : none
  INFO: CCompilerOpt.cache_flush[857] : write cache to path -> /private/var/folders/hf/hz17cj_d51v8140lh19jkwg80000gn/T/pip-install-2x4d_xr1/lap_13af42b2b7e649638abf7c3f7c571b5d/build/temp.macosx-10.9-universal2-cpython-311/ccompiler_opt_cache_ext.py
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. error: legacy-install-failure

× Encountered error while trying to install package. ╰─> lap

note: This is an issue with the package mentioned above, not pip.

Thanks in advance

Wellsonr commented 1 year ago

i got the same problem here, but i used conda instead and that solve my problem. Try this :: conda install pip :: its work for me. hope this will help ur probs

Zoe-Wan commented 1 year ago

i got the same problem here! And I can't find the solution, maybe I'll try conda later...

coder111111 commented 1 year ago

I can confirm I can reproduce the same problem on Debian/Sid with Python 3.11.2.

douo commented 1 year ago

I believe that updating to a newer version of Cython should resolve this issue. The problem is caused by a change in Python 3.11:

The non-limited API files cellobject.h, classobject.h, code.h, context.h, funcobject.h, genobject.h and longintrepr.h have been moved to the Include/cpython directory.

Newer versions of Cython add a version check to this include, as shown below:

Screenshot 2023-06-04 at 09 11 18 The upper version 0.4.0 was downloaded from PyPI. The lower is 0.4.0 was built using Cython 0.29.30.

I don’t think _lapjv.cpp should be included in the RELEASE package.

Adnedvid commented 1 year ago

Got sick of this issue so here you go! Just copy the two sub folders lap and lap dist into your site packages folder https://github.com/Adnedvid/Lap-pkg-for-YOLO.git

Yingrjimsch commented 1 year ago

I'm getting the same error did someone fix it? Updating Cython did not help in my case

Adnedvid commented 1 year ago

Did you try copying the package directly like I mentioned above? It has worked for me on 4 different windows machines the past 2 months.

Ounceleopard commented 11 months ago

Try: pip install lapx

ht-nah98 commented 10 months ago

Got sick of this issue so here you go! Just copy the two sub folders lap and lap dist into your site packages folder https://github.com/Adnedvid/Lap-pkg-for-YOLO.git

IT works brooooo. Thanks so much

andylee024 commented 7 months ago

Try: pip install lapx

I'm also using Mac Monterey on intel processor. THis works very well - thank you

bring-nirachornkul commented 6 months ago

Got sick of this issue so here you go! Just copy the two sub folders lap and lap dist into your site packages folder https://github.com/Adnedvid/Lap-pkg-for-YOLO.git

It's working. Thank you

mrfiskare commented 5 months ago

Got sick of this issue so here you go! Just copy the two sub folders lap and lap dist into your site packages folder https://github.com/Adnedvid/Lap-pkg-for-YOLO.git

This is what I've been doing for the past year. Keeping a copy of lap as a backup. As far as I'm aware this approach works on Mac, Linux and Windows.

Interestingly enough, pip is able to install lap on my MacBook with Python 3.9.13. Trying to install it on Windows with the same version of Python and pip results in failure.

MsAnitaAli commented 5 months ago

i got the same problem here, but i used conda instead and that solve my problem. Try this :: conda install pip :: its work for me. hope this will help ur probs

no it doesn't work

drascom commented 5 months ago

Got sick of this issue so here you go! Just copy the two sub folders lap and lap dist into your site packages folder https://github.com/Adnedvid/Lap-pkg-for-YOLO.git

job done. thank you

NoahBakayou commented 5 months ago

Try: pip install lapx

Thank you!!

david-gao1 commented 2 months ago

You can downgrade the Python from 3.11 to version 3.8.19. It works for me.

david-gao1 commented 2 months ago

Got sick of this issue so here you go! Just copy the two sub folders lap and lap dist into your site packages folder https://github.com/Adnedvid/Lap-pkg-for-YOLO.git

This is what I've been doing for the past year. Keeping a copy of lap as a backup. As far as I'm aware this approach works on Mac, Linux and Windows.

Interestingly enough, pip is able to install lap on my MacBook with Python 3.9.13. Trying to install it on Windows with the same version of Python and pip results in failure.

It works for me.

Franklinyung commented 4 weeks ago

Got sick of this issue so here you go! Just copy the two sub folders lap and lap dist into your site packages folder https://github.com/Adnedvid/Lap-pkg-for-YOLO.git

I works !!!! Thank you!!!