ultralytics / ultralytics

NEW - YOLOv8 πŸš€ in PyTorch > ONNX > OpenVINO > CoreML > TFLite
https://docs.ultralytics.com
GNU Affero General Public License v3.0
24.46k stars 4.86k forks source link

requirements: YOLOv8 requirement "lap>=0.4" not found, attempting AutoUpdate... requirements: Command 'pip install "lap>=0.4" ' returned non-zero exit status 1. #1775

Closed weertman closed 5 months ago

weertman commented 1 year ago

Search before asking

YOLOv8 Component

Detection, Integrations

Bug

runcell(5, 'C:/Users/wlwee/Documents/LarvalTimelapse/src/untitled0.py')
requirements: YOLOv8 requirement "lap>=0.4" not found, attempting AutoUpdate...
requirements:  Command 'pip install "lap>=0.4"  ' returned non-zero exit status 1.
Traceback (most recent call last):

  File ~\anaconda3\envs\yolov8\lib\site-packages\ultralytics\tracker\utils\matching.py:10
    import lap  # for linear_assignment

ModuleNotFoundError: No module named 'lap'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

  File ~\anaconda3\envs\yolov8\lib\site-packages\spyder_kernels\py3compat.py:356 in compat_exec
    exec(code, globals, locals)

  File c:\users\wlwee\documents\larvaltimelapse\src\untitled0.py:26
    tracker = model.track(path_video, show=True)

  File ~\anaconda3\envs\yolov8\lib\site-packages\ultralytics\yolo\engine\model.py:234 in track
    from ultralytics.tracker import register_tracker

  File ~\anaconda3\envs\yolov8\lib\site-packages\ultralytics\tracker\__init__.py:3
    from .track import register_tracker

  File ~\anaconda3\envs\yolov8\lib\site-packages\ultralytics\tracker\track.py:8
    from .trackers import BOTSORT, BYTETracker

  File ~\anaconda3\envs\yolov8\lib\site-packages\ultralytics\tracker\trackers\__init__.py:3
    from .bot_sort import BOTSORT

  File ~\anaconda3\envs\yolov8\lib\site-packages\ultralytics\tracker\trackers\bot_sort.py:7
    from ..utils import matching

  File ~\anaconda3\envs\yolov8\lib\site-packages\ultralytics\tracker\utils\matching.py:16
    import lap

