tina K
tina K

Reputation: 131

Permission Error For Conda Update

Python newbie here. I have encountered a permission problem with anaconda. Everything runs ok, but I do not seem to be able to update conda, create new environments or install new packages.

When I try to update (conda update conda) it I get:

Fetching package metadata ..... An unexpected error has occurred. Please consider posting the following information to the conda GitHub issue tracker at:

https://github.com/conda/conda/issues

Current conda version:

platform : osx-64
conda version : 4.3.29
conda is private : False
conda-env version : 4.3.29
conda-build version : not installed
python version : 2.7.11.final.0
requests version : 2.14.2
root environment : /anaconda  (writable)
default environment : /anaconda
envs directories : /anaconda/Users/Tina/.conda/envs
package cache : /anaconda/Users/Tina/.conda/pkgs
channel URLs : https://conda.anaconda.org/anaconda-fusion/osx-64
               https://conda.anaconda.org/anaconda-fusion/noarch
               https://repo.continuum.io/pkgs/main/osx-64
               https://repo.continuum.io/pkgs/main/noarch
               https://repo.continuum.io/pkgs/free/osx-64
               https://repo.continuum.io/pkgs/free/noarch
               https://repo.continuum.io/pkgs/r/osx-64
               https://repo.continuum.io/pkgs/r/noarch
               https://repo.continuum.io/pkgs/pro/osx-64
               https://repo.continuum.io/pkgs/pro/noarch
config file : /Users/Tina/.condarc
netrc file : None
offline mode : False
user-agent : conda/4.3.29 requests/2.14.2 CPython/2.7.11 Darwin/15.5.0 OSX/10.11.5    
UID:GID : 501:20

$ /anaconda/bin/conda update conda

Traceback (most recent call last):
  File "/anaconda/lib/python2.7/site-packages/conda/exceptions.py", line 640, in conda_exception_handler
    return_value = func(*args, **kwargs)
  File "/anaconda/lib/python2.7/site-packages/conda/cli/main.py", line 140, in _main
    exit_code = args.func(args, p)
  File "/anaconda/lib/python2.7/site-packages/conda/cli/main_update.py", line 65, in execute
    install(args, parser, 'update')
  File "/anaconda/lib/python2.7/site-packages/conda/cli/install.py", line 231, in install
    unknown=index_args['unknown'], prefix=prefix)
  File "/anaconda/lib/python2.7/site-packages/conda/core/index.py", line 101, in get_index
    index = fetch_index(channel_priority_map, use_cache=use_cache)
  File "/anaconda/lib/python2.7/site-packages/conda/core/index.py", line 120, in fetch_index
    repodatas = collect_all_repodata(use_cache, tasks)
  File "/anaconda/lib/python2.7/site-packages/conda/core/repodata.py", line 75, in collect_all_repodata
    repodatas = _collect_repodatas_serial(use_cache, tasks)
  File "/anaconda/lib/python2.7/site-packages/conda/core/repodata.py", line 485, in _collect_repodatas_serial
    for url, schan, pri in tasks]
  File "/anaconda/lib/python2.7/site-packages/conda/core/repodata.py", line 115, in func
    res = f(*args, **kwargs)
  File "/anaconda/lib/python2.7/site-packages/conda/core/repodata.py", line 467, in fetch_repodata
    touch(cache_path)
  File "/anaconda/lib/python2.7/site-packages/conda/gateways/disk/update.py", line 64, in touch
    utime(path, None)
OSError: [Errno 13] Permission denied: '/anaconda/pkgs/cache/9cd9d6b5.json'```

I get the same error when trying to install seaborn or creating an environment. I am reluctant to use sudo because I do not want to break things.

I do not understand what is going on here, so any help would be highly appreciated.

Thanks so much; T

Upvotes: 2

Views: 10844

Answers (3)

Stephen Cowen
Stephen Cowen

Reputation: 21

For humble Windows users that cannot use sudo: You have to open the conda console as Administrator by right clicking on the console icon and then select run as administrator. Then conda update conda should work fine.

Upvotes: 2

Linford Bacon
Linford Bacon

Reputation: 323

The user that you are using to run conda update conda does not have write permission on /anaconda/pkgs/cache/.

If you don't want to manage anaconda as the superuser, I would recommend that you create a new user group (i.e. anaconda_admin) and run:

sudo groupadd anaconda_admin
sudo chown -R :anaconda_admin /anaconda

Then you will need to ensure that permissions are something like:

sudo chmod -R 775 /anaconda

And finally that your user is in the anaconda_admin group:

sudo adduser <<<your_user>>> anaconda_admin

Upvotes: 2

E.Z
E.Z

Reputation: 1998

You ought to use sudo in order to write certain files into system. It is perfectly fine and will not break you OS, unless you work with sophisticated and rudimentary packages and installers (conda and python libraries are absolutely fine).

sudo conda update conda should do the thing not only with updating conda, but also with other dependencies and packages you wish to install.

In short, the installer tries to write a file into a certain directory (or modify a file in a directory) that it has not got an access to. With sudo you make them do that as you run it with appended priviliges.

Upvotes: 1

Related Questions