fbtorch: cmake can not find torch directories - cmake

I am trying to build and install fbtorch, however when I used cmake I got the following error:
CMake Error at CMakeLists.txt:9 (FIND_PACKAGE):
By not providing "FindTorch.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "Torch", but
CMake did not find one.
Could not find a package configuration file provided by "Torch" with any of
the following names:
TorchConfig.cmake
torch-config.cmake
Add the installation prefix of "Torch" to CMAKE_PREFIX_PATH or set
"Torch_DIR" to a directory containing one of the above files. If "Torch"
provides a separate development package or SDK, be sure it has been
installed.
I searched online and found some solutions such as using
source ~/torch/install/bin/torch-activate
or reinstalling torch, but nothing helps.
Could someone help me? Thank you.

Got the same issue.
Solution: export Torch_DIR as env variable before cmake
e.g. i am using python virtual env on linux, and installed pytorch using 'pip'.
export Torch_DIR=/home/my/pyenv/py3.7-torch1.0/lib/python3.7/site-packages/torch/share/cmake/Torch
cmake blablabla
make

if use clion:
clion preference --> Environment ---> /some_path_to/torchscript/libtorch/share/cmake/Torch

Related

cmake not finding package configuration file

I am using Qt Creator as IDE and MSVC 2019.
I built and installed the pagmo library from the source. Now I am trying to use it for my project.
Even though the installation seems fine, when I try to load it I get strange errors, telling me that "pagmo" is not found. In particular:
error:
By not providing "FindPagmo.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "Pagmo",
but CMake did not find one.
Could not find a package configuration file provided by "Pagmo" with any
of the following names:
PagmoConfig.cmake
pagmo-config.cmake
Add the installation prefix of "Pagmo" to CMAKE_PREFIX_PATH or set
"Pagmo_DIR" to a directory containing one of the above files. If
"Pagmo" provides a separate development package or SDK, be sure it has
been installed.
In my CMakeLists.txt I have set the following command:
find_package(Pagmo REQUIRED)
Now, as far as I know FindPagmo.cmake does not exist, BUT I am giving as input parameter Pagmo_DIR, which contains the file pagmo-config.cmake. I can't understand why CMake is not finding it. I also tried to set CMAKE_MODULE_PATH to the same folder but nothing changed.
Does anybody have suggestions on how to solve this problem?
I am setting pagmo directory as follows:
-DPagmo_DIR = C:\Lib\pagmo\install\debug\lib\cmake\pagmo
in that folder I have the following files:
Findpagmo_IPOPT.cmake;
pagmo_export.cmake;
pagmo_export-debug.cmake;
pagmo-config.cmake;
pagmo-config-version.cmake;
PagmoFindBoost.cmake

How do I solve colcon build on Ubuntu?

The error reads as follows:
By not providing "Findrosidl_default_generators.cmake" in CMAKE_MODULE_PATH
this project has asked CMake to find a package configuration file provided
by "rosidl_default_generators", but CMake did not find one.
Could not find a package configuration file provided by
"rosidl_default_generators" with any of the following names:
rosidl_default_generatorsConfig.cmake
rosidl_default_generators-config.cmake

How can I use cmake to locate jupyter notebook installation

