Vision: RuntimeError: No such operator torchvision::nms

Created on 18 Oct 2019  ยท  33Comments  ยท  Source: pytorch/vision

Similar to #1405, but I'm seeing this issue in the nightly builds.

What I did:

I download two nightly wheels from https://download.pytorch.org/whl/nightly/cu100/torch_nightly.html, and installed them with:

pip install torch-1.4.0.dev20191017+cu100-cp37-cp37m-linux_x86_64.whl torchvision-0.5.0.dev20191017+cu100-cp37-cp37m-linux_x86_64.whl 

Then, I recompile detectron2; Running a simple detectron2 evaluation raises this error:

python tools/train_net.py --config-file configs/LVIS-InstanceSegmentation/mask_rcnn_R_101_FPN_1x.yaml --num-gpus 2 --eval-only DATALOADER.NUM_WORKERS 1 MODEL.WEIGHTS ~/data/D2models/LVIS-InstanceSegmentation/mask_rcnn_R_101_FPN_1x/144219035/model_final_824ab5.pkl

an example stack trace:

Traceback (most recent call last):
  File "tools/train_net.py", line 162, in <module>
    args=(args,),
  File "/private/home/yuxinwu/detectron2/detectron2/engine/launch.py", line 52, in launch
    main_func(*args)
  File "tools/train_net.py", line 133, in main
    res = Trainer.test(cfg, model)
  File "/private/home/yuxinwu/detectron2/detectron2/engine/defaults.py", line 413, in test
    results_i = inference_on_dataset(model, data_loader, evaluator)
  File "/private/home/yuxinwu/detectron2/detectron2/evaluation/evaluator.py", line 118, in inference_on_dataset
    outputs = model(inputs)
  File "/private/home/yuxinwu/miniconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 541, in __call__
    result = self.forward(*input, **kwargs)
  File "/private/home/yuxinwu/detectron2/detectron2/modeling/meta_arch/rcnn.py", line 66, in forward
    return self.inference(batched_inputs)
  File "/private/home/yuxinwu/detectron2/detectron2/modeling/meta_arch/rcnn.py", line 119, in inference
    proposals, _ = self.proposal_generator(images, features, None)
  File "/private/home/yuxinwu/miniconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 541, in __call__
    result = self.forward(*input, **kwargs)
  File "/private/home/yuxinwu/detectron2/detectron2/modeling/proposal_generator/rpn.py", line 179, in forward
    self.training,
  File "/private/home/yuxinwu/detectron2/detectron2/modeling/proposal_generator/rpn_outputs.py", line 136, in find_top_rpn_proposals
    keep = batched_nms(boxes.tensor, scores_per_img, lvl, nms_thresh)
  File "/private/home/yuxinwu/detectron2/detectron2/layers/nms.py", line 17, in batched_nms
    return box_ops.batched_nms(boxes, scores, idxs, iou_threshold)
  File "/private/home/yuxinwu/miniconda3/lib/python3.7/site-packages/torchvision/ops/boxes.py", line 70, in batched_nms
    keep = nms(boxes_for_nms, scores, iou_threshold)
  File "/private/home/yuxinwu/miniconda3/lib/python3.7/site-packages/torchvision/ops/boxes.py", line 31, in nms
    return torch.ops.torchvision.nms(boxes, scores, iou_threshold)
  File "/private/home/yuxinwu/miniconda3/lib/python3.7/site-packages/torch/_ops.py", line 61, in __getattr__
    op = torch._C._jit_get_operation(qualified_op_name)
RuntimeError: No such operator torchvision::nms

another stack trace: https://github.com/facebookresearch/detectron2/issues/94#issue-507812638

Most helpful comment

Ok, I could reproduce the problem thanks to @pedrofreire snippet.
It seems to be due to installing the package with python setup.py install, while I've always used python setup.py build develop in order to be able to modify the library without reinstalling it.

I'm looking into a fix

All 33 comments

Thanks for the detailed report!

I think the issue is that since https://github.com/pytorch/vision/pull/1467 we now build torchvision nightlies against PyTorch 1.3, and not PyTorch master.

The reason why I changed it to PyTorch 1.3 was because I was planning on cutting a new release of torchvision in the next few days, so it should be cut against PyTorch 1.3 and we needed to test that CI is working with PyTorch 1.3

But I think there is no need that the nightlies to be built based on PyTorch 1.3

