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

OSError while loading library. #6

Closed
Arctanxy opened this issue Dec 6, 2019 · 3 comments
Closed

OSError while loading library. #6

Arctanxy opened this issue Dec 6, 2019 · 3 comments

Comments

@Arctanxy
Copy link

Arctanxy commented Dec 6, 2019

I changed some code as bellow:

1. You need C++14 to compile PyTorch

If you got errors like C++ 14 is required, you can add set(CMAKE_CXX_STANDARD 14) to example/CMakeLists.txt, like this:

cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
project(example_app)
set(CMAKE_CXX_STANDARD 14)
SET(Torch_DIR /libtorch/share/cmake/Torch)
find_package(Torch REQUIRED)
add_subdirectory(warp_perspective)
add_executable(example_app main.cpp)
target_link_libraries(example_app "${TORCH_LIBRARIES}")
target_link_libraries(example_app -Wl,--no-as-needed warp_perspective)
target_compile_features(example_app PRIVATE cxx_range_for)

2. no matching function for call to 'torch::jit::RegisterOperators::RegisterOperators

Use torch::RegisterOperators() instead of torch::jit::RegisterOperator(), it will be ok.

3. Docker download fail

If the downloading speed of PyTorch is too slow , you can change line 18 in your Dockerfile as follows:

RUN . /activate && conda install pytorch torchvision cpuonly -c pytorch

But when I ran python script.py, I got the same error as #4

What is the version of pytorch and libtorch used in this project ?

@Arctanxy Arctanxy changed the title Some tips for Compiling. OSError while loading library. Dec 6, 2019
@driazati
Copy link

driazati commented Dec 6, 2019

This repo is a little out of date, it's the final result of this tutorial (which is up-to-date): https://pytorch.org/tutorials/advanced/torch_script_custom_ops.html

@Arctanxy
Copy link
Author

Arctanxy commented Dec 9, 2019

This repo is a little out of date, it's the final result of this tutorial (which is up-to-date): https://pytorch.org/tutorials/advanced/torch_script_custom_ops.html

Thank you, I will try it.

@Arctanxy
Copy link
Author

This repo is a little out of date, it's the final result of this tutorial (which is up-to-date): https://pytorch.org/tutorials/advanced/torch_script_custom_ops.html

This repo is a little out of date, it's the final result of this tutorial (which is up-to-date): https://pytorch.org/tutorials/advanced/torch_script_custom_ops.html

Thank you, I will try it.

It works.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants