You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.
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);
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.
The text was updated successfully, but these errors were encountered:
I ran into the exact same problem as y'all. Change the wget call in the dockerfile to pull libtorch from the stable 1.4.0 release at https://download.pytorch.org/libtorch/cpu/libtorch-macos-1.4.0.zip
(or manually replace the /libtorch directory with the unzipped file linked above).
Then, do something like python3 -m pip install --upgrade torch torchvision
to upgrade your virtual environment's version of torch to 1.4.0.
like @leerumor suggested, the problem stems from missing symbols due to incompatible torch installation and libtorch version.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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:
with pytorch=1.2.0:
### 2. Build with Docker
In docker the version is pytorch-nightly-cpu=1.2.0.
I also had an error about
I modified it as in the tutorial:
Then I successfully built the .so, but still got:
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.
The text was updated successfully, but these errors were encountered: