caffe2 icon indicating copy to clipboard operation
caffe2 copied to clipboard

Python dedent failed

Open Angel-Jia opened this issue 6 years ago • 16 comments

System information

  • Operating system: win10
  • Compiler version: VS 2015
  • CMake version: 3.10.1
  • CMake arguments:
  • Relevant libraries/versions (e.g. CUDA): cuda 8.0

CMake summary output

I am installing caffe2 on win10 and it takes me almost a whole day. There are many missing argvs and errors in build_windows.bat. I doubt that the script has not been tested before. Now I have another problem afer executing build_windows.bat: ERROR Failed to remove indentation from: """

  from distutils import sysconfig
  print(sysconfig.get_python_lib(prefix=''))

""" Python dedent failed with error code: 系统找不到指定的文件。(system can not find specified file) CMake Error at cmake/Utils.cmake:177 (message): Python dedent failed with error code: 系统找不到指定的文件。(system can not find specified file) Call Stack (most recent call first): cmake/Utils.cmake:200 (dedent) caffe2/CMakeLists.txt:145 (pycmd)

Is anybody can help?

Angel-Jia avatar Mar 06 '18 05:03 Angel-Jia

@Mabinogiysk what file can it not find? I've never seen this error on Windows before. It should be possible to build GPU on Windows (we've done it), but our coverage of different Windows configurations isn't that great right now.

pjh5 avatar Mar 09 '18 17:03 pjh5

Hi, I have the same problem to you. Are you chagning " -DBUILD_PYTHON=OFF^" to " -DBUILD_PYTHON=ON^", and then the error is coming?

Kasdision avatar Mar 10 '18 16:03 Kasdision

I have submitted a pull request to modify the utility function for dedent to fix this issue https://github.com/caffe2/caffe2/pull/2228

bengaspar avatar Mar 10 '18 17:03 bengaspar

使用mingw64进入caffe2源码目录,执行scripts/build_windows.bat,其中会有报错,修改下源码就行,抱歉!不太会组织英文 建议使用msys2,在快捷方式上修改成D:\msys64\msys2_shell.cmd -mingw64 -use-full-path,增加-use-full-path参数,目的为了使用windows宿主的环境,windows下cmake加入path环境 报错位置修改: conv_op_cudnn.cc line:195,删除#if CUDNN_VERSION_MIN(6, 0, 0)以及下面的#endif line:210,删除#if CUDNN_VERSION_MIN(6, 0, 0)以及下面的#endif line:335同上 line:350同上 caffe2\caffe2\operators\op_utils_cudnn.h line:66,enum { ALGO_FWD = 0, ALGO_WGRAD = 1, ALGO_DGRAD = 2 } algoIndex_t;修改为 enum algoIndex_enum { ALGO_FWD = 0, ALGO_WGRAD = 1, ALGO_DGRAD = 2 };

lbhnrg2021 avatar Mar 12 '18 02:03 lbhnrg2021

@lbhnrg2021 你这个没有把 build python 设置为on吧

anguoyang avatar Mar 14 '18 09:03 anguoyang

@anguoyang 我编译成功的,是把编译出错的地方分享下:),好像最新的没编译错误问题,python是打开的

lbhnrg2021 avatar Mar 14 '18 09:03 lbhnrg2021

@lbhnrg2021 你可以编译出caffe2_pybind11_state.dll 么?

anguoyang avatar Mar 14 '18 09:03 anguoyang

@lbhnrg2021 请问你能把windows编译好的caffe2-GPU版本共享一下吗?我怀疑我下载的源码缺失文件

Jone666 avatar Mar 15 '18 15:03 Jone666

@lbhnrg2021 python的问题解决了,有位朋友前几天打了个patch,你替换一下这个文件即可: https://github.com/caffe2/caffe2/commit/304cfe473380ed8b8ea347dfc1e1f4054fe3c3af 不过还有其他错误: https://github.com/caffe2/caffe2/issues/2029

anguoyang avatar Mar 16 '18 00:03 anguoyang

@Kasdision Hi, I have the same problem to you.When i changed " -DBUILD_PYTHON=OFF^" to " -DBUILD_PYTHON=ON^", and then the error came.How do you solve the problem

miaoshuyu avatar Mar 26 '18 04:03 miaoshuyu

@Jone666 源码其实没问题的,编译出来的有点大,不好发!好像是git clone到中文windows出现编码问题,所以python找不到路径,可以用msys2中的mingw64进行编译的,不要安装msys2的包,使用mingw64和宿主系统的path环境相互集成就行,我是这么编译出来的,你可以试试,确实有点繁琐,不过流程熟悉就没太大问题,有问题我们探讨!

lbhnrg2021 avatar Apr 02 '18 02:04 lbhnrg2021

@Jone666 msys2中MinGW 64-bit快捷方式我加了一个命令参数,全部如下: D:\msys64\msys2_shell.cmd -mingw64 -use-full-path 主要是:-use-full-path gpu版本我有一段时间没更新master了(不知道修复没),可能有几处错误,换换写法就能编译通过,我上面回复中写 对了,third_party目录里的模块最好全部pull下来

lbhnrg2021 avatar Apr 02 '18 02:04 lbhnrg2021

@lbhnrg2021 你好,我之前是使用cmake编译的有问题,不知道如何使用mingw64进行编译,不知可否进行详细介绍

miaoshuyu avatar Apr 02 '18 03:04 miaoshuyu

@miaoshuyu 直接在中文windows下肯定有问题,你下个msys2有介绍的,看你英文不错,能看懂的,我上面的回复是我编译通过的方法,可以试试的 千万不要下载安装msys2的内部工具包,msys2_shell.cmd -mingw64 -use-full-path直接使用宿主系统的环境,不然也编译不了

lbhnrg2021 avatar Apr 02 '18 03:04 lbhnrg2021

@lbhnrg2021 好的,谢谢,我试试~

miaoshuyu avatar Apr 02 '18 03:04 miaoshuyu

This issue has been solved by the pull request on PyTorch repo https://github.com/pytorch/pytorch/pull/6296

harrysummer avatar Apr 16 '18 18:04 harrysummer