building from source, torchvision latest master, pytorch from tag v1.3.0, see every test in test_ops.py fail with the similar error... Here is the tail of the log, the rest is similar
```======================================================================

ERROR: test_roi_pool_gradient_cuda (__main__.RoIPoolTester)

Traceback (most recent call last):
File "test_ops.py", line 249, in test_roi_pool_gradient_cuda
y = layer(x, rois)
File "/home/tangorn/src/pytorch/build/install/lib64/python3.6/site-packages/torch/nn/modules/module.py", line 541, in __call__
result = self.forward(input, *kwargs)
File "/home/tangorn/src/pytorch/build/install/lib64/python3.6/site-packages/torchvision-0.5.0a0+97b53f9-py3.6-linux-x86_64.egg/torchvision/ops/roi_pool.py", line 49, in forward
return roi_pool(input, rois, self.output_size, self.spatial_scale)
File "/home/tangorn/src/pytorch/build/install/lib64/python3.6/site-packages/torchvision-0.5.0a0+97b53f9-py3.6-linux-x86_64.egg/torchvision/ops/roi_pool.py", line 34, in roi_pool
output, _ = torch.ops.torchvision.roi_pool(input, rois, spatial_scale,
File "/home/tangorn/src/pytorch/build/install/lib64/python3.6/site-packages/torch/_ops.py", line 61, in __getattr__
op = torch._C._jit_get_operation(qualified_op_name)
RuntimeError: No such operator torchvision::roi_pool


Ran 36 tests in 0.999s

FAILED (errors=36)
```
might be not related to the original issue, I am pretty new to pytorch, could have messed up something in my installation.

Hi @tangorn

I think there was a problem with your compilation of torchvision.
Can you do a clean install (removing all previously installed version of torchvision that you had), doing

python setup.py clean
python setup.py install

and report back? This should fix your issues

Also, @tangorn another option is to use PyTorch nightly and torchvision nightly, as we provide pre-built binaries for both.

did full clean rebuild of both pytorch and vision. Same issue. Other tests like test_transforms etc run fine. test_models fails only for models that use nms op. I have a feeling that the ops somehow do not register properly. Working from binary is not an attractive option for me as i am planning to add a few ops of my own...

rolling back to your 0.4.0 branch fixed it.

@tangorn can you paste the build logs from TorchVision? I'm fairly confident that there has been a compilation issue somewhere, just need to find out where, and I'd love to get this fixed with master.

Here you go:
torchvision-0.5.0-build.log
using python3 setup.py install, the beginning got cut due to excessive warnings, let me know if you need it too

@tangorn thanks for the log.

One more question: did you use the same PyTorch install to both compile torchvision and to run it?
If you could go to the torchvision folder, and do

torch.ops.load_library('_C.so')

and print the error message, it will be very helpful as well.
There is probably an incompatibility between the PyTorch version used to compile torchvision and the one you are using during runtime

OSError: /home/tangorn/src/torchvision-my/_C.so: cannot open shared object file: No such file or directory
which is understandable as

tangorn@linux-429s:~/src/torchvision-my> locate _C.so
/home/tangorn/src/torchvision-my/build/lib.linux-x86_64-3.6/torchvision/_C.so
tangorn@linux-429s:~/src/torchvision-my> 

it is built but not installed in the pytorch tree. But even copying it there by hand does not seem to work:

tangorn@linux-429s:~/src/torchvision-my> echo $LD_LIBRARY_PATH
/home/tangorn/src/pytorch/build/install/lib:/usr/local/cuda-10.0/lib64
tangorn@linux-429s:~/src/torchvision-my> /home/tangorn/src/pytorch/build/install/bin/python3 test.py
Traceback (most recent call last):
  File "test.py", line 3, in <module>
    torch.ops.load_library('_C.so')
  File "/home/tangorn/src/pytorch/build/install/lib64/python3.6/site-packages/torch/_ops.py", line 106, in load_library
    ctypes.CDLL(path)
  File "/usr/lib64/python3.6/ctypes/__init__.py", line 348, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: /home/tangorn/src/torchvision-my/_C.so: cannot open shared object file: No such file or directory
tangorn@linux-429s:~/src/torchvision-my> 

incompatibility I doubt as i run the test right after running setup.py install and i did not touch the pytorch since the clean rebuild yesterday

@tangorn thanks for trying this out. The second error message still doesn't give us the info I was looking for, can you pass the full path to the _C.so lib?

recreated the whole setup on my home box from scratch. Same result: 0.4.0 works, 0.5.0 does not. The only path I can find _C.so is in the build directory:

/home/tangorn/src/torchvision-my/build/lib.linux-x86_64-3.6/torchvision/_C.so

after running the test with 0.4.0 i can also see one in cache:

