I am not able to install pytorch or torchvision using conda.
Below is the stacktrace:
$ conda install pytorch torchvision -c pytorch
Solving environment: done
## Package Plan ##
environment location: /home/ubuntu/anaconda3
added / updated specs:
- pytorch
- torchvision
The following NEW packages will be INSTALLED:
ninja: 1.8.2-py37h6bb024c_1
pytorch: 0.4.1-py37_py36_py35_py27__9.0.176_7.1.2_2 pytorch
torchvision: 0.2.1-py37_1 pytorch
Proceed ([y]/n)? y
Preparing transaction: failed
# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<
Traceback (most recent call last):
File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/conda/exceptions.py", line 819, in __call__
return func(*args, **kwargs)
File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/conda/cli/main.py", line 78, in _main
exit_code = do_call(args, p)
File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/conda/cli/conda_argparse.py", line 77, in do_call
exit_code = getattr(module, func_name)(args, parser)
File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/conda/cli/main_install.py", line 11, in execute
install(args, parser, 'install')
File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/conda/cli/install.py", line 253, in install
handle_txn(unlink_link_transaction, prefix, args, newenv)
File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/conda/cli/install.py", line 282, in handle_txn
unlink_link_transaction.execute()
File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/conda/core/link.py", line 223, in execute
self.verify()
File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/conda/common/io.py", line 46, in decorated
return f(*args, **kwds)
File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/conda/core/link.py", line 200, in verify
self.prepare()
File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/conda/core/link.py", line 192, in prepare
stp.remove_specs, stp.update_specs)
File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/conda/core/link.py", line 282, in _prepare
mkdir_p(transaction_context['temp_dir'])
File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/conda/gateways/disk/__init__.py", line 60, in mkdir_p
makedirs(path)
File "/home/ubuntu/anaconda3/lib/python3.7/os.py", line 221, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/home/ubuntu/anaconda3/.condatmp'
`$ /home/ubuntu/anaconda3/bin/conda install pytorch torchvision -c pytorch`
environment variables:
CIO_TEST=<not set>
CONDA_DEFAULT_ENV=base
CONDA_EXE=/home/ubuntu/anaconda3/bin/conda
CONDA_PREFIX=/home/ubuntu/anaconda3
CONDA_PROMPT_MODIFIER=
CONDA_PYTHON_EXE=/home/ubuntu/anaconda3/bin/python
CONDA_ROOT=/home/ubuntu/anaconda3
CONDA_SHLVL=1
LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64:
PATH=/usr/local/cuda-9.0/bin:/home/ubuntu/bin:/home/ubuntu/.local/bin:/home
/ubuntu/anaconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bi
n:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
REQUESTS_CA_BUNDLE=<not set>
SSL_CERT_FILE=<not set>
active environment : base
active env location : /home/ubuntu/anaconda3
shell level : 1
user config file : /home/ubuntu/.condarc
populated config files :
conda version : 4.5.11
conda-build version : 3.15.1
python version : 3.7.0.final.0
base environment : /home/ubuntu/anaconda3 (read only)
channel URLs : https://conda.anaconda.org/pytorch/linux-64
https://conda.anaconda.org/pytorch/noarch
https://repo.anaconda.com/pkgs/main/linux-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/free/linux-64
https://repo.anaconda.com/pkgs/free/noarch
https://repo.anaconda.com/pkgs/r/linux-64
https://repo.anaconda.com/pkgs/r/noarch
https://repo.anaconda.com/pkgs/pro/linux-64
https://repo.anaconda.com/pkgs/pro/noarch
package cache : /home/ubuntu/anaconda3/pkgs
/home/ubuntu/.conda/pkgs
envs directories : /home/ubuntu/.conda/envs
/home/ubuntu/anaconda3/envs
platform : linux-64
user-agent : conda/4.5.11 requests/2.19.1 CPython/3.7.0 Linux/4.15.0-36-generic ubuntu/16.04 glibc/2.23
UID:GID : 1000:1000
netrc file : None
offline mode : False
An unexpected error has occurred. Conda has prepared the above report.
If submitted, this report will be used by core maintainers to improve
future releases of conda.
Would you like conda to send this report to the core maintainers?
[y/N]:
No report sent. To permanently opt-out, use
$ conda config --set report_errors false
The sure proof way would be to
sudo /home/ubuntu/anaconda3/bin/conda install pytorch torchvision -c pytorch
But this is venturing in some pretty messy territory.
I’d suggest 2 alternative options,
The best way to do this is do a user installation of anaconda3
such that which conda
returns $HOME/anaconda3/bin/conda
The other way is to do
conda create -n yourenvname python=x.x
and call
conda activate yourenvname
when you wish to use your environment
Both options will separate you completely from the anaconda in /home/ubuntu/anaconda3
. Probably someone has been tempering with it. Best to restrict the management of environments away from others thereby preventing these sort of errors from happening