Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run error: No module named 'ninja' #56

Open
shuxjweb opened this issue Apr 11, 2021 · 11 comments
Open

run error: No module named 'ninja' #56

shuxjweb opened this issue Apr 11, 2021 · 11 comments

Comments

@shuxjweb
Copy link

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
Copy link

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

@aeoleader
Copy link

you need to install ninja before running the script

@kaniskgautam
Copy link

ninja is already installed

@Karenou
Copy link

Karenou commented Jan 21, 2022

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
Copy link

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

ninja --version

@Karenou
Copy link

Karenou commented Jan 25, 2022 via email

@dandanAD
Copy link

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

@aeoleader
Copy link

mapillary/inplace_abn#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
Copy link

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

@zyy26-zyy
Copy link

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

@robinsonmhj
Copy link

robinsonmhj commented Jan 31, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants