question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

cannot run the code

See original GitHub issue

env: python 3.6, cuda 9.0, pytorch 0.4.1 try to run danet/train.py error:

Traceback (most recent call last):
  File "/home/mmvc/anaconda3/envs/Rx/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 960, in _build_extension_module
    check=True)
  File "/home/mmvc/anaconda3/envs/SY_DANet/lib/python3.6/subprocess.py", line 438, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "train.py", line 18, in <module>
    import encoding.utils as utils
  File "/home/mmvc/anaconda3/envs/SY_DANet/lib/python3.6/site-packages/encoding/__init__.py", line 13, in <module>
    from . import nn, functions, dilated, parallel, utils, models, datasets
  File "/home/mmvc/anaconda3/envs/SY_DANet/lib/python3.6/site-packages/encoding/nn/__init__.py", line 12, in <module>
    from .encoding import *
  File "/home/mmvc/anaconda3/envs/SY_DANet/lib/python3.6/site-packages/encoding/nn/encoding.py", line 19, in <module>
    from ..functions import scaledL2, aggregate, pairwise_cosine
  File "/home/mmvc/anaconda3/envs/SY_DANet/lib/python3.6/site-packages/encoding/functions/__init__.py", line 2, in <module>
    from .encoding import *
  File "/home/mmvc/anaconda3/envs/SY_DANet/lib/python3.6/site-packages/encoding/functions/encoding.py", line 14, in <module>
    from .. import lib
  File "/home/mmvc/anaconda3/envs/SY_DANet/lib/python3.6/site-packages/encoding/lib/__init__.py", line 12, in <module>
    ], build_directory=cpu_path, verbose=False)
  File "/home/mmvc/anaconda3/envs/Rx/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 658, in load
    is_python_module)
  File "/home/mmvc/anaconda3/envs/Rx/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 827, in _jit_compile
    with_cuda=with_cuda)
  File "/home/mmvc/anaconda3/envs/Rx/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 880, in _write_ninja_file_and_build
    _build_extension_module(name, build_directory, verbose)
  File "/home/mmvc/anaconda3/envs/Rx/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 973, in _build_extension_module
    raise RuntimeError(message)
RuntimeError: Error building extension 'enclib_cpu': [1/2] c++ -MMD -MF roi_align_cpu.o.d -DTORCH_EXTENSION_NAME=enclib_cpu -DTORCH_API_INCLUDE_EXTENSION_H -isystem /home/mmvc/anaconda3/envs/Rx/lib/python3.6/site-packages/torch/include -isystem /home/mmvc/anaconda3/envs/Rx/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -isystem /home/mmvc/anaconda3/envs/Rx/lib/python3.6/site-packages/torch/include/TH -isystem /home/mmvc/anaconda3/envs/Rx/lib/python3.6/site-packages/torch/include/THC -isystem /home/mmvc/anaconda3/envs/SY_DANet/include/python3.6m -D_GLIBCXX_USE_CXX11_ABI=1 -fPIC -std=c++11 -c /home/mmvc/anaconda3/envs/SY_DANet/lib/python3.6/site-packages/encoding/lib/cpu/roi_align_cpu.cpp -o roi_align_cpu.o
FAILED: roi_align_cpu.o 
c++ -MMD -MF roi_align_cpu.o.d -DTORCH_EXTENSION_NAME=enclib_cpu -DTORCH_API_INCLUDE_EXTENSION_H -isystem /home/mmvc/anaconda3/envs/Rx/lib/python3.6/site-packages/torch/include -isystem /home/mmvc/anaconda3/envs/Rx/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -isystem /home/mmvc/anaconda3/envs/Rx/lib/python3.6/site-packages/torch/include/TH -isystem /home/mmvc/anaconda3/envs/Rx/lib/python3.6/site-packages/torch/include/THC -isystem /home/mmvc/anaconda3/envs/SY_DANet/include/python3.6m -D_GLIBCXX_USE_CXX11_ABI=1 -fPIC -std=c++11 -c /home/mmvc/anaconda3/envs/SY_DANet/lib/python3.6/site-packages/encoding/lib/cpu/roi_align_cpu.cpp -o roi_align_cpu.o
/home/mmvc/anaconda3/envs/SY_DANet/lib/python3.6/site-packages/encoding/lib/cpu/roi_align_cpu.cpp: In function ‘at::Tensor ROIAlignForwardCPU(const at::Tensor&, const at::Tensor&, int64_t, int64_t, double, int64_t)’:
/home/mmvc/anaconda3/envs/SY_DANet/lib/python3.6/site-packages/encoding/lib/cpu/roi_align_cpu.cpp:407:30: error: ‘class at::DeprecatedTypeProperties’ has no member named ‘tensor’
   auto output = input.type().tensor({num_rois, channels, pooled_height, pooled_width});
                              ^
