'Ninja is required to load C++ extensions
I download a program and want to run it. It's from github.
I enter the experiments/segmentation/ folder, and input "python test.py --dataset PContext --model-zoo Encnet_ResNet50_PContext --eval" to the terminal.
The terminal shows "RuntimeError: Ninja is required to load C++ extensions. " I have searched the Internet for a night but found no such questions.
Can anybody help me? It's my first time to come here to ask questions
Solution 1:[1]
I just had the same issue with my code. To solve it I installed ninja with pip :
pip install Ninja
Solution 2:[2]
Did you install PyTorch? Did you install PyTorch-Encoding? (see https://hangzhang.org/PyTorch-Encoding/notes/compile.html)
You should install those packages (and all depencies are fetched automatically) with PIP. You can not just download the source and start! It is always a good idea to at least read the basic documentation of the package you are using.
Solution 3:[3]
This worked for me.
wget https://github.com/ninja-build/ninja/releases/download/v1.10.2/ninja-linux.zip
sudo unzip ninja-linux.zip -d /usr/local/bin/
sudo update-alternatives --install /usr/bin/ninja ninja /usr/local/bin/ninja 1 --force
Solution 4:[4]
I had this error while trying to integrate deepspeed library into my training procedure.
sudo apt-get install ninja-build
fixed it for me
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Loïc Themyr |
Solution 2 | |
Solution 3 | Wang |
Solution 4 | Berkay Berabi |