Skip to content
This repository was archived by the owner on Nov 1, 2023. It is now read-only.
This repository was archived by the owner on Nov 1, 2023. It is now read-only.

Error when build with docker, please specify the dependencies version #7

@leerumor

Description

@leerumor

I tried the following:
### 1. Build on Host
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.12) 5.4.0 20160609
first I got
#error You need C++14 to compile PyTorch
So I set c++ 14 in CMakeLists.txt and it worked.
set(CMAKE_CXX_STANDARD 14)
But got error while running the script.py.
With pytorch=1.3.1:

Traceback (most recent call last):
  File "test.py", line 4, in <module>
    print(torch.ops.my_ops.warp_perspective)
  File "/home/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 my_ops::warp_perspective

with pytorch=1.2.0:

Traceback (most recent call last):
  File "test.py", line 3, in <module>
    torch.ops.load_library("/home/LiRuMei/cpp_pytorch/build/libwarp_perspective.so")
  File "/home/anaconda3/envs/torch/lib/python3.7/site-packages/torch/_ops.py", line 106, in load_library
    ctypes.CDLL(path)
  File "/home/anaconda3/envs/torch/lib/python3.7/ctypes/__init__.py", line 356, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: /home/cpp_pytorch/build/libwarp_perspective.so: undefined symbol: _ZN5torch3jit17parseSchemaOrNameERKSs

### 2. Build with Docker
In docker the version is pytorch-nightly-cpu=1.2.0.
I also had an error about

static auto registry =
  torch::jit::RegisterOperators("my_ops::warp_perspective", &warp_perspective);

I modified it as in the tutorial:

static auto registry =
  torch::RegisterOperators("my_ops::warp_perspective", &warp_perspective);

Then I successfully built the .so, but still got:

Traceback (most recent call last):
  File "script.py", line 3, in <module>
    torch.ops.load_library("example_app/build/warp_perspective/libwarp_perspective.so")
  File "/root/local/miniconda/lib/python3.7/site-packages/torch/_ops.py", line 106, in load_library
    ctypes.CDLL(path)
  File "/root/local/miniconda/lib/python3.7/ctypes/__init__.py", line 364, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: /libtorch/lib/libtorch_cpu.so: undefined symbol: _ZN6caffe28TypeMeta21_typeMetaDataInstanceIcEEPKNS_6detail12TypeMetaDataEv

I think the problem is about the version of pytorch & libtorch, as the Dockerfile you committed a year ago always installed the latest version. So please try again if the Docker still works or indicate the version you used, thanks a lot.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions