Megvii-BaseDetection / Megvii-BaseDetection/YOLOX

RuntimeError: Ninja is required to load C++ extensions

Open
#1,454 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
10.6k
Forks
2.5k
PR merge metrics
No merged PRs in 30d

Description

run code by python tools/eval.py -n yolox-s -c yolox_s.pth -b 2 -d 1 --conf 0.001

error:
2022-07-30 00:16:44.546 | ERROR | yolox.core.launch:launch:98 - An error has been caught in function 'launch', process 'MainProcess' (73156), thread 'MainThread' (85696):
Traceback (most recent call last):

File "tools/eval.py", line 219, in
args=(exp, args, num_gpu),
│ │ └ 1
│ └ Namespace(batch_size=2, ckpt='yolox_s.pth', conf=0.001, devices=1, dist_backend='nccl', dist_url=None, exp_file=None, experim...
└ ╒═══════════════════╤════════════════════════════════════════════════════════════════════════════════════════════════════════...

File "d:\pywork\3.debug\yolox\yolox\core\launch.py", line 98, in launch
main_func(*args)
│ └ (╒═══════════════════╤═══════════════════════════════════════════════════════════════════════════════════════════════════════...
└ <function main at 0x0000023B5407F730>

File "tools/eval.py", line 194, in main
model, is_distributed, args.fp16, trt_file, decoder, exp.test_size
│ │ │ │ │ │ │ └ (640, 640)
│ │ │ │ │ │ └ ╒═══════════════════╤════════════════════════════════════════════════════════════════════════════════════════════════════════...
│ │ │ │ │ └ None
│ │ │ │ └ None
│ │ │ └ False
│ │ └ Namespace(batch_size=2, ckpt='yolox_s.pth', conf=0.001, devices=1, dist_backend='nccl', dist_url=None, exp_file=None, experim...
│ └ False
└ YOLOX(
(backbone): YOLOPAFPN(
(backbone): CSPDarknet(
(stem): Focus(
(conv): BaseConv(
(conv): ...

File "d:\pywork\3.debug\yolox\yolox\evaluators\coco_evaluator.py", line 242, in evaluate
eval_results = self.evaluate_prediction(data_list, statistics)
│ │ │ └ tensor([2.1702, 0.0110, 4.0000], device='cuda:0')
│ │ └ [{'image_id': 0, 'category_id': 56, 'bbox': [-33.6690673828125, 9.699737548828125, 3907.0078125, 2132.7041015625], 'score': 0...
│ └ <function COCOEvaluator.evaluate_prediction at 0x0000023B58CC9BF8>
└ <yolox.evaluators.coco_evaluator.COCOEvaluator object at 0x0000023B60FC6F28>

File "d:\pywork\3.debug\yolox\yolox\evaluators\coco_evaluator.py", line 317, in evaluate_prediction
from yolox.layers import COCOeval_opt as COCOeval

File "d:\pywork\3.debug\yolox\yolox\layers_init_.py", line 11, in
from .fast_coco_eval_api import COCOeval_opt

File "d:\pywork\3.debug\yolox\yolox\layers\fast_coco_eval_api.py", line 17, in
FastCOCOEvalOp().jit_load()
└ <class 'yolox.layers.jit_ops.FastCOCOEvalOp'>

File "d:\pywork\3.debug\yolox\yolox\layers\jit_ops.py", line 107, in jit_load
verbose=verbose,
└ True

File "D:\F\Anaconda3\envs\yolox\lib\site-packages\torch\utils\cpp_extension.py", line 1136, in load
keep_intermediates=keep_intermediates)
└ True

File "D:\F\Anaconda3\envs\yolox\lib\site-packages\torch\utils\cpp_extension.py", line 1347, in _jit_compile
is_standalone=is_standalone)
└ False

File "D:\F\Anaconda3\envs\yolox\lib\site-packages\torch\utils\cpp_extension.py", line 1418, in _write_ninja_file_and_build_library
verify_ninja_availability()
└ <function verify_ninja_availability at 0x0000023B632F7268>

File "D:\F\Anaconda3\envs\yolox\lib\site-packages\torch\utils\cpp_extension.py", line 1474, in verify_ninja_availability
raise RuntimeError("Ninja is required to load C++ extensions")

RuntimeError: Ninja is required to load C++ extensions
How can I solve this on a windows machine ?

When i use pip install ninja, it shows Requirement already satisfied: ninja in d:\f\anaconda3\envs\yolox\lib\site-packages (1.10.2.3)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with tools/eval.py and trace the failure into yolox/layers/fast_coco_eval_api.py and yolox/layers/jit_ops.py, especially FastCOCOEvalOp.jit_load(). Re-run the reported evaluation command on Windows and verify that the C++ extension loads successfully without the Ninja RuntimeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python, pytorch
Domain
build-system, machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.