In file included from /home/mmvc/anaconda3/envs/Rx/lib/python3.6/site-packages/torch/include/ATen/ATen.h:9:0,
                 from /home/mmvc/anaconda3/envs/SY_DANet/lib/python3.6/site-packages/encoding/lib/cpu/roi_align_cpu.cpp:1:
/home/mmvc/anaconda3/envs/SY_DANet/lib/python3.6/site-packages/encoding/lib/cpu/roi_align_cpu.cpp: In lambda function:
/home/mmvc/anaconda3/envs/SY_DANet/lib/python3.6/site-packages/encoding/lib/cpu/roi_align_cpu.cpp:425:27: error: expected primary-expression before ‘>’ token
       output.data<scalar_t>());
                           ^
/home/mmvc/anaconda3/envs/SY_DANet/lib/python3.6/site-packages/encoding/lib/cpu/roi_align_cpu.cpp:425:29: error: expected primary-expression before ‘)’ token
       output.data<scalar_t>());
                             ^
/home/mmvc/anaconda3/envs/SY_DANet/lib/python3.6/site-packages/encoding/lib/cpu/roi_align_cpu.cpp: In lambda function:
/home/mmvc/anaconda3/envs/SY_DANet/lib/python3.6/site-packages/encoding/lib/cpu/roi_align_cpu.cpp:425:27: error: expected primary-expression before ‘>’ token
       output.data<scalar_t>());
                           ^
/home/mmvc/anaconda3/envs/SY_DANet/lib/python3.6/site-packages/encoding/lib/cpu/roi_align_cpu.cpp:425:29: error: expected primary-expression before ‘)’ token
       output.data<scalar_t>());
                             ^
/home/mmvc/anaconda3/envs/SY_DANet/lib/python3.6/site-packages/encoding/lib/cpu/roi_align_cpu.cpp: In function ‘at::Tensor ROIAlignBackwardCPU(const at::Tensor&, const at::Tensor&, int64_t, int64_t, int64_t, int64_t, int64_t, int64_t, double, int64_t)’:
/home/mmvc/anaconda3/envs/SY_DANet/lib/python3.6/site-packages/encoding/lib/cpu/roi_align_cpu.cpp:454:37: error: ‘class at::DeprecatedTypeProperties’ has no member named ‘tensor’
   auto grad_in = bottom_rois.type().tensor({b_size, channels, height, width}).zero_(); 
                                     ^
In file included from /home/mmvc/anaconda3/envs/Rx/lib/python3.6/site-packages/torch/include/ATen/ATen.h:9:0,
                 from /home/mmvc/anaconda3/envs/SY_DANet/lib/python3.6/site-packages/encoding/lib/cpu/roi_align_cpu.cpp:1:
/home/mmvc/anaconda3/envs/SY_DANet/lib/python3.6/site-packages/encoding/lib/cpu/roi_align_cpu.cpp: In lambda function:
/home/mmvc/anaconda3/envs/SY_DANet/lib/python3.6/site-packages/encoding/lib/cpu/roi_align_cpu.cpp:470:28: error: expected primary-expression before ‘>’ token
       grad_in.data<scalar_t>(),
                            ^
/home/mmvc/anaconda3/envs/SY_DANet/lib/python3.6/site-packages/encoding/lib/cpu/roi_align_cpu.cpp:470:30: error: expected primary-expression before ‘)’ token
       grad_in.data<scalar_t>(),
                              ^
/home/mmvc/anaconda3/envs/SY_DANet/lib/python3.6/site-packages/encoding/lib/cpu/roi_align_cpu.cpp: In lambda function:
/home/mmvc/anaconda3/envs/SY_DANet/lib/python3.6/site-packages/encoding/lib/cpu/roi_align_cpu.cpp:470:28: error: expected primary-expression before ‘>’ token
       grad_in.data<scalar_t>(),
                            ^
