提问者:小点点

在conda下安装PyTorch失败,出现权限错误并回滚事务


我想在Python程序中使用PyTorch。安装说明需要conda。安装Conda后,我运行了:

>conda install -c pytorch pytorch (as instructed on the PyTorch [page][1])

它看起来很有希望——直到最后。

Solving environment: done

## Package Plan ##

  environment location: C:\ProgramData\Miniconda3

  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在环境中安装它时,我得到了这个错误。

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的替代方法。所以我尝试了。

>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时,我最终发现自己回到了最初的说明。

当我搜索Torchvision时,没有列出Windows版本。


共3个答案

匿名用户

在Windows中尝试以下步骤:

>

创建-npy_envpython=3.5

源代码激活py_env

conda安装pytorch cpu-c pytorch

pip安装torchvision

注意:您可以使用任何名称,而不是py_env

谢谢

匿名用户

你的平台是什么?

对于您的第一个安装方法,错误消息表示您没有权限。我以前在Linux系统上遇到过这个错误。原因是蟒蛇是由另一个用户安装的。我配置了将python指向该安装的路径,这样我就可以运行python而无需安装我自己的Anaconda副本。然而,它不允许我安装新的软件包,我得到了同样的错误消息。

解决方案:我安装了自己的Anaconda副本,一切正常。

匿名用户

只需运行:

pip install torch torchvision