Installing PyTorch under conda fails with permissions error and Rolling back transaction(在 conda 下安装 PyTorch 失败,出现权限错误和回滚事务)
问题描述
我想在 Python 程序中使用 PyTorch.安装它的说明需要 conda.安装 Conda 后,我跑了:
I'd like to use PyTorch in a Python program. The instructions for installing it require conda. After installing Conda I ran:
>conda install -c pytorch pytorch (as instructed on the PyTorch [page][1])
看起来很有希望——直到最后.
It looked promising -- until the end.
Solving environment: done
## Package Plan ##
  environment location: C:ProgramDataMiniconda3
  added / updated specs:
    - pytorch
The following packages will be downloaded:
    package                    |            build
    ---------------------------|-----------------
    icc_rt-2017.0.4            |       h97af966_0         8.0 MB
    vs2015_runtime-15.5.2      |                3         2.2 MB
    pytorch-0.4.0              |py36_cuda80_cudnn7he774522_1       529.2 MB      pytorch
    mkl-2018.0.3               |                1       178.1 MB
    numpy-1.14.5               |   py36h9fa60d3_4          35 KB
    intel-openmp-2018.0.3      |                0         1.7 MB
    numpy-base-1.14.5          |   py36h5c71026_4         3.8 MB
    vc-14.1                    |       h0510ff6_3           5 KB
    blas-1.0                   |              mkl           6 KB
    conda-4.5.8                |           py36_0         1.0 MB
    mkl_fft-1.0.2              |   py36hb217b18_0         113 KB
    mkl_random-1.0.1           |   py36h77b88f5_1         268 KB
    ------------------------------------------------------------
                                           Total:       724.4 MB
The following NEW packages will be INSTALLED:
    blas:           1.0-mkl
    icc_rt:         2017.0.4-h97af966_0
    intel-openmp:   2018.0.3-0
    mkl:            2018.0.3-1
    mkl_fft:        1.0.2-py36hb217b18_0
    mkl_random:     1.0.1-py36h77b88f5_1
    numpy:          1.14.5-py36h9fa60d3_4
    numpy-base:     1.14.5-py36h5c71026_4
    pytorch:        0.4.0-py36_cuda80_cudnn7he774522_1 pytorch
The following packages will be UPDATED:
    conda:          4.5.4-py36_0                               --> 4.5.8-py36_0
    vc:             14-h0510ff6_3                              --> 14.1-h0510ff6_3
    vs2015_runtime: 14.0.25123-3                               --> 15.5.2-3
Proceed ([y]/n)? y
Downloading and Extracting Packages
icc_rt-2017.0.4      |  8.0 MB | ############################################################################## | 100%
vs2015_runtime-15.5. |  2.2 MB | ############################################################################## | 100%
pytorch-0.4.0        | 529.2 MB | ############################################################################# | 100%
mkl-2018.0.3         | 178.1 MB | ############################################################################# | 100%
numpy-1.14.5         |   35 KB | ############################################################################## | 100%
intel-openmp-2018.0. |  1.7 MB | ############################################################################## | 100%
numpy-base-1.14.5    |  3.8 MB | ############################################################################## | 100%
vc-14.1              |    5 KB | ############################################################################## | 100%
blas-1.0             |    6 KB | ############################################################################## | 100%
conda-4.5.8          |  1.0 MB | ############################################################################## | 100%
mkl_fft-1.0.2        |  113 KB | ############################################################################## | 100%
mkl_random-1.0.1     |  268 KB | ############################################################################## | 100%
Preparing transaction: done
Verifying transaction: done
但是这个.
Executing transaction: failed
ERROR conda.core.link:_execute(502): An error occurred while uninstalling package 'defaults::conda-4.5.4-py36_0'.
PermissionError(13, 'Access is denied')
Attempting to roll back.
Rolling back transaction: done
PermissionError(13, 'Access is denied')
显然它至少部分安装了,因为 PyCharm 能够看到它.但是当我让 PyCharm 在某个环境中安装它时,我得到了这个错误.
Apparently it was at least partly installed because PyCharm was able to see it. But when I asked PyCharm to install it in an environment, I got this error.
RuntimeError: PyTorch does not currently provide packages for PyPI (see status at https://github.com/pytorch/pytorch/issues/566).
Please follow the instructions at http://pytorch.org/ to install with miniconda instead.
它提出了另一种安装 PyTorch 的方法.所以我试过了.
It suggests an alternative way to install PyTorch. So I tried that.
>conda install pytorch torchvision -c pytorch
Solving environment: failed
PackagesNotFoundError: The following packages are not available from current channels:
  - torchvision
Current channels:
  - https://conda.anaconda.org/pytorch/win-64
  - https://conda.anaconda.org/pytorch/noarch
  - https://repo.anaconda.com/pkgs/main/win-64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/free/win-64
  - https://repo.anaconda.com/pkgs/free/noarch
  - https://repo.anaconda.com/pkgs/r/win-64
  - https://repo.anaconda.com/pkgs/r/noarch
  - https://repo.anaconda.com/pkgs/pro/win-64
  - https://repo.anaconda.com/pkgs/pro/noarch
  - https://repo.anaconda.com/pkgs/msys2/win-64
  - https://repo.anaconda.com/pkgs/msys2/noarch
To search for alternate channels that may provide the conda package you're
looking for, navigate to
    https://anaconda.org
and use the search bar at the top of the page.
但是当我这样做并搜索 PyTorch 时,我最终发现自己回到了最初的说明.
But when I do that and search for PyTorch, I eventually find myself back at the original instructions.
当我搜索 Torchvision 时,没有列出任何 Windows 版本.
When I search for Torchvision, no Windows versions are listed.
推荐答案
在 Windows 中尝试以下步骤:
Try the following steps in Windows:
使用以下命令创建虚拟环境:
Create a virtual environment using the command :
conda create -n py_env python=3.5
source activate py_env
conda install pytorch-cpu -c pytorch
pip install torchvision 
注意:您可以使用任何名称代替 py_env
Note: You can use any name instead of py_env
谢谢
这篇关于在 conda 下安装 PyTorch 失败,出现权限错误和回滚事务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 conda 下安装 PyTorch 失败,出现权限错误和回滚
				
        
 
            
        - 使用 Cython 将 Python 链接到共享库 2022-01-01
 - CTR 中的 AES 如何用于 Python 和 PyCrypto? 2022-01-01
 - 我如何卸载 PyTorch? 2022-01-01
 - YouTube API v3 返回截断的观看记录 2022-01-01
 - 我如何透明地重定向一个Python导入? 2022-01-01
 - ";find_element_by_name(';name';)";和&QOOT;FIND_ELEMENT(BY NAME,';NAME';)";之间有什么区别? 2022-01-01
 - 检查具有纬度和经度的地理点是否在 shapefile 中 2022-01-01
 - 使用公司代理使Python3.x Slack(松弛客户端) 2022-01-01
 - 如何使用PYSPARK从Spark获得批次行 2022-01-01
 - 计算测试数量的Python单元测试 2022-01-01
 
