在Win7上安装Torch7;cmake和PATH问题



我试图在我的Win7系统上安装Torch 7来运行RNN,这太疯狂了。我把它轻松地安装在我的Ubuntu VM上,但它不能访问我的GPU进行CUDA加速,所以我要么尝试实验性的PCI直通软件,要么尝试在Windows上获得Torch。到目前为止,我已经安装了Lua和luarrocks(但我不能从C:Program Files (x86)LuaRocks2.2路径以外的任何地方运行它)。我已经安装了mingw和cmake。我尝试使用以下命令安装Torch:

luarocks --server=https://raw.githubusercontent.com/torch/rocks/master install torch

(来源:安装Torch7与Luarocks在Windows与mingw构建错误)

但是我得到:

Missing dependencies for torch:
paths >= 1.0
Using https://raw.githubusercontent.com/torch/rocks/master/paths-scm-1.rocksp
Cloning into 'paths'...
remote: Counting objects: 10, done.
remote: Compressing objects: 100% (9/9), done.
remote: Total 10 (delta 0), reused 5 (delta 0), pack-reused 0
Receiving objects: 100% (10/10), 12.81 KiB | 0 bytes/s, done.
Checking connectivity... done.
cmake -E make_directory build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Rele
gram Files (x86)/lua/5.3/include/" -DLUA_LIBDIR="C:/Program Files (x86)/lua/5
uaRockssystree/lib/luarocks/rocks/paths/scm-1/lua" -DLIBDIR="C:Program File
/paths/scm-1/lib" -DCMAKE_INSTALL_PREFIX="C:Program Files (x86)LuaRockssys
gw32-make
-- Building for: NMake Makefiles
CMake Warning in :
  To use the NMake generator, cmake must be run from a shell that can use the
  compiler cl from the command line.  This environment does not contain
  INCLUDE, LIB, or LIBPATH, and these must be set for the cl compiler to
  work.

-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error in :
  The CMAKE_C_COMPILER:
    cl
  is not a full path and was not found in the PATH.
  Tell CMake where to find the compiler by setting either the environment
  variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
  the compiler, or to the compiler name if it is in the PATH.

CMake Error in :
  The CMAKE_CXX_COMPILER:
    cl
  is not a full path and was not found in the PATH.
  Tell CMake where to find the compiler by setting either the environment
  variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
  to the compiler, or to the compiler name if it is in the PATH.

我不知道cl编译器在哪里,甚至我的系统上是否有它。关于我的PATH变量,它显然是一个用户变量,而不是系统变量(我没有系统PATH变量)。我不知道这有什么问题。它现在看起来像这样:

C:UsersUSERNAMEAppDataRoamingnpm;C:MinGWbin;C:Program Files (x86)lua5.3bin;CProgram Files (x86)LuaRocks2.2;C:UsersUSERNAMEAppDataRoamingLuaRocksbin;C:Program Files (x86)LuaRockssystreebin

我不知道这是否正确,但如果它是为了让我从各自的bin目录外运行lua或luarocks,它就会失败。如果有人有更简单的方法在Windows上安装Torch,请让我知道(或检查,甚至是在虚拟机中启用GPU加速的方法)。

cl是Visual Studio的命令行编译器。CMake正在寻找它作为其默认设置使用它。要使用您拥有的mingw,您需要提供一个额外的选项(如我在这里所描述的),但是我不确定如何将它传递给luarocks,因为我通常直接从命令行执行。

你可以试着按照我链接的答案中的步骤去做;火炬票证上有详细说明。简而言之,这些步骤包括:

  1. 克隆、编译并安装火炬/路径;
  2. 克隆、编译并安装torch/cwrap;
  3. 克隆、编译并安装torch/torch;请确保您获取最新的代码,因为它包含了我为mingw编译所提交的更改。
  4. 克隆、编译并安装torch/nn。查看这张票中的讨论,您可能需要申请一个更改。

票证还提供了可以从命令行运行编译的特定命令。

最新更新