How does one fix the issue of not writable paths with conda?

前端 未结 5 1160
梦谈多话
梦谈多话 2021-02-05 15:33

Why do I see the following error when using conda (usually when installing packages or making new envs) and how do I fix it:

Verifying transaction: | WARNING cond         


        
相关标签:
5条回答
  • 2021-02-05 16:01

    if you are on Mac & have install Anaconda from GUI. try

    change the permission of opt/anaconda3/ folder to Read & write.

    This solved my problem.

    0 讨论(0)
  • 2021-02-05 16:05

    reference: to https://gist.github.com/zoka123/f2b03f19924258d28441fe2d88750145

    check if a path is writable:

    if [ -w "./.conda" ]; then echo "WRITABLE"; else echo "NOT WRITABLE"; fi

    if it is not writable, change writability to anybody:

    chmod 775 ./.conda

    If you are curious of existing file permission:

    ls -lha outputs the set of access right of current locations, where d refers to current directory. Eg: drwxr-xr-x :

    each digit refers to right for User, Group and Global respectively. For the above example, rwx means current user can read,write and execute; r-x for both group and global, which means they can read and execute only.

    chmod is used with a 3-digit commands, each digit refers to one combination of the read, write, execute access for the above three types of identity.

    755 means rwx for current user, and r-x for Group and Global.

    You may refer to https://www.linode.com/docs/tools-reference/tools/modify-file-permissions-with-chmod/ for reference.

    0 讨论(0)
  • 2021-02-05 16:07

    To add user write permission to a directory recursively:

    chmod -R u+w /Users/brandomiranda/.conda
    
    0 讨论(0)
  • 2021-02-05 16:10

    I ran the top voted answer but because the chmod command did not have the recursive flag it did not work and later gave me problems (because I didn't change the permissions of EVERYTHING inside the conda folder of course):

    So change permissions recursively of the directory with:

    sudo chmod -R 775 /Users/brandomiranda/.conda
    

    swap /Users/brandomiranda/ for your path to .conda of course.


    If you are worried about using sudo I believe its not that bad to have to run it because we are only changing the permissions of a very specific directory (which is much safer than say, running any conda command with sudo!)

    The fact is, I don't know why the issue came despite me (I believe) installing conda properly with the conda .sh script as I outlined in the question. Solving that is the real solution I assume but I don't know how to solve that (I guess I could try re-installing yet again...)

    0 讨论(0)
  • 2021-02-05 16:12

    As I said in the conda #7267 github issue, I had the same problem on Ubuntu because I installed Anaconda as a superuser: sudo bash Anaconda3-2019.10-Linux-x86_64.sh

    [solution Ubuntu] remove Anaconda and install it without the superuser privileges:

    sudo rm -rf ~/anaconda3
    bash Anaconda3-2019.10-Linux-x86_64.sh
    

    This fixed the problem.

    0 讨论(0)
提交回复
热议问题