pytorch学习笔记(十五):pytorch 源码编译碰到的坑总结
来源:互联网 发布:英国普利茅斯大学 知乎 编辑:程序博客网 时间:2024/06/05 07:38
2017.11.17
最近打算学习一下 pytorch
源码,所以按照官网的教程从头编译了一下 pytorch
。在编译的过程中,碰到了两个坑,在这里记录一下。
源码编译流程
- 需要 anaconda
- 如果要编译cuda 版本的话 CUDA7.5 及以上。Cudnn 6 及以上
- 如果不想编译 cuda 版本的话:命令行执行
export NO_CUDA=1
1. export CMAKE_PREFIX_PATH="$(dirname $(which conda))/../"2. conda install numpy pyyaml mkl setuptools cmake cffi3. conda install -c soumith magma-cuda80 (这个可装可不装)4. git clone --recursive https://github.com/pytorch/pytorch (下载源码)5. cd pytorch6. python setup.py install (坐等编译安装 完毕。)
以下是碰到的几个错误
- 第一个错误
CMakeFiles/Makefile2:264: recipe for target 'src/ATen/test/CMakeFiles/scalar_test.dir/all' failedmake[1]: *** [src/ATen/test/CMakeFiles/scalar_test.dir/all] Error 2Makefile:127: recipe for target 'all' failedmake: *** [all] Error 2
解决方法是:(由于我是 ubuntu16.04 编译的, gcc 默认的版本是 5.4,但是用 4.9 编译就不会有问题)sudo apt install gcc-4.9 g++-4.9export CC="gcc-4.9"export CXX="g++-4.9"# change to pytorch directorypython setup.py cleanpython setup.py install
- 第二个错误:(编译安装成功后, import torch 时报这个错)
libstdc++.so.6: version `GLIBCXX_3.4.21' not found
解决方法:conda install libgcc 然后再 import 就没问题了
- 第三个错误(编译安装成功后,import torch 时报的错)
ModuleNotFoundError: No module named 'torch._C'
这个错误是 因为 我直接在 `pytorch/` 源码路径下打开的 `ipython`。 `cd` 出来就好了the problem is that you have a folder called torch in the same directory which is being picked up. Do this: cd .. (to change directory), and then start python and import torch, it should work.
阅读全文
0 0
- pytorch学习笔记(十五):pytorch 源码编译碰到的坑总结
- Pytorch学习笔记(一):pytorch的安装-Ubuntu14.04
- pytorch学习笔记(1)--pytorch张量
- pytorch学习笔记(七):pytorch hook 和 关于pytorch backward过程的理解
- pytorch学习笔记(七):pytorch hook 和 关于pytorch backward过程的理解
- Pytorch学习笔记(一)
- Pytorch学习笔记(二)
- Pytorch学习笔记(三)
- Pytorch学习笔记(四)
- Pytorch学习笔记(五)
- Pytorch学习笔记(六)
- pytorch学习笔记(十四): DataLoader源码阅读
- pytorch学习笔记(九):PyTorch结构介绍
- pytorch学习笔记(九):PyTorch结构介绍
- pytorch学习笔记(十七):python 端扩展 pytorch
- pytorch学习笔记(十八):C 语言扩展 pytorch
- pytorch学习总结
- pytorch 学习笔记(一)
- 开发者和工程师的区别?
- 唯快不破:TIME_WAIT重用与RFC1337
- git 管理多个私钥
- 网易2017秋招编程题:最大奇约束 [python]
- ajaxupload返回带有pre标签的数据处理方法
- pytorch学习笔记(十五):pytorch 源码编译碰到的坑总结
- 文章标题
- 从概念到案例:初学者须知的十大机器学习算法
- 解密ln( )函数
- sqlite C++ 的sqlite3_get_table函数使用
- 网易2017秋招编程题:计算糖果 [python]
- ADB server didn't ACK * failed to start daemon *
- 自总结Linux命令
- qduoj 196 李院长发红包