/home/tangorn/.cache/Python-Eggs/torchvision-0.4.0a0+d31eafa-py3.6-linux-x86_64.egg-tmp/torchvision/_C.so

@tangorn sorry, I meant to pass the full path to _C.so to torch.ops.load_library

there is no error if i do it:

tangorn@umbar:~/src/vision> /home/tangorn/src/pytorch/build/install/bin/python3
Python 3.6.5 (default, Mar 31 2018, 19:45:04) [GCC] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.ops.load_library('/home/tangorn/src/vision/build/lib.linux-x86_64-3.6/torchvision/_C.so')
>>> 

@tangorn so your torchvision install might be picking the wrong _C.so file.

I'd recommend removing the try: in https://github.com/pytorch/vision/blob/13b35ffaa5167f3713ea7a53c43395d90b3a7cbc/torchvision/extension.py#L15-L19
so that you can further debug the issue. It's probably related to the fact that in your setup https://github.com/pytorch/vision/blob/13b35ffaa5167f3713ea7a53c43395d90b3a7cbc/torchvision/extension.py#L10-L11 is not picking the right library

hmm, i did the above and added print statements to print lib_dir and path, then did setup.py clean, setup.py install, saved the whole log, and did not see the printouts. As if extension.py was never ran.

oh, see it, it's runtime stuff

so the lib_dir looks right, and the _C.so is there, but line 11 of extension.py fails

  File "/usr/lib64/python3.6/imp.py", line 297, in find_module
    raise ImportError(_ERR_MSG.format(name), name=name)
ImportError: No module named '_C'

@tangorn can you try running the same code but on an interpreter, to see if it finds the module?
So something like

lib_dir = 'path_to_your_libdir'
_, path, _ = imp.find_module("_C", [lib_dir])

The imp package is deprecated in newer versions of Python, but it's kept there for compatibility with Python2. I'm trying to understand why it's not picking the right lib for you. I think your system might be encapsulating the python code separately from the .so lib that is exported?

same error in interpreter

I have no other ideas then, this seems like a problem with your Python install then?

maybe. the difference with 0.4.0 that I see is that it has also _C.cpython-36m-x86_64-linux-gnu.so and _C.py refers to it rather than _C.so

oh, and the same code in interpreter fails for 0.4.0 the same way it does for 0.5.0

I did a quick google search and the closest I found was https://github.com/tensorflow/tensorflow/issues/8107, which pointed to a compilation error, but that's not the case in here. I'm running out of ideas for now, and as I cant reproduce the error it's very hard to try to find a solution without more details

I'm on torch 1.3.0 and building torchvision from master, and I am also getting the errors on running test_ops.py :

