1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 fetchFromGitHub, 6 7 # build-system 8 setuptools, 9 10 # dependencies 11 lap, 12 matplotlib, 13 opencv-python, 14 pandas, 15 pillow, 16 psutil, 17 py-cpuinfo, 18 pyyaml, 19 requests, 20 scipy, 21 seaborn, 22 torch, 23 torchvision, 24 tqdm, 25 ultralytics-thop, 26 27 # tests 28 pytestCheckHook, 29 onnx, 30 onnxruntime, 31}: 32 33buildPythonPackage rec { 34 pname = "ultralytics"; 35 version = "8.3.130"; 36 pyproject = true; 37 38 src = fetchFromGitHub { 39 owner = "ultralytics"; 40 repo = "ultralytics"; 41 tag = "v${version}"; 42 hash = "sha256-lB4Q1LK3hbn67mHcVn2qCh9YjVPDBl4DM3LXDL7lsvQ="; 43 }; 44 45 build-system = [ setuptools ]; 46 47 pythonRelaxDeps = [ 48 "numpy" 49 ]; 50 51 dependencies = [ 52 lap 53 matplotlib 54 opencv-python 55 pandas 56 pillow 57 psutil 58 py-cpuinfo 59 pyyaml 60 requests 61 scipy 62 scipy 63 seaborn 64 torch 65 torchvision 66 tqdm 67 ultralytics-thop 68 ]; 69 70 pythonImportsCheck = [ "ultralytics" ]; 71 72 nativeCheckInputs = [ 73 pytestCheckHook 74 onnx 75 onnxruntime 76 ]; 77 78 pytestFlagsArray = [ 79 # rest of the tests require internet access 80 "tests/test_python.py" 81 ]; 82 83 disabledTests = 84 [ 85 # also remove the individual tests that require internet 86 "test_all_model_yamls" 87 "test_data_annotator" 88 "test_labels_and_crops" 89 "test_model_embeddings" 90 "test_model_methods" 91 "test_predict_callback_and_setup" 92 "test_predict_grey_and_4ch" 93 "test_predict_img" 94 "test_predict_txt" 95 "test_predict_visualize" 96 "test_results" 97 "test_train_pretrained" 98 "test_train_scratch" 99 "test_utils_torchutils" 100 "test_val" 101 "test_workflow" 102 "test_yolo_world" 103 "test_yolov10" 104 "test_yoloe" 105 "test_multichannel" 106 ] 107 ++ lib.optionals (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64) [ 108 # Fatal Python error: Aborted 109 # onnxruntime/capi/_pybind_state.py", line 32 in <module> 110 "test_utils_benchmarks" 111 ] 112 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 113 # Fatal Python error: Aborted 114 # ultralytics/utils/checks.py", line 598 in check_imshow 115 "test_utils_checks" 116 117 # RuntimeError: required keyword attribute 'value' has the wrong type 118 "test_utils_benchmarks" 119 ]; 120 121 meta = { 122 homepage = "https://github.com/ultralytics/ultralytics"; 123 changelog = "https://github.com/ultralytics/ultralytics/releases/tag/${src.tag}"; 124 description = "Train YOLO models for computer vision tasks"; 125 mainProgram = "yolo"; 126 license = lib.licenses.agpl3Only; 127 maintainers = with lib.maintainers; [ osbm ]; 128 }; 129}