-
安装torch
2020-08-13 10:11:46安装torch 直接运行conda/pip install torch安装不成功,参考https://www.cnblogs.com/andrew-address/p/12733669.html,pip install torch1.4.0+cpu torchvision0.5.0+cpu -f ...安装torch
直接运行conda/pip install torch安装不成功,参考https://www.cnblogs.com/andrew-address/p/12733669.html,pip install torch1.4.0+cpu torchvision0.5.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
pip install torch==1.4.0+cpu torchvision==0.5.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
使用该命令即可安装成功。
-
安装Torch
2019-06-21 21:03:23安装Torch7,按照官网操作,运行./install.sh时报错: ** 参考:http://www.pianshen.com/article/5473287386/ 2 errors detected in the compilation of "/tmp/tmpxft_00001b24_00000000-6_THCTensorMath.cpp1.ii"....**
安装Torch7,按照官网操作,运行
./install.sh
时报错:**
参考:http://www.pianshen.com/article/5473287386/2 errors detected in the compilation of "/tmp/tmpxft_00001b24_00000000-6_THCTensorMath.cpp1.ii". CMake Error at THC_generated_THCTensorMath.cu.o.cmake:267 (message): Error generating file /home/itl/Torch7/distro/extra/cutorch/build/lib/THC/CMakeFiles/THC.dir//./THC_generated_THCTensorMath.cu.o lib/THC/CMakeFiles/THC.dir/build.make:112: recipe for target 'lib/THC/CMakeFiles/THC.dir/THC_generated_THCTensorMath.cu.o' failed make[2]: *** [lib/THC/CMakeFiles/THC.dir/THC_generated_THCTensorMath.cu.o] Error 1 CMakeFiles/Makefile2:172: recipe for target 'lib/THC/CMakeFiles/THC.dir/all' failed make[1]: *** [lib/THC/CMakeFiles/THC.dir/all] Error 2 Makefile:127: recipe for target 'all' failed make: *** [all] Error 2
解决方案
当前版本cuda与torch不兼容,设置一下环境变量
export TORCH_NVCC_FLAGS="-D__CUDA_NO_HALF_OPERATORS__"
然后执行
./clean.sh #删除之前的安装文件
再重新安装
./install.sh source ~/.bashrc #使环境变量生效
检查
th
-
python如何安装torch_Python安装torch模块报错处理
2021-01-29 18:42:48Python安装torch模块报错处理前言安装报错解决查找文档解决方案安装 torch等待安装完成安装 torchvision提示安装完成总结前言因python项目上线,需要在海外服务器上安装指定torch模块安装根据官网...Python安装torch模块报错处理
前言
安装
报错
解决
查找文档
解决方案
安装 torch
等待安装完成
安装 torchvision
提示安装完成
总结
前言
因python项目上线,需要在海外服务器上安装指定torch模块
安装
根据官网https://pytorch.org/安装提示,执行pip3 install即可。
pip3 install torch torchvision
但安装过程中发生报错,尝试多次执行pip3 install torch torchvision,仍会重置下载。
报错
$ pip3 install torch
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
Looking in indexes: http://ap-south-1.mirrors.cloud.aliyuncs.com/pypi/simple/
Collecting torch
Downloading http://ap-south-1.mirrors.cloud.aliyuncs.com/pypi/packages/62/01/457b49d790b6c4b9720e6f9dbbb617692f6ce8afdaadf425c055c41a7416/torch-1.5.1-cp36-cp36m-manylinux1_x86_64.whl (753.2 MB)
|████████▊ | 206.4 MB 48 kB/s eta 3:06:38ERROR: Exception:
Traceback (most recent call last):
File "/data/python3/lib/python3.6/site-packages/pip/_vendor/urllib3/response.py", line 425, in _error_catcher
yield
File "/data/python3/lib/python3.6/site-packages/pip/_vendor/urllib3/response.py", line 507, in read
data = self._fp.read(amt) if not fp_closed else b""
File "/data/python3/lib/python3.6/http/client.py", line 449, in read
n = self.readinto(b)
File "/data/python3/lib/python3.6/http/client.py", line 493, in readinto
n = self.fp.readinto(b)
File "/data/python3/lib/python3.6/socket.py", line 586, in readinto
return self._sock.recv_into(b)
socket.timeout: timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/data/python3/lib/python3.6/site-packages/pip/_internal/cli/base_command.py", line 188, in _main
status = self.run(options, args)
File "/data/python3/lib/python3.6/site-packages/pip/_internal/cli/req_command.py", line 185, in wrapper
return func(self, options, args)
File "/data/python3/lib/python3.6/site-packages/pip/_internal/commands/install.py", line 333, in run
reqs, check_supported_wheels=not options.target_dir
File "/data/python3/lib/python3.6/site-packages/pip/_internal/resolution/legacy/resolver.py", line 179, in resolve
discovered_reqs.extend(self._resolve_one(requirement_set, req))
File "/data/python3/lib/python3.6/site-packages/pip/_internal/resolution/legacy/resolver.py", line 362, in _resolve_one
abstract_dist = self._get_abstract_dist_for(req_to_install)
File "/data/python3/lib/python3.6/site-packages/pip/_internal/resolution/legacy/resolver.py", line 314, in _get_abstract_dist_for
abstract_dist = self.preparer.prepare_linked_requirement(req)
File "/data/python3/lib/python3.6/site-packages/pip/_internal/operations/prepare.py", line 469, in prepare_linked_requirement
hashes=hashes,
File "/data/python3/lib/python3.6/site-packages/pip/_internal/operations/prepare.py", line 259, in unpack_url
hashes=hashes,
File "/data/python3/lib/python3.6/site-packages/pip/_internal/operations/prepare.py", line 130, in get_http_url
link, downloader, temp_dir.path, hashes
File "/data/python3/lib/python3.6/site-packages/pip/_internal/operations/prepare.py", line 281, in _download_http_url
for chunk in download.chunks:
File "/data/python3/lib/python3.6/site-packages/pip/_internal/cli/progress_bars.py", line 166, in iter
for x in it:
File "/data/python3/lib/python3.6/site-packages/pip/_internal/network/utils.py", line 39, in response_chunks
decode_content=False,
File "/data/python3/lib/python3.6/site-packages/pip/_vendor/urllib3/response.py", line 564, in stream
data = self.read(amt=amt, decode_content=decode_content)
File "/data/python3/lib/python3.6/site-packages/pip/_vendor/urllib3/response.py", line 529, in read
raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
File "/data/python3/lib/python3.6/contextlib.py", line 100, in __exit__
self.gen.throw(type, value, traceback)
File "/data/python3/lib/python3.6/site-packages/pip/_vendor/urllib3/response.py", line 430, in _error_catcher
raise ReadTimeoutError(self._pool, None, "Read timed out.")
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='ap-south-1.mirrors.cloud.aliyuncs.com', port=80): Read timed out.
解决
查找文档
https://blog.csdn.net/chr1341901410/article/details/80995451
解决方案
PACKAGE修改成所需要安装的模块
pip install PACKAGE -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
安装 torch
pip3 install torch -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
等待安装完成
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
Looking in indexes: http://pypi.douban.com/simple
Collecting torch
Downloading http://pypi.doubanio.com/packages/62/01/457b49d790b6c4b9720e6f9dbbb617692f6ce8afdaadf425c055c41a7416/torch-1.5.1-cp36-cp36m-manylinux1_x86_64.whl (753.2 MB)
|████████████████████████████████| 753.2 MB 13.3 MB/s
Requirement already satisfied: numpy in /data/python3/lib/python3.6/site-packages (from torch) (1.19.0)
Collecting future
Downloading http://pypi.doubanio.com/packages/45/0b/38b06fd9b92dc2b68d58b75f900e97884c45bedd2ff83203d933cf5851c9/future-0.18.2.tar.gz (829 kB)
|████████████████████████████████| 829 kB 97.0 MB/s
Using legacy setup.py install for future, since package 'wheel' is not installed.
Installing collected packages: future, torch
Running setup.py install for future ... done
WARNING: The scripts convert-caffe2-to-onnx and convert-onnx-to-caffe2 are installed in '/data/python3/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed future-0.18.2 torch-1.5.1
安装 torchvision
pip3 install torchvision -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
提示安装完成
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
Looking in indexes: http://pypi.douban.com/simple
Collecting torchvision
Downloading http://pypi.doubanio.com/packages/9a/f1/535a407b4a265adf2dd7c2c2458217e37c5fe83ec97234e66c564592a9a0/torchvision-0.6.1-cp36-cp36m-manylinux1_x86_64.whl (6.6 MB)
|████████████████████████████████| 6.6 MB 985 kB/s
Requirement already satisfied: numpy in /data/python3/lib/python3.6/site-packages (from torchvision) (1.19.0)
Requirement already satisfied: pillow>=4.1.1 in /data/python3/lib/python3.6/site-packages (from torchvision) (7.2.0)
Requirement already satisfied: torch==1.5.1 in /data/python3/lib/python3.6/site-packages (from torchvision) (1.5.1)
Requirement already satisfied: future in /data/python3/lib/python3.6/site-packages (from torch==1.5.1->torchvision) (0.18.2)
Installing collected packages: torchvision
Successfully installed torchvision-0.6.1
总结
个人认为国内服务器和部分海外服务器安装相关模块不会出现这种情况。可以通过这种方法解决类似问题。
-
关于安装torch模块的一些问题
2020-07-24 10:10:56关于安装torch模块的一些问题 大家好! 这是你第一次分享关于python相关的内容,有不理解的地方,可以留言告知。 PyTorch PyTorch是一个开源的Python机器学习库,基于Torch,用于自然语言处理等应用程序。身为小白的...关于安装torch模块的一些问题
大家好! 这是你第一次分享关于python相关的内容,有不理解的地方,可以留言告知。
PyTorch
PyTorch是一个开源的Python机器学习库,基于Torch,用于自然语言处理等应用程序。身为小白的作者前一阵子开始学习python,在网上有稍微看了一些资料,其中就包括PyTorch,用来做机器学习。
作者昨晚精疲力竭,大脑混乱,实在没有导入成功PyTorch。pip失败,pycharm下载PyTorch也失败。另外昨晚还帮助一些小伙伴答疑解惑到凌晨两点多。
所以今天早上再战
准备
事先还先整了一份简单的word,用来记录我安装PyTorch的过程
讲真,在我们pip下载失败的时候,是都会想到会不会是源的问题,但是作者添加过了,还是失败。
官方地址内的操作
那重点来了:ModuleNotFoundError: No module named ‘tools.nnwrap’
遇到这个问题呢,作者是建议直接去官方网站选择适合自己电脑配置的,https://pytorch.org/ 这是官方链接。
进入官网后,向下滑动,我们可以看到简单的配置选项,选择我们所需要的
(重点!!!建议看完,因为这个很慢!!!)
那翻译一下:
OK,就这样复制,cmd打开,粘贴。ENT啪的一声
内心激动啊,额 这网络!我得下到什么时候,行吧,放弃了。
好在聪明机智的我找到了他们的下载地址:https://download.pytorch.org/whl/torch_stable.html
进入这个官方下载稳定版网址,先使用pip试用下载 看看自己电脑所相对应的版本,然后调用迅雷下载
最后
那在最后呢,我们进入文件夹的地址栏 cmd
pip install 加上文件名,注意!后缀要加上两个都使用pip下载好后,我们还可以使用pip list 进行查看
大功告成!补充
这两天作者把机械磁盘整合成一个盘
今天重新安装 出现一个问题
那在这呢 也就是缺少了numpy模块,所以百度搜索一下
pip install numpy -i https://mirrors.aliyun.com/pypi/simple/
pip安装的模块包不在自己的site-packages\中?!
那这边 作者才发现自己没设置好 安装的包全不在自己定的D盘的\Lib\site-packages文件夹中,全去了\AppData\Roaming\python\python38\site-packages\
通过python -m site命令查看
我们看见这里的USER_SITE和USER_BASE其实就是用户自定义的启用Python脚本和依赖安装包的基础路径。 哎,我这边没定义,是None。
必须要改。我还以为什么情况,这次安装python环境后,老是说权限不够?!
USER_SITE 没有填选,默认调用C盘路径下的python.exe中的脚本pip文件去下载,就会将site-package的默认安装到这个C盘路径下。
-
安装torch-sparse
2020-12-09 21:55:31安装torch-sparse -
安装 torch 问题
2021-02-19 09:05:32使用pycharm安装torch 提示Command errored out with exit status 1: 点击detail 发现 File "c:\users\nn\appdata\local\temp\pip-install-61_cs4\torch\setup.py", line 51, in run from tools.nnwrap import ... -
linux下安装torch
2019-06-05 10:30:36linux安装torch安装anaconda安装cudatoolkit安装torch 安装anaconda 有教程,创建一个虚拟环境。conda命令首先需要source ~/.bashrc进行激活。 安装cudatoolkit torch-gpu需要在cuda下安装,首先安装cudatoolkit,... -
windows安装torch报错
2021-01-01 11:05:50description 虚拟机实在太卡了,打算现在win上跑一下pytorch,在win10安装torch时候又报错 solving 正常上网 用管理员模式运行cmd才能安装torch 需要更新pip,同样需要管理员模式 gossip 中午吃啥呀~ -
win10安装torch
2018-12-21 15:53:54最近由于搞风格迁移,于是去https://github.com/FlyingGoblin/CartoonGAN下载了工程,结果一看,需要安装torch 从作者提供的链接https://github.com/torch/distro进去 把工程clone下来,我放到了D:\torch, ... -
ubuntu 安装 torch ,报错no module named torch
2020-12-31 14:43:30按照pytorch官网操作,安装torch,显示安装成import果,但使用import验证时报错no module named torch 解决路径 1. 使用pycharm尝试 在pycharm里尝试import torch,同样报错 no module 2.多版本python绑定问题 在... -
win安装torch torchvision
2020-11-10 15:20:41试了很多种办法都无法安装torch, 总结一下, 没有办法使用网络资源通过pip或者conda安装到torch, 建议先下载下来再从本地资源上加载.whl文件安装。 https://download.pytorch.org/whl/torch_stable.html 从这个网站上... -
安装torch_scatter,torch-sparse,torch-cluster,torch-spline-conv,torch-geometric
2020-12-08 22:10:51最近在学一个关于GNN的项目,需要安装torch_scatter,torch-sparse,torch-cluster,torch-spline-conv,torch-geometric。可以说安装这个花费了将近一天的时间,所以将安装的心路记录下来,如果下次再次安装,可以少踩... -
windows安装torch_sparse\torch_geometric\torch_cluster
2020-09-07 08:33:02如我要安装torch_sparse,安装环境是python3.6, pytorch1.4版本(这个影响不大), 没有Gpu,那么我选择了红色框出来的这个版本进行下载安装。下载后进入到该文件所在的目录下,并安装。如下图命令: 因为我安装完了,... -
安装torch_geometric
2020-11-05 16:26:48安装torch_geometric 安装完torch后,下载轮子(注意版本cuda python) isodate:下载链接 https://pypi.org/project/isodate/#files rdflib:下载链接 https://pypi.org/project/rdflib/#files plyfile:下载链接 ... -
ubuntu16.04安装torch
2017-08-29 16:38:36下载torch安装包: git clone https://github.com/torch/distro.git torch -... sudo bash install-deps安装好后会提示:Torch7’s dependencies have been installed安装torch:sudo ./install.sh 安装到最后会提示是否将 -
安装torch-opencv
2017-05-13 17:09:00安装torch-opencvtorch torch-opencvopencv-3.1.0 opencv-contrib想在torch中使用光流法,于是就希望能够调用opencv中的光流代码,而torch中对opencv-3.1.0进行了封装,即torch-opencv包,如果仅仅安装opencv3.1,... -
ubuntu16.04安装torch torchvision
2020-07-21 18:51:27ubuntu16.04安装torch torchvision 1.安装torch0.4.1 Via pip 找到对应的网站下载whl文件 #CPU-only build https://download.pytorch.org/whl/cpu/torch_stable.html #CUDA 8.0 build ...#CUDA 9.0 build ... -
windows系统安装torch1.5
2020-05-08 14:17:45比如我在windows系统下安装torch1.5会给出命令: pip install torch==1.5.0+cpu torchvision==0.6.0+cpu -f https://download.pytorch.org/whl/torch_stable.html 按照给出的命令运行即可 如果想要下载之前的老... -
安装torch环境笔记
2019-09-23 09:22:51安装torch环境可以参考: https://blog.csdn.net/zhangxin4832/article/details/79219192 https://blog.csdn.net/xiaozhun07/article/details/49865785 torch.ch/docs/getting-started.html 出现Package python-... -
Python安装torch库失败
2020-09-11 10:25:17Python安装torch库失败 1. 安装中遇到的坑 直接在pycharm中点击file>setting>project>project interpreter 结果:安装失败 在命令窗口输入pip install torch 结果:还是安装失败 2. 简便示例 在命令窗口... -
python3.6.0 安装 torch
2020-05-03 11:31:31我经过多次尝试,发现 python3.6.0 不能够直接安装 torch,需要对 python 进行升级,这里有两个版本的 python. 链接: https://pan.baidu.com/s/1SujKAKp6jUoTJ8XHF3ioZQ 提取码: 8kg9 python 会问你是更新还是重新... -
Ubuntu14.04安装Torch
2018-05-29 22:03:56(1) 安装torchgit clone https://github.com/torch/distro.git ~/torch --recursive(2) 进入torch文件夹,打开并执行install-deps中的命令cd ~/torch bash install-deps (3) 执行install.sh文件./install.sh... -
安装 torch_geometric有感
2021-02-01 18:21:03安装torch pip install torch-1.4.0+cu100-cp36-cp36m-linux_x86_64.whl 【https://download.pytorch.org/whl/cu100/torch_stable.html】 安装torchvision pip install torchvision-0.5.0+cu100-cp36-cp -
ubuntu下面配置安装torch
2017-03-25 13:34:00ubuntu安装torch -
如何安装torch-sparse
2020-02-20 22:34:47如何安装torch-sparse 科研之路遇到的问题与自己如何解决的~ 2020年2月20日,准备用GAT解决一些问题,在网上找到了可以调用GAT的API----torch-geometric,这个包里面实现了GAT,可以直接调用它,然而在安装这个包的...
-
Java中Scanner的进阶---求和与求平均数
-
MySQL 多实例安装 及配置主从复制实验环境
-
EaUS Video Editor(视频剪辑软件)官方中文版V1.6.8.53
-
马士兵老师HashMap学习笔记
-
PlantCARE_24263__plantCARE.tar.gz
-
实现 MySQL 读写分离的利器 mysql-proxy
-
在 Linux 上构建企业级 DNS 域名解析服务
-
机器学习可视化软件机器学习可视化软件
-
php底层原理
-
Visual Studio 2019生成JSON/XM类
-
应广105G雾化片驱动.rar
-
vagrant_2.2.5的64位版本
-
中文分词词典UserDict.txt
-
深究字符编码的奥秘,与乱码说再见
-
MySQL 管理利器 mysql-utilities
-
电机+L298Nmain.c
-
DES的ECB加密解密汇总.zip
-
MySQL 高可用工具 heartbeat 实战部署详解
-
投标方法论
-
static详解