/home/mmvc/anaconda3/envs/SY_DANet/lib/python3.6/site-packages/encoding/lib/cpu/roi_align_cpu.cpp:470:30: error: expected primary-expression before ‘)’ token
       grad_in.data<scalar_t>(),
                              ^
ninja: build stopped: subcommand failed.

How to fix this? What version of pytorch, cuda or python should I use?

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:16 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
domYukicommented, Jul 4, 2020

OK!!!

PytorchEncoding version1.0.1->DANet

ENV ubuntu 18.04.2 LTS CUDA 10.0 Python 3.6.8 torch 1.0.0 torchvision 0.2.0 ninja 1.8.2 hacky 0.0.2

①Install torch, torchvision, ninja, hacky ・torch pip install http://download.pytorch.org/whl/cu100/torch-1.0.0-cp36-cp36m-linux_x86_64.wh ・torchvision pip install torchvision==0.2.0 ・ninja pip install ninja==1.8.2 ・hacky pip install hacky

②install PytorchEncoding version1.0.1 & unzip ・ download pytorch encoding v1.0.1 https://github.com/zhanghang1989/PyTorch-Encoding/releases/tag/v1.0.0

③install PytorchEncoding

cd PyTorch-Encoding python setup.py install

④replace [PyTorch-Encoding v1.0.1] → [DANet] encoding/lib → encoding/lib encoding/functions/syncbn.py → encoding/functions/syncbn.py encoding/nn/syncbn.py → encoding/nn/syncbn.py encoding/utils/misc.py → encoding/utils/misc.py(create new file) encoding/version.py → encoding/version.py(create new file)

・processing form 33 class to 19 class for Cityscapes This will be helpful to fix dataloader https://github.com/hszhao/semseg/issues/29#issuecomment-567225502 🗿🗿🗿🗿🗿🗿🗿🗿🗿🗿🗿

0reactions
wlj567commented, Sep 28, 2021

OK!!!

PytorchEncoding version1.0.1->DANet

ENV ubuntu 18.04.2 LTS CUDA 10.0 Python 3.6.8 torch 1.0.0 torchvision 0.2.0 ninja 1.8.2 hacky 0.0.2

①Install torch, torchvision, ninja, hacky ・torch pip install http://download.pytorch.org/whl/cu100/torch-1.0.0-cp36-cp36m-linux_x86_64.wh ・torchvision pip install torchvision==0.2.0 ・ninja pip install ninja==1.8.2 ・hacky pip install hacky

②install PytorchEncoding version1.0.1 & unzip ・ download pytorch encoding v1.0.1 https://github.com/zhanghang1989/PyTorch-Encoding/releases/tag/v1.0.0

③install PytorchEncoding

cd PyTorch-Encoding python setup.py install

④replace [PyTorch-Encoding v1.0.1] → [DANet] encoding/lib → encoding/lib encoding/functions/syncbn.py → encoding/functions/syncbn.py encoding/nn/syncbn.py → encoding/nn/syncbn.py encoding/utils/misc.py → encoding/utils/misc.py(create new file) encoding/version.py → encoding/version.py(create new file)

・processing form 33 class to 19 class for Cityscapes This will be helpful to fix dataloader hszhao/semseg#29 (comment)

您好,请问你这个代码跑出来了吗,方便加个联系方式吗

Read more comments on GitHub >

github_iconTop Results From Across the Web

My code won't run ! | Codecademy
I have to refreash between every task, and sometimes it causes me to lose code when it locks up after already refreashing! I...
Read more >
Visual Studio Code wont run code and gives no error message
The Code runs perfectly in the IDE that comes with Python. It's with any code whatsoever.
Read more >
Visual Studio Code doesn't run code - Super User
CTRL+SHIFT+X · Type in search box Code Runner · Install the extension · Than click on File - Preferences - Settings · Type...
Read more >
Cannot "run" the code in the screencasts · Issue #615 - GitHub
I have an issue running the code in the console during the screencasts as the "preview" function as well. I know the issue...
Read more >
I can't run code, who can help me. - LeetCode Discuss
Login to Comment​​ When non-premium users try to submit code very frequently then this thing happens. So you first run the code then...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found