34
~$ conda update conda
Solving environment: done

## Package Plan ##

  environment location: /home/david/anaconda3

  added / updated specs: 
    - conda


The following packages will be UPDATED:

    conda: 4.4.10-py36_0 --> 4.4.11-py36_0

Proceed ([y]/n)? y

Preparing transaction: done
Verifying transaction: done
Executing transaction: failed
ERROR conda.core.link:_execute(481): An error occurred while uninstalling package 'defaults::conda-4.4.10-py36_0'.
PermissionError(13, 'Permission denied')
Attempting to roll back.

Rolling back transaction: done

PermissionError(13, 'Permission denied')

I was trying to update conda on virtualbox ubuntu 16.04 and this permission error came up. I tried sudo conda update conda but it returns sudo: conda: command not found. I'm not sure where to go from here.

Shamsul Arefin
  • 661
  • 7
  • 15
dyubidub
  • 361
  • 1
  • 3
  • 3

9 Answers9

35

I got the same error and solved it by this:

sudo env "PATH=$PATH" conda update conda
Kayvan Karim
  • 2,986
  • 2
  • 18
  • 18
30

All conda commands must be run without super user privileges. That's why sudo conda command doesn't work.

You may have run conda installation bush file with super user privileges while installing. The user (david) running conda doesn't have write permissions to paths(/home/david/anaconda3) it needs to modify in the environment, then conda can't do anything. To solve this problem you need to change permissions to paths (/home/david/anaconda3).

To change permissions to paths (/home/user/anaconda3) using:

sudo chown -R user /home/user/anaconda3
Shamsul Arefin
  • 661
  • 7
  • 15
  • 1
    In case your conda is not installed there, you can (on *nix) use "which conda" to find out where it is, and then examine/change permissions there. – TextGeek Jan 17 '20 at 17:46
  • Why exactly does this do anything considering the fact that I have already read/write priviledges? – JobHunter69 Apr 08 '20 at 17:07
25

I solved this problem by right clicking on Anaconda Prompt, selecting "Run As Administrator", and typing the command that I want to execute.

This problem arise if at installation time, we select an option install for all user anaconda. It can be solved as I mentioned above - run it as Administrator and type the conda commands for install, updating the packages.

pushkin
  • 9,575
  • 15
  • 51
  • 95
Arpit Patel
  • 267
  • 3
  • 2
  • 5
    This helped me, as I was having the same "permission denied" problem in Windows 10. So it's a upvote for me. – Yaojin Jan 01 '19 at 12:51
11

It's Permission denied, So just sudo chown -R frazier:frazier /home/frazier/anaconda3

PS: change 'frazier' to your user name.

Frazier
  • 111
  • 1
  • 2
4

You have installed Anaconda with sudo or root user. You need to install it with normal ubuntu/<Your username> user. Remove or take backup of the already installed Anaconda (/home/<user>/anaconda3). With normal mode install anaconda ( bash conda_installer_script ) .

Check .bashrc for this line and validate it.

export PATH="/home/<username>/anaconda3/bin:$PATH"

If not add it with proper anaconda path .

Reload .bashrc file and check conda is working by conda list command.

Now you can do conda update conda

Manish Verma
  • 771
  • 7
  • 20
  • Please note that this `export PATH` thing is no longer the way to proceed for `conda>=4.4`. It should be replaced by `source /etc/profile.d/conda.sh`. – FabienP Jun 16 '18 at 19:41
4
conda install numpy
{
Executing transaction: failed
ERROR conda.core.link:_execute(502): An error occurred while uninstalling package 'defaults::conda-4.5.4-py27_0'.
OSError(13, 'Permission denied')
Attempting to roll back.

Rolling back transaction: done

OSError(13, 'Permission denied')}

solution:

to change the permission to conda, use the command :

sudo chown -R nikhil /home/nikhil/miniconda

chown command changes the permission of miniconda to use sudo. now you have the permisssion to access sudo.. now use:

conda update conda
  • now

    Executing transaction: Done

Stephen Rauch
  • 47,830
  • 31
  • 106
  • 135
Nikhil Parashar
  • 431
  • 5
  • 11
2

I too had this error and resolved it by doing the following things - a little strange but worth a try.
1. Run as administrator
2. Run the code below to specifically update package in an environment -myenv
$conda install --name myenv numpy
3. For me the environment was running hence it was not updating, once I closed my running workbooks, and ran Point 1 and 2 .. it worked :)

rishi jain
  • 1,524
  • 1
  • 19
  • 26
1

if you have this error message during package installation in anaconda then follow the given step:

  1. open the anaconda prompt by right click.
  2. select the run as administrator.
  3. type the command for install package.eg conda install numpy
Nik
  • 2,885
  • 2
  • 25
  • 25
Ajay kumar
  • 29
  • 3
1

Run Anaconda Prompt using "Run as Administrator" option and then run the command -> conda update conda Then go back to starting Anaconda Prompt as usual and I believe everything should be fine. Also, don't forget to add Anaconda3 path to Environment variables.

Japesh Methuku
  • 337
  • 4
  • 7