Is there a way to use cmake find_package() to locate jupyter_notebook installation?
I tried
FIND_PACKAGE(jupyter-notebook REQUIRED)
but it errors out with
CMake Error at CMakeLists.txt:15 (FIND_PACKAGE):
By not providing "Findjupyter-notebook.cmake" in CMAKE_MODULE_PATH this
project has asked CMake to find a package configuration file provided by
"jupyter-notebook", but CMake did not find one.
Could not find a package configuration file provided by "jupyter-notebook"
with any of the following names:
jupyter-notebookConfig.cmake
jupyter-notebook-config.cmake
Add the installation prefix of "jupyter-notebook" to CMAKE_PREFIX_PATH or
set "jupyter-notebook_DIR" to a directory containing one of the above
files. If "jupyter-notebook" provides a separate development package or
SDK, be sure it has been installed.
-- Configuring incomplete, errors occurred!
However, it has been installed:
apt-cache show jupyter-notebook
There are a few options when using the find_package command, MODULE and CONFIG. For this case, you likely want the CONFIG setting. The error message is trying to help here. Did either of these files come with the jupyter-notebook installation?
jupyter-notebookConfig.cmake
jupyter-notebook-config.cmake
If so, try setting CMAKE_PREFIX_PATH or jupyter-notebook_DIR to the directory where jupyter-notebook was installed. So you might try something like the following:
list(APPEND CMAKE_PREFIX_PATH /path/to/your/installation) # Try this one.
# SET(jupyter-notebook_DIR /path/to/your/installation) # Or try this one.
FIND_PACKAGE(jupyter-notebook CONFIG REQUIRED)
If your installation does not appear to have the aforementioned CMake config files, nor does it appear to have any CMake support files (a cmake directory, etc.), the find_program command is likely more appropriate for jupyter-notebook.
I suggest spending some time with the documentation for find_package, as it explicitly lays out the search paths (in order) CMake uses to find your packages. Also, check out this answer.

kdev-ruby's CMakeFile.txt requires weird stuff like KF5Config.cmake

I'm trying to compile a Ruby plugin for KDevelop: https://github.com/KDE/kdev-ruby
When I cut a folder called build, cd build, and run cmake .., I get lots of errors:
CMake Error at CMakeLists.txt:13 (include):
include could not find load file:
KDEInstallDirs
CMake Error at CMakeLists.txt:14 (include):
include could not find load file:
KDECMakeSettings
CMake Error at CMakeLists.txt:15 (include):
include could not find load file:
KDECompilerSettings
CMake Error at CMakeLists.txt:16 (include):
include could not find load file:
ECMQtDeclareLoggingCategory
CMake Error at CMakeLists.txt:24 (find_package):
By not providing "FindKF5.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "KF5", but
CMake did not find one.
Could not find a package configuration file provided by "KF5" (requested
version 5.15.0) with any of the following names:
KF5Config.cmake
kf5-config.cmake
Add the installation prefix of "KF5" to CMAKE_PREFIX_PATH or set "KF5_DIR"
to a directory containing one of the above files. If "KF5" provides a
separate development package or SDK, be sure it has been installed.
How, on Ubuntu, do I install something that provides KF5Config.cmake? Preferably without rebuilding KDevelop or KDE or Qt5.
KDevelop relies on the development headers for various libraries, and finds them via the accompanying CMake files.
The build also uses CMake modules provided by the extra-cmake-modules package.
You must install that and libkf5config-dev.
The apt-file command might help you find the relevant packages for your distro in these situations.

CMake could not find the VTKConfig.cmake

I'm trying to compile a program in CMake but I'm getting this error.
By not providing "FindVTK.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "VTK", but
CMake did not find one.
Could not find a package configuration file provided by "VTK" (requested
version 6.1) with any of the following names:
VTKConfig.cmake
vtk-config.cmake
I can't find the relevant files (VTKConfig.cmake or vtk-config.cmake) on the machine but do have VTKConfig.cmake.in (which also doesn't work).
Does anyone know where I can download the file from, or what I might be doing wrong.
It seems like you just have the VTK source code but haven't built it yet. VTKConfig.cmake.in is a template used by CMake to generate the VTKConfig.cmake file in the build and install directory. Look at http://www.vtk.org/Wiki/VTK/Building to see how to build VTK.
When you have successfully built VTK you can give CMake a hint where to look for VTK with the VTK_DIR-parameter:
cmake -DVTK_DIR=/path/to/vtk/build-directory /path/to/your/source-directory
If you have successfully built VTK, you would end up with a VTK-Release-build folder containing all the build files, one of which is VTKConfig.cmake. Your program is not able to find this file. You just need to set an environment variable named VTK_DIR before running your program. You can do so by running:
export VTK_DIR=/path/to/VTK-Release-build/
"FindVTK.cmake"the file of cmake is made in build directry.
please add this Path. export VTK_DIR=/path/VTK-Release-version/build