GoGoDuck912 / Self-Correction-Human-Parsing

An out-of-box human parsing representation extractor.
MIT License
1.03k stars 237 forks source link

run error: No module named 'ninja' #56

Open shuxjweb opened 3 years ago

shuxjweb commented 3 years ago

I have installed ninja. I have also tried several pytorch versions, e.g., 0.4.0 / 1.0.1 / 1.2.0 / 1.6.0 / 1.7.1. It always report the below errors. I do not know how to run this code.


Traceback (most recent call last): File "/usr/local/bin/ninja", line 6, in from ninja import ninja ModuleNotFoundError: No module named 'ninja' Traceback (most recent call last): File "/home/shuxj/tool/pycharm/helpers/pydev/pydevd.py", line 1664, in main() File "/home/shuxj/tool/pycharm/helpers/pydev/pydevd.py", line 1658, in main globals = debugger.run(setup['file'], None, None, is_module) File "/home/shuxj/tool/pycharm/helpers/pydev/pydevd.py", line 1068, in run pydev_imports.execfile(file, globals, locals) # execute the script File "/home/shuxj/tool/pycharm/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "/home/shuxj/work/code/human_parsing/SCHP/SCHP/simple_extractor_ltcc_color.py", line 24, in import networks File "/home/shuxj/work/code/human_parsing/SCHP/SCHP/networks/init.py", line 3, in from networks.AugmentCE2P import resnet101 File "/home/shuxj/work/code/human_parsing/SCHP/SCHP/networks/AugmentCE2P.py", line 21, in from modules import InPlaceABNSync File "/home/shuxj/work/code/human_parsing/SCHP/SCHP/modules/init.py", line 1, in from .bn import ABN, InPlaceABN, InPlaceABNSync File "/home/shuxj/work/code/human_parsing/SCHP/SCHP/modules/bn.py", line 10, in from .functions import * File "/home/shuxj/work/code/human_parsing/SCHP/SCHP/modules/functions.py", line 18, in extra_cuda_cflags=["--expt-extended-lambda"]) File "/home/shuxj/.conda/envs/schp/lib/python3.5/site-packages/torch/utils/cpp_extension.py", line 658, in load is_python_module) File "/home/shuxj/.conda/envs/schp/lib/python3.5/site-packages/torch/utils/cpp_extension.py", line 827, in _jit_compile with_cuda=with_cuda) File "/home/shuxj/.conda/envs/schp/lib/python3.5/site-packages/torch/utils/cpp_extension.py", line 850, in _write_ninja_file_and_build verify_ninja_availability() File "/home/shuxj/.conda/envs/schp/lib/python3.5/site-packages/torch/utils/cpp_extension.py", line 890, in verify_ninja_availability subprocess.check_call('ninja --version'.split(), stdout=devnull) File "/home/shuxj/.conda/envs/schp/lib/python3.5/subprocess.py", line 271, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['ninja', '--version']' returned non-zero exit status 1

JieLiu-UvA commented 3 years ago

have you solved this problem? I met same error too.

aeoleader commented 3 years ago

you need to install ninja before running the script

kaniskgautam commented 2 years ago

ninja is already installed

Karenou commented 2 years ago

I also have the same problem. I have installed pytorch1.10, ninja 1.8.2, cuda 11.3. But still cannot run the program.

Traceback (most recent call last):
  File "/home/juneshi/anaconda3/envs/pytorch/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1717, in _run_ninja_build
    subprocess.run(
  File "/home/juneshi/anaconda3/envs/pytorch/lib/python3.8/subprocess.py", line 516, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "Self-Correction-Human-Parsing/simple_extractor.py", line 24, in <module>
    import networks
  File "/home/juneshi/Desktop/Ecommerce_consumer_behavior/bmi_prediction/Self-Correction-Human-Parsing/networks/__init__.py", line 3, in <module>
    from networks.AugmentCE2P import resnet101
  File "/home/juneshi/Desktop/Ecommerce_consumer_behavior/bmi_prediction/Self-Correction-Human-Parsing/networks/AugmentCE2P.py", line 21, in <module>
    from modules import InPlaceABNSync
  File "/home/juneshi/Desktop/Ecommerce_consumer_behavior/bmi_prediction/Self-Correction-Human-Parsing/modules/__init__.py", line 1, in <module>
    from .bn import ABN, InPlaceABN, InPlaceABNSync
  File "/home/juneshi/Desktop/Ecommerce_consumer_behavior/bmi_prediction/Self-Correction-Human-Parsing/modules/bn.py", line 10, in <module>
    from .functions import *
  File "/home/juneshi/Desktop/Ecommerce_consumer_behavior/bmi_prediction/Self-Correction-Human-Parsing/modules/functions.py", line 10, in <module>
    _backend = load(name="inplace_abn",
  File "/home/juneshi/anaconda3/envs/pytorch/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1124, in load
    return _jit_compile(
  File "/home/juneshi/anaconda3/envs/pytorch/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1337, in _jit_compile
    _write_ninja_file_and_build_library(
  File "/home/juneshi/anaconda3/envs/pytorch/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1449, in _write_ninja_file_and_build_library
    _run_ninja_build(
  File "/home/juneshi/anaconda3/envs/pytorch/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1733, in _run_ninja_build
    raise RuntimeError(message) from e
RuntimeError: Error building extension 'inplace_abn': ninja: warning: bad deps log signature or version; starting over
aeoleader commented 2 years ago

What is the ninja version? Please run the following command and check.

ninja --version
Karenou commented 2 years ago

My ninja version is 1.10.2.

aeoleader @.***>于2022年1月24日 周一上午10:46写道:

What is the ninja version? Please run the following command and check.

ninja --version

— Reply to this email directly, view it on GitHub https://github.com/PeikeLi/Self-Correction-Human-Parsing/issues/56#issuecomment-1019662754, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKTNYE2MO66PETLUSO5IN2TUXS4QLANCNFSM42XVWWUA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

dandanAD commented 2 years ago

我也遇到了相似问题,ninja: build stopped: subcommand failed.请问怎么解决呀

aeoleader commented 2 years ago

https://github.com/mapillary/inplace_abn/issues/104 Pls check this thread.

My ninja version is 1.10.2. aeoleader @.>于2022年1月24日 周一上午10:46写道: What is the ninja version? Please run the following command and check. ninja --version — Reply to this email directly, view it on GitHub <#56 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKTNYE2MO66PETLUSO5IN2TUXS4QLANCNFSM42XVWWUA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you commented.Message ID: @.>

michaelyyq commented 2 years ago

Ninja is required to load C++ extensions sudo apt-get install ninja-build This solved my problem.

zyy26-zyy commented 1 year ago

我也遇到了相似问题,ninja: build stopped: subcommand failed.请问怎么解决呀 请问解决了吗,我也遇到这个问题了

robinsonmhj commented 7 months ago

you can also use conda to isntall ninja-build. Here is the command conda install ninja-build -c refractor