Coder Social home page Coder Social logo

Comments (4)

mfl28 avatar mfl28 commented on May 24, 2024

For the first error ("Could not find compatible version") you probably point cmake to a libtorch version that is not yet currently compatible (i.e. tested) with the tutorials.

If you want to try a later libtorch version, you can modify the root-level CMakeLists.txt file to allow the later version.

For the second error: As mentioned in the Readme, if you chose to let the script create the scriptmodule files automatically, you must have python3 installed and Pytorch and torchvision (python versions!) must be importable by the python interpreter.

Hope this clears some things up for you!

from pytorch-cpp.

shaojunjie0912 avatar shaojunjie0912 commented on May 24, 2024

Thanks for your reply.

The first problem Could not find compatible Torch version (> = 1.12.0, < = 2.1.1): I use the cuda version of libtorch automatically downloaded so it has been solved .

The second question No module named 'torch': I found out that it was because CMake did not detect python in the conda virtual environment, but used the python that came with the system, so I change the code in CMakeLists.txt:

set if(CREATE_SCRIPTMODULES)
    find_package(Python3 COMPONENTS Interpreter REQUIRED)
endif()

to

if(CREATE_SCRIPTMODULES)
  set(Python3_EXECUTABLE "/home/olioolii/miniconda3/envs/pytorch/bin/python3")
endif()

Then everything works well.

Finally, thank you for your contribution to this project!

from pytorch-cpp.

mfl28 avatar mfl28 commented on May 24, 2024

Great! In this case you could probably even do:

cmake -B build ... -D CREATE_SCRIPTMODULES=ON -D Python3_EXECUTABLE=<path/to/python>

without modifying the cmake file.

from pytorch-cpp.

shaojunjie0912 avatar shaojunjie0912 commented on May 24, 2024

Got it! Thanks!

from pytorch-cpp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.