pytorch / pytorch/tutorials

(Clion Window 10)Cmake setting failed, I have tried all kind of solution on the internet

Open
#806 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
9.3k
Forks
4.4k
Avg merge
1d 21h
Merged PRs (30d)
4

Description

it throw: Torch Script Not found: torch;torch_library;C10_LIBRARY

code:
cmake_minimum_required(VERSION 3.5)
project(HappySugarLife)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_PREFIX_PATH ${Torch_DIR})

find_package(Torch REQUIRED)

set(SOURCE_FILES main.cpp)
set(Torch_DIR libtorch/share/cmake/Torch)

add_executable( HappySugarLife ${SOURCE_FILES} libtorch/lib)
target_link_libraries( HappySugarLife "${TORCH_LIBRARIES}")

image
image

Here are the solution that I have tried:
https://github.com/pytorch/pytorch/issues/12449
https://github.com/hughperkins/pytorch/issues/36
https://github.com/pytorch/pytorch/issues/17479
https://github.com/nagadomi/waifu2x/issues/253#issuecomment-445448928
https://github.com/pytorch/pytorch/issues/14684
https://discuss.pytorch.org/t/cmake-problem-minimal-example-for-c-frontend/44286/3
All failed to slove this problem.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the posted CMake configuration and the Torch package lookup around find_package(Torch REQUIRED), Torch_DIR, and TORCH_LIBRARIES. Reproduce the reported Torch Script Not found error in the stated CLion and Windows environment, checking the linked libtorch paths and referenced discussions. Done means CMake configures successfully and the HappySugarLife executable links against Torch.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp, pytorch
Domain
build-system, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.