ModuleNotFoundError: No module named 'lap'

  error: subprocess-exited-with-error

  python setup.py bdist_wheel did not run successfully.
  exit code: 1

  [39 lines of output]
  Partial import of lap during the build process.
  C:\Users\wlwee\AppData\Local\Temp\pip-install-zntus4hi\lap_fdbfa66819de4310afb62d9a68380fb6\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 bdist_wheel
  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
  C:\Users\wlwee\anaconda3\envs\yolov8\lib\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_py
  creating build
  creating build\lib.win-amd64-cpython-39
  creating build\lib.win-amd64-cpython-39\lap
  copying lap\lapmod.py -> build\lib.win-amd64-cpython-39\lap
  copying lap\__init__.py -> build\lib.win-amd64-cpython-39\lap
  running build_ext
  INFO: No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
  INFO: customize MSVCCompiler
  INFO: customize MSVCCompiler using build_ext
  INFO: CCompilerOpt.cc_test_flags[1073] : testing flags (/O2)
  error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
  INFO: CCompilerOpt.cache_flush[857] : write cache to path -> C:\Users\wlwee\AppData\Local\Temp\pip-install-zntus4hi\lap_fdbfa66819de4310afb62d9a68380fb6\build\temp.win-amd64-cpython-39\Release\ccompiler_opt_cache_ext.py
  [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for lap
  error: subprocess-exited-with-error

  Running setup.py install for lap did not run successfully.
  exit code: 1

  [39 lines of output]
  Partial import of lap during the build process.
  C:\Users\wlwee\AppData\Local\Temp\pip-install-zntus4hi\lap_fdbfa66819de4310afb62d9a68380fb6\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
  C:\Users\wlwee\anaconda3\envs\yolov8\lib\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.win-amd64-cpython-39
  creating build\lib.win-amd64-cpython-39\lap
  copying lap\lapmod.py -> build\lib.win-amd64-cpython-39\lap
  copying lap\__init__.py -> build\lib.win-amd64-cpython-39\lap
  running build_ext
  INFO: No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
  INFO: customize MSVCCompiler
  INFO: customize MSVCCompiler using build_ext
  INFO: CCompilerOpt.cc_test_flags[1073] : testing flags (/O2)
  error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
  INFO: CCompilerOpt.cache_flush[857] : write cache to path -> C:\Users\wlwee\AppData\Local\Temp\pip-install-zntus4hi\lap_fdbfa66819de4310afb62d9a68380fb6\build\temp.win-amd64-cpython-39\Release\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.
hint: See above for output from the failure.

Environment

ultralytics.checks()
Ultralytics YOLOv8.0.59  Python-3.9.16 torch-2.0.0 CUDA:0 (NVIDIA GeForce GTX 1070, 8192MiB)
Setup complete  (8 CPUs, 31.9 GB RAM, 1234.8/1861.0 GB disk)
Python version: 3.9.16
Operating system: Windows
Operating system release: 10
Processor architecture: AMD64
(yolov8) C:\WINDOWS\system32>pip list
Package                       Version
----------------------------- --------------------
alabaster                     0.7.13
arrow                         1.2.3
astroid                       2.15.1
asttokens                     2.2.1
atomicwrites                  1.4.1
attrs                         22.2.0
autopep8                      1.6.0
Babel                         2.12.1
backcall                      0.2.0
bcrypt                        4.0.1
beautifulsoup4                4.12.0
binaryornot                   0.4.4
black                         23.3.0
bleach                        6.0.0
brotlipy                      0.7.0
certifi                       2022.12.7
cffi                          1.15.1
chardet                       5.1.0
charset-normalizer            3.1.0
click                         8.1.3
cloudpickle                   2.2.1
colorama                      0.4.6
comm                          0.1.3
contourpy                     1.0.7
cookiecutter                  2.1.1
cryptography                  39.0.1
cycler                        0.11.0
debugpy                       1.6.6
decorator                     5.1.1
defusedxml                    0.7.1
diff-match-patch              20200713
dill                          0.3.6
docstring-to-markdown         0.12
docutils                      0.19
executing                     1.2.0
fastjsonschema                2.16.3
filelock                      3.10.7
flake8                        6.0.0
flit_core                     3.8.0
fonttools                     4.39.3
idna                          3.4
imagesize                     1.4.1
importlib-metadata            6.1.0
importlib-resources           5.12.0
inflection                    0.5.1
intervaltree                  3.1.0
ipykernel                     6.22.0
ipython                       8.12.0
ipython-genutils              0.2.0
isort                         5.12.0
jaraco.classes                3.2.3
jedi                          0.18.2
jellyfish                     0.11.2
Jinja2                        3.1.2
jinja2-time                   0.2.0
jsonschema                    4.17.3
jupyter_client                8.1.0
jupyter_core                  5.3.0
jupyterlab-pygments           0.2.2
keyring                       23.13.1
kiwisolver                    1.4.4
lazy-object-proxy             1.9.0
MarkupSafe                    2.1.2
matplotlib                    3.7.1
matplotlib-inline             0.1.6
mccabe                        0.7.0
mistune                       2.0.5
mkl-fft                       1.3.1
mkl-random                    1.2.2
mkl-service                   2.4.0
more-itertools                9.1.0
mpmath                        1.3.0
mypy-extensions               1.0.0
nbclient                      0.7.2
nbconvert                     7.2.10
nbformat                      5.8.0
nest-asyncio                  1.5.6
networkx                      3.0
numpy                         1.24.2
numpydoc                      1.5.0
opencv-python                 4.7.0.72
packaging                     23.0
pandas                        1.5.3
pandocfilters                 1.5.0
paramiko                      3.1.0
parso                         0.8.3
pathspec                      0.11.1
pexpect                       4.8.0
pickleshare                   0.7.5
Pillow                        9.5.0
pip                           23.0.1
platformdirs                  3.2.0
pluggy                        1.0.0
prompt-toolkit                3.0.38
psutil                        5.9.4
ptyprocess                    0.7.0
pure-eval                     0.2.2
pycodestyle                   2.10.0
pycparser                     2.21
pydocstyle                    6.2.3
pyflakes                      3.0.1
Pygments                      2.14.0
pylint                        2.17.1
pylint-venv                   3.0.1
pyls-spyder                   0.4.0
PyNaCl                        1.5.0
pyOpenSSL                     23.0.0
pyparsing                     3.0.9
PyQt5                         5.15.9
PyQt5-Qt5                     5.15.2
PyQt5-sip                     12.11.1
PyQtWebEngine                 5.15.6
PyQtWebEngine-Qt5             5.15.2
pyrsistent                    0.19.3
PySocks                       1.7.1
python-dateutil               2.8.2
python-lsp-black              1.2.1
python-lsp-jsonrpc            1.0.0
python-lsp-server             1.7.1
python-slugify                8.0.1
pytoolconfig                  1.2.5
pytz                          2023.3
pywin32                       306
pywin32-ctypes                0.2.0
PyYAML                        6.0
pyzmq                         25.0.2
QDarkStyle                    3.0.3
qstylizer                     0.2.2
QtAwesome                     1.2.3
qtconsole                     5.4.2
QtPy                          2.3.1
requests                      2.28.2
rope                          1.7.0
Rtree                         1.0.1
scipy                         1.10.1
seaborn                       0.12.2
sentry-sdk                    1.18.0
setuptools                    65.6.3
six                           1.16.0
snowballstemmer               2.2.0
sortedcontainers              2.4.0
soupsieve                     2.4
Sphinx                        6.1.3
sphinxcontrib-applehelp       1.0.4
sphinxcontrib-devhelp         1.0.2
sphinxcontrib-htmlhelp        2.0.1
sphinxcontrib-jsmath          1.0.1
sphinxcontrib-qthelp          1.0.3
sphinxcontrib-serializinghtml 1.1.5
spyder                        5.4.2
spyder-kernels                2.4.3
stack-data                    0.6.2
sympy                         1.11.1
text-unidecode                1.3
textdistance                  4.5.0
thop                          0.1.1.post2209072238
three-merge                   0.1.1
tinycss2                      1.2.1
toml                          0.10.2
tomli                         2.0.1
tomlkit                       0.11.7
torch                         2.0.0
torchaudio                    2.0.1+cu117
torchvision                   0.15.1
tornado                       6.2
tqdm                          4.65.0
traitlets                     5.9.0
typing_extensions             4.5.0
ujson                         5.7.0
ultralytics                   8.0.59
urllib3                       1.26.15
watchdog                      3.0.0
wcwidth                       0.2.6
webencodings                  0.5.1
whatthepatch                  1.0.4
wheel                         0.38.4
win-inet-pton                 1.1.0
wincertstore                  0.2
wrapt                         1.15.0
yapf                          0.32.0
zipp                          3.15.0
torch.cuda.is_available()
Out[16]: True

torch.__version__
Out[17]: '2.0.0'

Minimal Reproducible Example

#%%
import ultralytics
from ultralytics import YOLO

#%%

ultralytics.checks()

#%%

path_model = r'projects/runs/segment/train/weights/best.pt'

#%%

model = YOLO(path_model)

#%%
path_video = r'Tracker_Example/14-02_25_23-01_12_50-ID1_ID2_ID3_ID4.mp4'
tracker = model.track(path_video, show=True)

Additional

I followed the install steps here https://docs.ultralytics.com/quickstart/ using pip to install the requirements. I used conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia to get torch to work.

This error occurred while trying to use model.tracker

Are you willing to submit a PR?

glenn-jocher commented 1 year ago

@weertman hi, thanks for the bug report! If lap is not automatically installing correctly, then you can install it like this:

pip install -U lap
weertman commented 1 year ago

Hey Glenn,

I found that I had to install visual studio tools C++ and then it installed.

-Willem

On Sun, Apr 2, 2023 at 17:21 Glenn Jocher @.***> wrote:

@weertman https://github.com/weertman hi, thanks for the bug report! If lap is not automatically installing correctly, then you can install it like this:

pip install -U lap

β€” Reply to this email directly, view it on GitHub https://github.com/ultralytics/ultralytics/issues/1775#issuecomment-1493483825, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUT4RD53SE5SPOBCA7WGTC3W7IJYFANCNFSM6AAAAAAWQS5JRU . You are receiving this because you were mentioned.Message ID: @.***>

kyoko9000 commented 1 year ago

I use pip install -U lap but it still error

markusschmitz53 commented 1 year ago

seeing a similar error but I'm not sure if it's related? pip install -U lap didn't help. C++ build tools are installed on my machine too. @weertman which version of the build tools did you install?

Windows 10, Python 3.9.4, pip 23.0.1, setuptools 67.6.1

pip install -r requirements.txt # install dependencies and pip install -U lap both fail with this error:

  error: subprocess-exited-with-error

  Γ— Running setup.py install for lap did not run successfully.
  β”‚ exit code: 1
  ╰─> [138 lines of output]
      Partial import of lap during the build process.
      Generating cython files
      running install
      c:\python39\lib\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.win-amd64-cpython-39
      creating build\lib.win-amd64-cpython-39\lap
      copying lap\lapmod.py -> build\lib.win-amd64-cpython-39\lap
      copying lap\__init__.py -> build\lib.win-amd64-cpython-39\lap
      running build_ext
      INFO: No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
      INFO: customize MSVCCompiler
      INFO: customize MSVCCompiler using build_ext
      INFO: CCompilerOpt.cc_test_flags[1021] : testing flags (/O2)
      creating C:\Users\xxx\AppData\Local\Temp\tmp8m9t7wuc\Python39
      creating C:\Users\xxx\AppData\Local\Temp\tmp8m9t7wuc\Python39\Lib
      creating C:\Users\xxx\AppData\Local\Temp\tmp8m9t7wuc\Python39\Lib\site-packages
      creating C:\Users\xxx\AppData\Local\Temp\tmp8m9t7wuc\Python39\Lib\site-packages\numpy
      creating C:\Users\xxx\AppData\Local\Temp\tmp8m9t7wuc\Python39\Lib\site-packages\numpy\distutils
      creating C:\Users\xxx\AppData\Local\Temp\tmp8m9t7wuc\Python39\Lib\site-packages\numpy\distutils\checks
      INFO: CCompilerOpt.cc_test_flags[1021] : testing flags (/WX)
      WARN: CCompilerOpt.__init__[1167] : feature 'AVX512_KNL' is disabled, MSVC compiler doesn't support it
      WARN: CCompilerOpt.__init__[1167] : feature 'AVX512_KNM' is disabled, MSVC compiler doesn't support it
      INFO: CCompilerOpt.__init__[1709] : check requested baseline
      INFO: CCompilerOpt.feature_test[1474] : testing feature 'SSE' with flags ()
      INFO: CCompilerOpt.feature_test[1474] : testing feature 'SSE2' with flags ()
      INFO: CCompilerOpt.feature_test[1474] : testing feature 'SSE3' with flags ()
      INFO: CCompilerOpt.__init__[1718] : check requested dispatch-able features
      INFO: CCompilerOpt.feature_test[1474] : testing feature 'SSE42' with flags ()
      INFO: CCompilerOpt.cc_test_flags[1021] : testing flags (/arch:AVX)
      INFO: CCompilerOpt.cc_test_flags[1021] : testing flags (/arch:AVX2)
      INFO: CCompilerOpt.feature_test[1474] : testing feature 'AVX2' with flags (/arch:AVX2)
      INFO: CCompilerOpt.cc_test_flags[1021] : testing flags (/arch:AVX512)
      INFO: CCompilerOpt.feature_test[1474] : testing feature 'AVX512_SKX' with flags (/arch:AVX512)
      INFO: CCompilerOpt.feature_test[1474] : testing feature 'SSSE3' with flags ()
      INFO: CCompilerOpt.feature_test[1474] : testing feature 'AVX' with flags (/arch:AVX)
      INFO: CCompilerOpt.feature_test[1474] : testing feature 'POPCNT' with flags ()
      INFO: CCompilerOpt.feature_test[1474] : testing feature 'SSE41' with flags ()
      INFO: CCompilerOpt.feature_test[1474] : testing feature 'F16C' with flags (/arch:AVX)
      INFO: CCompilerOpt.feature_test[1474] : testing feature 'AVX512F' with flags (/arch:AVX512)
      INFO: CCompilerOpt.feature_test[1474] : testing feature 'FMA3' with flags (/arch:AVX2)
      INFO: CCompilerOpt.feature_test[1474] : testing feature 'AVX512CD' with flags (/arch:AVX512)
      INFO: CCompilerOpt.feature_test[1474] : testing feature 'AVX512_CLX' with flags (/arch:AVX512)
      INFO: CCompilerOpt.feature_test[1474] : testing feature 'AVX512_CNL' with flags (/arch:AVX512)
      INFO: CCompilerOpt.feature_test[1474] : testing feature 'AVX512_ICL' with flags (/arch:AVX512)
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\xxx\AppData\Local\Temp\pip-install-o1wtikmt\lap_e8181bdbc8cc4fb2b69b52c119ed97e6\setup.py", line 236, in <module>
          setup_package()
        File "C:\Users\xxx\AppData\Local\Temp\pip-install-o1wtikmt\lap_e8181bdbc8cc4fb2b69b52c119ed97e6\setup.py", line 232, in setup_package
          setup(**metadata)
        File "c:\python39\lib\site-packages\numpy\distutils\core.py", line 169, in setup
          return old_setup(**new_attr)
        File "c:\python39\lib\site-packages\setuptools\__init__.py", line 108, in setup
          return distutils.core.setup(**attrs)
        File "c:\python39\lib\site-packages\setuptools\_distutils\core.py", line 185, in setup
          return run_commands(dist)
        File "c:\python39\lib\site-packages\setuptools\_distutils\core.py", line 201, in run_commands
          dist.run_commands()
        File "c:\python39\lib\site-packages\setuptools\_distutils\dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "c:\python39\lib\site-packages\setuptools\dist.py", line 1221, in run_command
          super().run_command(command)
        File "c:\python39\lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
          cmd_obj.run()
        File "c:\python39\lib\site-packages\numpy\distutils\command\install.py", line 60, in run
          r = self.setuptools_run()
        File "c:\python39\lib\site-packages\numpy\distutils\command\install.py", line 34, in setuptools_run
          return distutils_install.run(self)
        File "c:\python39\lib\site-packages\setuptools\_distutils\command\install.py", line 697, in run
          self.run_command('build')
        File "c:\python39\lib\site-packages\setuptools\_distutils\cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "c:\python39\lib\site-packages\setuptools\dist.py", line 1221, in run_command
          super().run_command(command)
        File "c:\python39\lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
          cmd_obj.run()
        File "c:\python39\lib\site-packages\numpy\distutils\command\build.py", line 61, in run
          old_build.run(self)
        File "c:\python39\lib\site-packages\setuptools\_distutils\command\build.py", line 131, in run
          self.run_command(cmd_name)
        File "c:\python39\lib\site-packages\setuptools\_distutils\cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "c:\python39\lib\site-packages\setuptools\dist.py", line 1221, in run_command
          super().run_command(command)
        File "c:\python39\lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
          cmd_obj.run()
        File "c:\python39\lib\site-packages\numpy\distutils\command\build_ext.py", line 163, in run
          self.compiler_opt = new_ccompiler_opt(
        File "c:\python39\lib\site-packages\numpy\distutils\ccompiler_opt.py", line 2577, in new_ccompiler_opt
          opt = CCompilerOpt(compiler, **kwargs)
        File "c:\python39\lib\site-packages\numpy\distutils\ccompiler_opt.py", line 2145, in __init__
          _Parse.__init__(self, cpu_baseline, cpu_dispatch)
        File "c:\python39\lib\site-packages\numpy\distutils\ccompiler_opt.py", line 1727, in __init__
          self.feature_names(cpu_dispatch)
        File "c:\python39\lib\site-packages\numpy\distutils\ccompiler_opt.py", line 1217, in feature_names
          if self.feature_is_supported(
        File "c:\python39\lib\site-packages\numpy\distutils\ccompiler_opt.py", line 861, in cache_wrap_me
          ccb = cb(self, *args, **kwargs)
        File "c:\python39\lib\site-packages\numpy\distutils\ccompiler_opt.py", line 1518, in feature_is_supported
          if not self.feature_test(name, force_flags, macros=macros):
        File "c:\python39\lib\site-packages\numpy\distutils\ccompiler_opt.py", line 861, in cache_wrap_me
          ccb = cb(self, *args, **kwargs)
        File "c:\python39\lib\site-packages\numpy\distutils\ccompiler_opt.py", line 1486, in feature_test
          test = self.dist_test(
        File "c:\python39\lib\site-packages\numpy\distutils\ccompiler_opt.py", line 585, in dist_test
          self.dist_compile(
        File "c:\python39\lib\site-packages\numpy\distutils\ccompiler_opt.py", line 567, in dist_compile
          return ccompiler.compile(sources, extra_postargs=flags, **kwargs)
        File "c:\python39\lib\site-packages\setuptools\_distutils\_msvccompiler.py", line 419, in compile
          self.spawn(args)
        File "c:\python39\lib\site-packages\numpy\distutils\ccompiler_opt.py", line 694, in _dist_test_spawn_paths
          self._dist_test_spawn(cmd)
        File "c:\python39\lib\site-packages\numpy\distutils\ccompiler_opt.py", line 709, in _dist_test_spawn
          o = subprocess.check_output(cmd, stderr=subprocess.STDOUT,
        File "c:\python39\lib\subprocess.py", line 424, in check_output
          return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
        File "c:\python39\lib\subprocess.py", line 507, in run
          stdout, stderr = process.communicate(input, timeout=timeout)
        File "c:\python39\lib\subprocess.py", line 1121, in communicate
          stdout = self.stdout.read()
        File "c:\python39\lib\encodings\cp1252.py", line 23, in decode
          return codecs.charmap_decode(input,self.errors,decoding_table)[0]
      UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 330: character maps to <undefined>
      INFO: CCompilerOpt.cache_flush[817] : write cache to path -> C:\Users\xxx\AppData\Local\Temp\pip-install-o1wtikmt\lap_e8181bdbc8cc4fb2b69b52c119ed97e6\build\temp.win-amd64-cpython-39\Release\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
Mukilan-Krishnakumar commented 1 year ago

I can attest that, I have the same problem. I am using a M1 Mac Pro. I tried installing lap but it encountered error: legacy-install-failure. I tried running it in a cloud environment, everything is working fine. Could it have anything to do with ARM machines?

glenn-jocher commented 1 year ago

@Mukilan-Krishnakumar it is possible that the issue with installing lap on your M1 Mac Pro could be related to the fact that it is an ARM machine. ARM architecture is different from the traditional x86 architecture found in most computers, and this can sometimes lead to compatibility issues with certain software.

It may be worth contacting the developers of lap to see if they have any specific advice for installing the software on ARM machines. Alternatively, you could try looking for alternative software that is specifically designed to work on ARM architecture.

It's also worth noting that running software in a cloud environment can sometimes be a more reliable solution for certain types of applications, as it removes some of the variables associated with running software locally.

glenn-jocher commented 1 year ago

@Mukilan-Krishnakumar checked locally an lap installs fine and tracking runs correctly in M2 Macbook

mkutu commented 1 year ago

@weertman and @Mukilan-Krishnakumar I'm on mac os M2. I had the same issue. I downgraded my python version to 3.8 and that worked. other info:

glenn-jocher commented 1 year ago

@mkutu thank you for sharing your experience with installing lap on mac os M2. It's good to know that downgrading to Python version 3.8 worked for you. This is likely because lap is not fully compatible with the latest version of Python.

For others who may be experiencing similar issues with installing lap, it's worth attempting to downgrade Python versions to see if that helps. Alternatively, utilizing a virtual environment like conda can help manage package environments and reduce conflicts with other packages on the system.

It's always a good practice to check the compatibility of a package with your system and any other dependencies before installation to avoid any potential issues. Communication with the package developers can also be helpful in identifying any installation or compatibility issue.

Rojjp commented 1 year ago

I'm also experiencing this issue. I have python v10 and downgraded to v8, but lap installation still fails with the same error message previously mentioned. Something seems to be wrong with the package. I also am doing this in Jupyter and also tried this within Anaconda Prompt. Both ways failed with the same error.

glenn-jocher commented 1 year ago

@Rojjp thank you for reaching out with your issue regarding lap installation on YOLOv8. Based on the details you've provided, it sounds like you've already tried downgrading your Python version and installing lap in Jupyter Notebook as well as Anaconda Prompt, but are still experiencing issues with installation.

One potential solution could be to try reinstalling lap using a fresh virtual environment. This can help ensure that there are no conflicts with other packages or dependencies that may be causing the installation issues.

If that still doesn't work, you could try reaching out to the lap package developers or doing some further research to see if there are any specific compatibility issues or bugs that have been identified with YOLOv8.

I hope this helps and that you're able to successfully install lap soon!

trasmar commented 1 year ago

This error appears when working with python virtual environment. This was fixed by creating a new virtual environment and installing lap before another package. I hope this helps.

glenn-jocher commented 1 year ago

@trasmar hello! Thank you for reaching out with this issue related to installing lap on YOLOv8 when using a Python virtual environment. This error can be resolved by creating a new virtual environment and installing lap before any other dependencies. This will help to avoid any conflicts with packages that may be causing the issue. I hope this information helps! If you have any further questions, please don't hesitate to ask.

jirivchi1 commented 1 year ago

I am working with two computers and lap is working with one which is installed visual C++. Even I have installed in the another it is not working. So, the issue is visual C++

glenn-jocher commented 1 year ago

@jirivchi1 hello! Thank you for sharing your experience with installing lap on two different computers. It's possible that the issue you're facing with lap not working on one of your computers could be related to the installation of Visual C++.

Some dependencies and packages require Microsoft Visual C++ Redistributable to be installed in order to work properly. You may want to check if Visual C++ Redistributable is installed on both of your computers, and if not, try installing it on the computer where lap is not working.

If the issue still persists after installing Visual C++, it may be worth checking for any other potential differences between the two computers, such as operating system versions or installed packages, that could be causing the issue.

I hope this helps, and please let us know if you have any further questions or concerns!

renaudfv commented 1 year ago

Hey, I'm getting the same issue on a Mac M1 using pipenv. When trying to install lap, it prompts me to install numpy, but still does not work after.

glenn-jocher commented 1 year ago

@renaudfv hello! Thank you for reaching out regarding your issue with installing lap on YOLOv8 using pipenv on a Mac M1. It's not uncommon for some packages to require additional dependencies such as NumPy in order to function properly.

One potential solution could be to try running pipenv install with the --system flag, which will try to link to the system site packages instead of creating a separate virtual environment. This may help resolve dependency conflicts that could be causing the issue.

Additionally, you may want to try installing lap and NumPy separately, rather than depending on the package to prompt the installation of NumPy. This can help ensure that all necessary packages and dependencies are installed in the correct order and without conflicts.

I hope this helps! If you have any further questions or concerns, please don't hesitate to ask.

jermwatt commented 12 months ago

Having the same problem here as well. lap's current issues are full of install problems with numerous setup permutations. The install issue does not appear constrained to mac M1 users.

lap does not appear to be actively maintained. Several contributers have propsed PR's (like this one) that have gone unmerged for +1 years.

I have tried a variety of permutations to get lap installed, including

with only one successful combination:

conda env with python 3.8 --> numpy install first --> pip install lap

I don't understand why this combination works.

Moreover, relying on lap doesn't seem sustainable.

Is there an alternative we can consider? Or build together?

glenn-jocher commented 12 months ago

@jermwatt hello, we're sorry to hear that you're also experiencing issues with installing lap on YOLOv8. We understand that several users have reported issues with installation, and that the lap package may not be actively maintained, as some PRs have gone unmerged for over a year.

It sounds like you've tried several permutations of installing lap, including downgrading Python, using different types of virtual environments, and installing NumPy first, with only one successful combination. It's not clear why this specific combination worked, but it's possible there may be issues with compatibility or conflicts with other packages on your system.

Regarding alternatives to lap, there are other packages available for linear assignment problems that may be worth exploring, such as scipy.optimize.linear_sum_assignment or munkres. These packages may offer similar functionality to lap and could potentially be more stable and actively maintained.

Alternatively, if users are interested in building a solution together, it could be worth exploring options to collaborate on developing a package that meets the specific needs of YOLOv8 users.

We hope this helps, and please let us know if you have any further questions or concerns.

weertman commented 11 months ago

So this error still exists months later and makes using the tracker in YOLOv8 really frustrating. Is there any progress here?

glenn-jocher commented 11 months ago

lap is a dependency required for tracking. If autoinstall is failing please try 'pip install lap'

weertman commented 11 months ago

Hey, GPT, use your context to look at the above chat and know you are wrong.

glenn-jocher commented 11 months ago

Hey buddy, Glenn here. If lap installation is failing I would raise this directly with the package authors as unfortunately that's out of our control.

You might also try some of our environments like Colab or Docker where everything installs correctly.

I personally tried lap alternatives with I think scipy and numpy but wasn't able to reproduce the package closely enough.

I have a PR open for this, or at least a branch. If you'd like to contribute that would help!

weertman commented 11 months ago

This is my solution, but it only works for python 3.9 which is a bummer since we loose the speed of 3.11

In anaconda prompt make new 3.9 env

conda create --name env_name python=3.9
conda activate env_name

Then install numpy THEN lap

pip install numpy
pip install lap

Then install ultralytics and torch

pip install ultralytics
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117

I use pycharm professional, so I open the IDE up and load the env and it works! The order dependency of numpy then lap is strange.

Cheers!

glenn-jocher commented 11 months ago

@weertman hello! We appreciate you sharing your solution for installing lap on YOLOv8 using Python 3.9. It seems like installing NumPy first before installing lap has worked for you, which is an interesting finding.

It's worth noting that there have been several reports of issues with lap installation, and that the package may not be actively maintained. As an alternative, other packages such as scipy.optimize.linear_sum_assignment or munkres could be explored.

Your steps for installing ultralytics and torch are correct, but it's important to note that torchaudio is not required for YOLOv8. Also, it's recommended to install torch and torchvision with specific CPU or GPU versions using the --use flag, rather than using the --index-url flag.

We hope this helps, and feel free to reach out if you have any further questions or concerns!

a1016669075 commented 11 months ago

I have resolved my problem with use this command : conda install -c conda-forge lap

hope your project could work

glenn-jocher commented 11 months ago

@a1016669075 hello there! I'm glad to hear that you were able to resolve your issue with installing lap for YOLOv8. The command you used, conda install -c conda-forge lap, installs the lap package from the Conda Forge channel. This is an alternative package management system that can be used alongside pip.

By using this command, you were able to successfully install lap and resolve the installation problem you were facing. I hope this solution helps others who may encounter a similar issue.

If you have any further questions or need additional assistance, please don't hesitate to reach out. Happy coding!

Camiloaab commented 11 months ago

@glenn-jocher, I tried: conda install -c conda-forge lap but got:

`PackagesNotFoundError: The following packages are not available from current channels:

Do you maybe have any suggestions? I am on a Mac m1 using python 3.11.3 Thanks!

glenn-jocher commented 11 months ago

@Camiloaab hey there! 🌟

I see that you encountered an error while trying to install lap using the command conda install -c conda-forge lap on your Mac M1 with Python 3.11.3. The error message PackagesNotFoundError: The following packages are not available from current channels: - lap indicates that lap is not found in the current Conda channels you have configured.

To resolve this, you can try two options:

  1. Try pip: You can attempt to install lap using pip instead of conda. Simply run pip install lap in your terminal or command prompt. Make sure you have the correct Python environment activated before running the command.

  2. Build from source: If pip installation doesn't work, you can try building and installing lap from source. You can find the source code on the lap GitHub repository. Clone the repository, navigate to the source code directory, and follow the installation instructions provided in the repository's documentation.

Remember, it's important to have the correct Python environment activated before attempting the installation. Let me know if you have any further questions or need additional assistance. Good luck! πŸ‘

Tai-Pham-2002 commented 11 months ago

i can't download lap library. help me

glenn-jocher commented 10 months ago

@Tai-Pham-2002 hello there! 😊

If you're having trouble downloading the lap library, I'd be happy to assist you. To help you better, could you please provide some additional information? Here's what I need:

  1. Are you encountering any specific error messages while trying to download the lap library?
  2. Which platform (e.g., Windows, macOS, Linux) are you using?
  3. Please share the steps or commands you've tried so far to download the library.

Once I have this information, I'll be able to provide you with specific recommendations to successfully download the lap library for YOLOv8. Looking forward to hearing from you!

Adnedvid commented 10 months ago

Here's the library for lap 0.4.0 just put it into your "site packages" in the "lib" folder. Got sick of trying to figure out what crazy loophole I did the previous 8 times. https://github.com/Adnedvid/Lap-pkg-for-YOLO.git

Edit: Thanks @glenn-jocher for the insight. I would certainly test it in a virtual environment. And it does remind me that this procedure still requires VS c++ build tools if you don't have it already.

glenn-jocher commented 10 months ago

@Adnedvid hello there!

Thanks for sharing your workaround to the lap library installation issue. Putting the library directly into the "site packages" in the "lib" folder can indeed bypass the typical installation problems. It really shows your resourcefulness!

Remember, this approach might need careful handling as manual modifications in site packages may potentially lead to unexpected problems or conflicts, especially during updates or additions of other packages that depend on lap. Also, this resolution might be system-specific, for other users they may have different setups where this might not work.

Always maintain backups and handle with caution. Thanks for being an active part of the community and sharing your experiences. Your contribution is appreciated!

Keep coding!

github-actions[bot] commented 9 months ago

πŸ‘‹ Hello there! We wanted to give you a friendly reminder that this issue has not had any recent activity and may be closed soon, but don't worry - you can always reopen it if needed. If you still have any questions or concerns, please feel free to let us know how we can help.

For additional resources and information, please see the links below:

Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed!

Thank you for your contributions to YOLO πŸš€ and Vision AI ⭐

MuhammadShifa commented 8 months ago

Hi @glenn-jocher , How to install it in docker image from requirements.txt file of yolov8 project?

glenn-jocher commented 8 months ago

@MuhammadShifa hi there! You would need to incorporate the installation of the libraries specified in the requirements.txt file into your Dockerfile.

Your Dockerfile might start from a base image with Python already installed, like so: FROM python:3.x.

Adding the following line to your Dockerfile will copy the requirements.txt from your local machine to the Docker image being built:

COPY requirements.txt ./

Afterwards, you would need to run pip to install all the dependent libraries specified in the requirements.txt. You can do this by adding the following line to your Dockerfile:

RUN pip install --no-cache-dir -r requirements.txt

This command tells Docker to run the pip install command every time it builds the image, installing the necessary libraries.

If the requirements.txt file is in a different path on your local machine, make sure you adjust the COPY directive accordingly.

Then, build the Docker image and proceed with your project. If you need any further help, feel free to ask!

michaelgruner commented 6 months ago

Installing lapx worked for me.

pip3 install lapx
glenn-jocher commented 6 months ago

@michaelgruner hello!

Thank you for sharing your solution to the installation issue with the lapx library in the context of YOLOv8. It's great to hear that running the pip3 install lapx command resolved the problem for you.

If other community members encounter similar installation challenges, your input may certainly help guide them towards a successful installation of the lapx library.

We appreciate your contribution to improving the YOLOv8 project experience for everyone. Keep up the fantastic work, and don't hesitate to reach out if you have further insights or questions as you continue working with YOLOv8.

Happy coding!

truongkhaihoa1995 commented 6 months ago

Hi @glenn-jocher, I try to install lap 4.0 in pycharm but it showed an error as below. Can you advise me what is happening here. I installed other packages too and it worked but not this lap 4.0. Much appreciated Thank you.

everything here has been installed except the lap 4.0 cvzone==1.5.6 ultralytics==8.0.26 hydra-core>=1.2.0 matplotlib>=3.2.2 numpy>=1.18.5 opencv-python==4.5.4.60 Pillow>=7.1.2 PyYAML>=5.3.1 requests>=2.23.0 scipy>=1.4.1 torch>=1.7.0 torchvision>=0.8.1 tqdm>=4.64.0 filterpy==1.4.5 scikit-image==0.19.3 lap==0.4.0

The error

Using cached lap-0.4.0.tar.gz (1.5 MB) Preparing metadata (setup.py): started Preparing metadata (setup.py): finished with status 'done' Building wheels for collected packages: lap Building wheel for lap (setup.py): started Building wheel for lap (setup.py): finished with status 'error' Running setup.py clean for lap Failed to build lap

error: subprocess-exited-with-error

Γ— python setup.py bdist_wheel did not run successfully. β”‚ exit code: 1 ╰─> [137 lines of output] /private/var/folders/xk/tdz2k3tn02nfp3fyw2g32db40000gn/T/pip-install-zeapmjps/lap_0d173806c3734d49ab29688ed85670a9/setup.py:4: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html from pkg_resources import parse_version Partial import of lap during the build process. /private/var/folders/xk/tdz2k3tn02nfp3fyw2g32db40000gn/T/pip-install-zeapmjps/lap_0d173806c3734d49ab29688ed85670a9/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 bdist_wheel
  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
  /Users/hoatruong/PycharmProjects/ObjectDetection/ObjectDetection/lib/python3.10/site-packages/setuptools/_distutils/cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
  !!

          ********************************************************************************
          Please avoid running ``setup.py`` directly.
          Instead, use pypa/build, pypa/installer or other
          standards-based tools.

          See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
          ********************************************************************************

  !!
    self.initialize_options()
  running build_py
  creating build
  creating build/lib.macosx-10.9-universal2-cpython-310
  creating build/lib.macosx-10.9-universal2-cpython-310/lap
  copying lap/__init__.py -> build/lib.macosx-10.9-universal2-cpython-310/lap
  copying lap/lapmod.py -> build/lib.macosx-10.9-universal2-cpython-310/lap
  running build_ext
  INFO: customize UnixCCompiler
  INFO: customize UnixCCompiler using build_ext
  WARN: CCompilerOpt.__init__[1025] : unable to detect CPU architecture which lead to disable the optimization. check dist_info:<<
  ('macosx-10.9-universal2', 'clang', '-Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g')
  >>
  INFO: CCompilerOpt.cc_test_flags[1086] : testing flags (-march=native)
  INFO: C compiler: clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g

  creating /var/folders/xk/tdz2k3tn02nfp3fyw2g32db40000gn/T/tmp9azgtksd/Users
  creating /var/folders/xk/tdz2k3tn02nfp3fyw2g32db40000gn/T/tmp9azgtksd/Users/hoatruong
  creating /var/folders/xk/tdz2k3tn02nfp3fyw2g32db40000gn/T/tmp9azgtksd/Users/hoatruong/PycharmProjects
  creating /var/folders/xk/tdz2k3tn02nfp3fyw2g32db40000gn/T/tmp9azgtksd/Users/hoatruong/PycharmProjects/ObjectDetection
  creating /var/folders/xk/tdz2k3tn02nfp3fyw2g32db40000gn/T/tmp9azgtksd/Users/hoatruong/PycharmProjects/ObjectDetection/ObjectDetection
  creating /var/folders/xk/tdz2k3tn02nfp3fyw2g32db40000gn/T/tmp9azgtksd/Users/hoatruong/PycharmProjects/ObjectDetection/ObjectDetection/lib
  creating /var/folders/xk/tdz2k3tn02nfp3fyw2g32db40000gn/T/tmp9azgtksd/Users/hoatruong/PycharmProjects/ObjectDetection/ObjectDetection/lib/python3.10
  creating /var/folders/xk/tdz2k3tn02nfp3fyw2g32db40000gn/T/tmp9azgtksd/Users/hoatruong/PycharmProjects/ObjectDetection/ObjectDetection/lib/python3.10/site-packages
  creating /var/folders/xk/tdz2k3tn02nfp3fyw2g32db40000gn/T/tmp9azgtksd/Users/hoatruong/PycharmProjects/ObjectDetection/ObjectDetection/lib/python3.10/site-packages/numpy
  creating /var/folders/xk/tdz2k3tn02nfp3fyw2g32db40000gn/T/tmp9azgtksd/Users/hoatruong/PycharmProjects/ObjectDetection/ObjectDetection/lib/python3.10/site-packages/numpy/distutils
  creating /var/folders/xk/tdz2k3tn02nfp3fyw2g32db40000gn/T/tmp9azgtksd/Users/hoatruong/PycharmProjects/ObjectDetection/ObjectDetection/lib/python3.10/site-packages/numpy/distutils/checks
  INFO: compile options: '-I/Users/hoatruong/PycharmProjects/ObjectDetection/ObjectDetection/include -I/Library/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c'
  extra options: '-march=native'
  WARN: CCompilerOpt.dist_test[637] : CCompilerOpt._dist_test_spawn[771] : Command (clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -I/Users/hoatruong/PycharmProjects/ObjectDetection/ObjectDetection/include -I/Library/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c /Users/hoatruong/PycharmProjects/ObjectDetection/ObjectDetection/lib/python3.10/site-packages/numpy/distutils/checks/test_flags.c -o /var/folders/xk/tdz2k3tn02nfp3fyw2g32db40000gn/T/tmp9azgtksd/Users/hoatruong/PycharmProjects/ObjectDetection/ObjectDetection/lib/python3.10/site-packages/numpy/distutils/checks/test_flags.o -MMD -MF /var/folders/xk/tdz2k3tn02nfp3fyw2g32db40000gn/T/tmp9azgtksd/Users/hoatruong/PycharmProjects/ObjectDetection/ObjectDetection/lib/python3.10/site-packages/numpy/distutils/checks/test_flags.o.d -march=native) failed with exit status 1 output ->
  error: unknown target CPU 'apple-m1'
  note: valid target CPU values are: nocona, core2, penryn, bonnell, atom, silvermont, slm, goldmont, goldmont-plus, tremont, nehalem, corei7, westmere, sandybridge, corei7-avx, ivybridge, core-avx-i, haswell, core-avx2, broadwell, skylake, skylake-avx512, skx, cascadelake, cooperlake, cannonlake, icelake-client, rocketlake, icelake-server, tigerlake, sapphirerapids, alderlake, knl, knm, k8, athlon64, athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10, barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, znver3, x86-64, x86-64-v2, x86-64-v3, x86-64-v4

  WARN: CCompilerOpt.cc_test_flags[1090] : testing failed
  INFO: CCompilerOpt.cc_test_flags[1086] : testing flags (-O3)
  INFO: C compiler: clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g

  INFO: compile options: '-I/Users/hoatruong/PycharmProjects/ObjectDetection/ObjectDetection/include -I/Library/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c'
  extra options: '-O3'
  INFO: CCompilerOpt.cc_test_flags[1086] : testing flags (-Werror=switch)
  INFO: C compiler: clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g

  INFO: compile options: '-I/Users/hoatruong/PycharmProjects/ObjectDetection/ObjectDetection/include -I/Library/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c'
  extra options: '-Werror=switch'
  INFO: CCompilerOpt.cc_test_flags[1086] : testing flags (-Werror)
  INFO: C compiler: clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g

  INFO: compile options: '-I/Users/hoatruong/PycharmProjects/ObjectDetection/ObjectDetection/include -I/Library/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c'
  extra options: '-Werror'
  INFO: CCompilerOpt.__init__[1795] : check requested baseline
  INFO: CCompilerOpt.__init__[1804] : check requested dispatch-able features
  INFO: CCompilerOpt.__init__[1820] : initialize targets groups
  INFO: CCompilerOpt.__init__[1822] : parse target group simd_test
  INFO: CCompilerOpt._parse_target_tokens[2033] : skip targets (FMA4 SSE42 AVX512_SKX VSX VSX2 XOP VSX3 ASIMD VXE VXE2 VX (FMA3 AVX2) SSE2 AVX512F NEON VSX4) not part of baseline or dispatch-able features
  INFO: CCompilerOpt.generate_dispatch_header[2366] : generate CPU dispatch header: (build/src.macosx-10.9-universal2-3.10/numpy/distutils/include/npy_cpu_dispatch_config.h)
  WARN: CCompilerOpt.generate_dispatch_header[2375] : dispatch header dir build/src.macosx-10.9-universal2-3.10/numpy/distutils/include does not exist, creating it
  INFO: customize UnixCCompiler
  WARN: #### ['clang', '-Wno-unused-result', '-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++ -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g

  creating build/temp.macosx-10.9-universal2-cpython-310/lap
  INFO: compile options: '-I/Users/hoatruong/PycharmProjects/ObjectDetection/ObjectDetection/lib/python3.10/site-packages/numpy/core/include -Ilap -I/Users/hoatruong/PycharmProjects/ObjectDetection/ObjectDetection/lib/python3.10/site-packages/numpy/core/include -Ibuild/src.macosx-10.9-universal2-3.10/numpy/distutils/include -I/Users/hoatruong/PycharmProjects/ObjectDetection/ObjectDetection/include -I/Library/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c'
  INFO: clang++: lap/_lapjv.cpp
  INFO: clang++: lap/lapjv.cpp
  INFO: clang++: lap/lapmod.cpp
  lap/lapjv.cpp:1:10: fatal error: cannot open file '/usr/local/include/stdio.h': Permission denied
  #include <stdio.h>
           ^
  lap/lapmod.cpp:1:10: fatal error: cannot open file '/usr/local/include/stdio.h': Permission denied
  #include <stdio.h>
           ^
  In file included from lap/_lapjv.cpp:4:
  /Library/Frameworks/Python.framework/Versions/3.10/include/python3.10/Python.h:11:10: fatal error: cannot open file '/usr/local/include/limits.h': Permission denied
  #include <limits.h>
           ^
  1 error generated.
  1 error generated.
  1 error generated.
  error: Command "clang++ -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -I/Users/hoatruong/PycharmProjects/ObjectDetection/ObjectDetection/lib/python3.10/site-packages/numpy/core/include -Ilap -I/Users/hoatruong/PycharmProjects/ObjectDetection/ObjectDetection/lib/python3.10/site-packages/numpy/core/include -Ibuild/src.macosx-10.9-universal2-3.10/numpy/distutils/include -I/Users/hoatruong/PycharmProjects/ObjectDetection/ObjectDetection/include -I/Library/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c lap/_lapjv.cpp -o build/temp.macosx-10.9-universal2-cpython-310/lap/_lapjv.o -MMD -MF build/temp.macosx-10.9-universal2-cpython-310/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[864] : write cache to path -> /private/var/folders/xk/tdz2k3tn02nfp3fyw2g32db40000gn/T/pip-install-zeapmjps/lap_0d173806c3734d49ab29688ed85670a9/build/temp.macosx-10.9-universal2-cpython-310/ccompiler_opt_cache_ext.py
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for lap ERROR: Could not build wheels for lap, which is required to install pyproject.toml-based projects

[notice] A new release of pip is available: 23.2.1 -> 23.3.1 [notice] To update, run: pip install --upgrade pip

glenn-jocher commented 6 months ago

Hello @truongkhaihoa1995!

I’m sorry to hear that you're having trouble installing the lap library. The error you're encountering during the wheel build process can be related to a few factors, such as a lack of necessary build tools, permissions issues, or even compatibility concerns with your platform or Python environment.

Here are some steps you may want to consider to troubleshoot the problem:

  1. Ensure Build Tools are Installed: If you're on macOS, you might need to install Xcode command line tools if you haven't already, which can be done using the command xcode-select --install.

  2. Check Python and Pip Versions: Ensure your environment is using compatible versions of Python and pip. Since you are on macOS, there might also be some dependency on system Python which can cause issues. It's often better to use a Python version installed through a package manager like brew.

  3. Try Installing Wheel Package: Sometimes, installing wheel before other packages can help avoid errors during wheel building. Run pip install wheel before running the lap installation.

  4. Try Installing with Conda: If you have Anaconda or Miniconda, you can try installing lap using conda which sometimes handles complex binary dependencies better than pip: conda install -c conda-forge lap.

  5. Check Permission and Environment Variables: Ensure you have proper write permissions to the location pip is trying to install the lap library, and that your Python environment variables are correctly set.

  6. Virtual Environment: Try using a virtual environment to isolate dependencies and avoid any system-wide issues:

    python -m venv venv
    source venv/bin/activate  # On macOS/Linux
    venv\Scripts\activate     # On Windows
    pip install --upgrade pip setuptools wheel
    pip install -r requirements.txt
  7. Updates and Upgrades: Make sure that all your related system packages are updated. Also, consider upgrading pip to the latest version as suggested by the notice in your error message.

In case these steps don't resolve the issue, you may need to further investigate the specific error messages related to clang and permission denied warnings, potentially requiring more detailed logs.

If the issue persists, please feel free to reach up with additional details, like your macOS version, Python version, and environment configuration for a more tailored solution.

I hope this helps and you’re back on track soon!

github-actions[bot] commented 5 months ago

πŸ‘‹ Hello there! We wanted to give you a friendly reminder that this issue has not had any recent activity and may be closed soon, but don't worry - you can always reopen it if needed. If you still have any questions or concerns, please feel free to let us know how we can help.

For additional resources and information, please see the links below:

Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed!

Thank you for your contributions to YOLO πŸš€ and Vision AI ⭐

Rizwanali324 commented 2 months ago

Installing lapx worked for me.

pip3 install lapx

are u using window and conda

Rizwanali324 commented 2 months ago

Installing lapx worked for me.

pip3 install lapx

thanks. its working for me in window 8 conda env

glenn-jocher commented 2 months ago

@Rizwanali324 that's great to hear! 😊 If you have any more questions or need further assistance with your YOLOv8 setup, feel free to reach out. Happy coding! πŸ‘¨β€πŸ’»

luman249 commented 1 month ago

bug requirements: Ultralytics requirement ['lapx>=0.5.2'] not found, attempting AutoUpdate... ERROR: Operation cancelled by user

pip install lapx

Adnedvid commented 1 month ago

Here's the library for lap 0.4.0 just put it into your "site packages" in the "lib" folder. Got sick of trying to figure out what crazy loophole I did the previous 8 times. https://github.com/Adnedvid/Lap-pkg-for-YOLO.git

Edit: Thanks @glenn-jocher for the insight. I would certainly test it in a virtual environment. And it does remind me that this procedure still requires VS c++ build tools if you don't have it already

glenn-jocher commented 1 month ago

Hey there!

Thanks for sharing the workaround and the repository link πŸ‘. Using a virtual environment to isolate packages and dependencies is always a good practice. Just a heads up for others trying this out - make sure you've got the Visual Studio C++ build tools installed, as mentioned. This can often be a crucial step in successfully setting up complex Python packages on Windows.

Keep experimenting and happy coding! 😊

bingxinhu commented 3 weeks ago

Using pip install lapx OK

glenn-jocher commented 3 weeks ago

Great to hear that pip install lapx worked out for you! If you encounter any further issues or have questions as you continue working with YOLOv8, feel free to reach out. Happy detecting! πŸš€

Rizwanali324 commented 3 weeks ago

Using pip install lapx OK

In my recent experience with Windows, this mostly occurs due to some env libraries conflicting with actual code.