======================================================================
ERROR: test_roi_pool_gradient_cpu (test_ops.RoIPoolTester)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/pfr/code/repos/other/vision/test/test_ops.py", line 122, in test_roi_pool_gradient_cpu
    y = layer(x, rois)
  File "/Users/pfr/.conda/envs/gct/lib/python3.7/site-packages/torch/nn/modules/module.py", line 541, in __call__
    result = self.forward(*input, **kwargs)
  File "/Users/pfr/.conda/envs/gct/lib/python3.7/site-packages/torchvision-0.5.0a0+13b35ff-py3.7-macosx-10.9-x86_64.egg/torchvision/ops/roi_pool.py", line 49, in forward
    return roi_pool(input, rois, self.output_size, self.spatial_scale)
  File "/Users/pfr/.conda/envs/gct/lib/python3.7/site-packages/torchvision-0.5.0a0+13b35ff-py3.7-macosx-10.9-x86_64.egg/torchvision/ops/roi_pool.py", line 34, in roi_pool
    output, _ = torch.ops.torchvision.roi_pool(input, rois, spatial_scale,
  File "/Users/pfr/.conda/envs/gct/lib/python3.7/site-packages/torch/_ops.py", line 61, in __getattr__
    op = torch._C._jit_get_operation(qualified_op_name)
RuntimeError: No such operator torchvision::roi_pool

Removing the try block in extension.py gives me the same error ImportError: No module named '_C'.

I was wondering if was an issue related to the library being a zipped egg file (related to https://github.com/pytorch/pytorch/issues/20781 ?), so I unzipped it, and then I'm not getting the ImportError anymore, but still getting the initial error No such operator torchvision::roi_pool.

Not sure if it helps, but this is what my unzipped egg looks like:

โ”œโ”€โ”€ torchvision-0.5.0a0+13b35ff-py3.7-macosx-10.9-x86_64.egg
โ”‚ย ย  โ”œโ”€โ”€ EGG-INFO
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ PKG-INFO
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ SOURCES.txt
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ dependency_links.txt
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ native_libs.txt
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ requires.txt
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ top_level.txt
โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ zip-safe
โ”‚ย ย  โ””โ”€โ”€ torchvision
โ”‚ย ย      โ”œโ”€โ”€ _C.cpython-37m-darwin.so
โ”‚ย ย      โ”œโ”€โ”€ _C.py
โ”‚ย ย      โ”œโ”€โ”€ _C.so
โ”‚ย ย      โ”œโ”€โ”€ _C_tests.cpython-37m-darwin.so
โ”‚ย ย      โ”œโ”€โ”€ _C_tests.py
โ”‚ย ย      โ”œโ”€โ”€ _C_tests.so
โ”‚ย ย      โ”œโ”€โ”€ __init__.py
โ”‚ย ย      โ”œโ”€โ”€ __pycache__
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ _C.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ _C_tests.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ __init__.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ extension.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ utils.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ””โ”€โ”€ version.cpython-37.pyc
โ”‚ย ย      โ”œโ”€โ”€ _custom_ops.cpython-37m-darwin.so
โ”‚ย ย      โ”œโ”€โ”€ datasets
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ __init__.py
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ __pycache__
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ __init__.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ caltech.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ celeba.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ cifar.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ cityscapes.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ coco.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ fakedata.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ flickr.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ folder.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ hmdb51.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ imagenet.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ kinetics.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ lsun.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ mnist.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ omniglot.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ phototour.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ sbd.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ sbu.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ semeion.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ stl10.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ svhn.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ ucf101.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ usps.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ utils.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ video_utils.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ vision.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ voc.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ caltech.py
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ celeba.py
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ cifar.py
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ cityscapes.py
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ coco.py
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ fakedata.py
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ flickr.py
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ folder.py
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ hmdb51.py
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ imagenet.py
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ kinetics.py
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ lsun.py
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ mnist.py
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ omniglot.py
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ phototour.py
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ samplers
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ __init__.py
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ __pycache__
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ __init__.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ clip_sampler.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ clip_sampler.py
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ sbd.py
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ sbu.py
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ semeion.py
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ stl10.py
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ svhn.py
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ ucf101.py
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ usps.py
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ utils.py
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ video_utils.py
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ vision.py
โ”‚ย ย      โ”‚ย ย  โ””โ”€โ”€ voc.py
โ”‚ย ย      โ”œโ”€โ”€ extension.py
โ”‚ย ย      โ”œโ”€โ”€ io
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ __init__.py
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ __pycache__
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ __init__.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ _video_opt.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ video.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ _video_opt.py
โ”‚ย ย      โ”‚ย ย  โ””โ”€โ”€ video.py
โ”‚ย ย      โ”œโ”€โ”€ models
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ __init__.py
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ __pycache__
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ __init__.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ _utils.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ alexnet.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ densenet.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ googlenet.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ inception.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ mnasnet.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ mobilenet.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ resnet.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ shufflenetv2.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ squeezenet.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ utils.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ vgg.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ _utils.py
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ alexnet.py
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ densenet.py
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ detection
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ __init__.py
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ __pycache__
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ __init__.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ _utils.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ backbone_utils.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ faster_rcnn.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ generalized_rcnn.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ image_list.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ keypoint_rcnn.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ mask_rcnn.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ roi_heads.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ rpn.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ transform.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ _utils.py
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ backbone_utils.py
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ faster_rcnn.py
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ generalized_rcnn.py
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ image_list.py
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ keypoint_rcnn.py
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ mask_rcnn.py
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ roi_heads.py
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ rpn.py
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ transform.py
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ googlenet.py
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ inception.py
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ mnasnet.py
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ mobilenet.py
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ quantization
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ __init__.py
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ __pycache__
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ __init__.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ mobilenet.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ resnet.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ utils.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ mobilenet.py
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ resnet.py
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ utils.py
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ resnet.py
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ segmentation
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ __init__.py
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ __pycache__
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ __init__.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ _utils.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ deeplabv3.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ fcn.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ segmentation.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ _utils.py
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ deeplabv3.py
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ fcn.py
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ segmentation.py
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ shufflenetv2.py
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ squeezenet.py
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ utils.py
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ vgg.py
โ”‚ย ย      โ”‚ย ย  โ””โ”€โ”€ video
โ”‚ย ย      โ”‚ย ย      โ”œโ”€โ”€ __init__.py
โ”‚ย ย      โ”‚ย ย      โ”œโ”€โ”€ __pycache__
โ”‚ย ย      โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ __init__.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย      โ”‚ย ย  โ””โ”€โ”€ resnet.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย      โ””โ”€โ”€ resnet.py
โ”‚ย ย      โ”œโ”€โ”€ ops
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ __init__.py
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ __pycache__
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ __init__.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ _custom_ops.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ _register_onnx_ops.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ _utils.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ boxes.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ feature_pyramid_network.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ misc.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ poolers.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ ps_roi_align.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ ps_roi_pool.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ roi_align.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ roi_pool.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ _custom_ops.py
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ _register_onnx_ops.py
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ _utils.py
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ boxes.py
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ feature_pyramid_network.py
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ misc.py
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ poolers.py
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ ps_roi_align.py
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ ps_roi_pool.py
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ roi_align.py
โ”‚ย ย      โ”‚ย ย  โ””โ”€โ”€ roi_pool.py
โ”‚ย ย      โ”œโ”€โ”€ transforms
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ __init__.py
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ __pycache__
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ __init__.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ _functional_video.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ _transforms_video.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ functional.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ functional_tensor.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ transforms.cpython-37.pyc
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ _functional_video.py
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ _transforms_video.py
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ functional.py
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ functional_tensor.py
โ”‚ย ย      โ”‚ย ย  โ””โ”€โ”€ transforms.py
โ”‚ย ย      โ”œโ”€โ”€ utils.py
โ”‚ย ย      โ””โ”€โ”€ version.py

I don't have a deep understanding of the workings of the imports and builds here, so I'm not sure what is the easiest way to diagnose the issue, and what other info it would be useful to share.

Ok, I could reproduce the problem thanks to @pedrofreire snippet.
It seems to be due to installing the package with python setup.py install, while I've always used python setup.py build develop in order to be able to modify the library without reinstalling it.

I'm looking into a fix

@tangorn this should be fixed in master, let me know if you still face the same issue.

Note that once you install torchvision with python setup.py install, you'll need to change directories afterwards, or else you'll have the same issue.

Looks like it is past the _register_extensions() (removing try does not lead to error any more) and fails in the _check_cuda_version() of extension.py now:
tangorn@linux-429s:~/src/torchvision-my> /home/tangorn/src/pytorch/build/install/bin/python3 test/test_ops.py Traceback (most recent call last): File "test/test_ops.py", line 5, in <module> from torchvision import ops File "/home/tangorn/src/pytorch/build/install/lib64/python3.6/site-packages/torchvision-0.5.0a0+ca57148-py3.6-linux-x86_64.egg/torchvision/__init__.py", line 10, in <module> from .extension import _HAS_OPS File "/home/tangorn/src/pytorch/build/install/lib64/python3.6/site-packages/torchvision-0.5.0a0+ca57148-py3.6-linux-x86_64.egg/torchvision/extension.py", line 50, in <module> _check_cuda_version() File "/home/tangorn/src/pytorch/build/install/lib64/python3.6/site-packages/torchvision-0.5.0a0+ca57148-py3.6-linux-x86_64.egg/torchvision/extension.py", line 29, in _check_cuda_version _version = torch.ops.torchvision._cuda_version() File "/home/tangorn/src/pytorch/build/install/lib64/python3.6/site-packages/torch/_ops.py", line 61, in __getattr__ op = torch._C._jit_get_operation(qualified_op_name) RuntimeError: No such operator torchvision::_cuda_version

@tangorn can you make sure you do a clean build? I think this is due to a binary from 0.4.0 being picked

tried it, did not work. on the other hand if i do setup.py build develop it works just fine, so you are probably right, i just did not clean out something, maybe cache...

@fmassa Should we expect torchvision::nms to work on pytorch-nightly built from source?
There's an issue with it.

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: org.pytorch.helloworld, PID: 23024
    java.lang.RuntimeException: Unable to start activity ComponentInfo{org.pytorch.helloworld/org.pytorch.helloworld.MainActivity}: com.facebook.jni.CppException: 
    Unknown builtin op: torchvision::nms.
    Could not find any similar ops to torchvision::nms. This op may not exist or may not be currently supported in TorchScript.

Note: I use pytorch_android_torchvision-1.4.0-SNAPSHOT.aar library

@zetyquickly hi,

This operator should work on pytorch-nightly. Maybe the issue is that you are trying to run on a mobile, and the mobile export hasn't registered those operators?

@dreiss is there a way of letting 3rd-party extensions to be linked against a mobile build of pytorch?

Not right now (for OSS builds). We'll look into it, but it is much easier to get a small app size if you're able to bring all of the code into a single library.

Was this page helpful?
0 / 5 - 0 ratings