Installing PyTorch under conda fails with permissions error and Rolling back transaction
Solution 1
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
Note: You can use any name instead of py_env
Thanks
Solution 2
What is your platform?
For your first installation method, the error message says that you don't have the permission. I encountered that error before on a Linux system. The reason was that Anaconda was installed by another user. I configured the path to point python to that installation so that I could run python without installing my own copy of Anaconda. However, it didn't permit me installing new packages and I got the same error message.
Solution: I installed my own copy of Anaconda and everything worked.
Solution 3
just run:
pip install torch torchvision
RussAbbott
Updated on July 26, 2022Comments
-
RussAbbott almost 2 years
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:\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
But then this.
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')
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.
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.
But when I do that and search for PyTorch, I eventually find myself back at the original instructions.
When I search for Torchvision, no Windows versions are listed.
-
OnePunchMan about 5 yearscould you please tell how to install the pytorch-cpu and torchvision-cpu without using conda. I have created a virtual environment, I want to install it there. (CPU machine, Ubuntu 16.04, NO CUDA support). Thanks.