12

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

Yurets
  • 3,999
  • 17
  • 54
  • 74
alyssa
  • 121
  • 1
  • 1
  • 3

4 Answers4

14

I just had the same issue with my code. To solve it I installed ninja with pip :

pip install Ninja
Loïc Themyr
  • 151
  • 1
  • 7
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

Berkay Berabi
  • 1,933
  • 1
  • 10
  • 26
0

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.

Frieder
  • 1,208
  • 16
  • 25
0

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 
Wang
  • 35
  • 1
  • 8