Updating Anaconda fails: Environment Not Writable Error

前端 未结 14 1933
萌比男神i
萌比男神i 2020-12-23 19:54

I\'m trying to update Anaconda and its packages using conda update --name root conda, but it fails every time.

Error message : Environme

相关标签:
14条回答
  • 2020-12-23 20:13

    If you get this error under Linux when running conda using sudo, you might be suffering from bug #7267:

    When logging in as non-root user via sudo, e.g. by:

    sudo -u myuser -i
    

    conda seems to assume that it is run as root and raises an error.

    The only known workaround seems to be: Add the following line to your ~/.bashrc:

    unset SUDO_UID SUDO_GID SUDO_USER
    

    ...or unset the ENV variables by running the line in a different way before running conda.

    If you mistakenly installed anaconda/miniconda as root/via sudo this can also lead to the same error, then you might want to do the following:

    sudo chown -R username /path/to/anaconda3
    

    Tested with conda 4.6.14.

    0 讨论(0)
  • 2020-12-23 20:18

    On Windows, search for Anaconda PowerShell Prompt. Right click the program and select Run as administrator. In the command prompt, execute the following command:

    conda update -n base -c defaults conda
    

    Your Anaconda should now update without admin related errors.

    0 讨论(0)
  • 2020-12-23 20:20

    I had the same issue and the base environment was in C:\ProgramData\Anaconda3. This is the case, when Anaconda is installed for all users.

    As a solution, I re-installed Anaconda just for me and now the base environment is in \AppData\Local\Continuum\anaconda3. This now can be updated via conda update without admin privileges.

    0 讨论(0)
  • 2020-12-23 20:21

    I had installed anaconda via the system installer on OS X in the past, which created a ~/.conda/environments.txt owned by root. Conda could not modify this file, hence the error.

    To fix this issue, I changed the ownership of that directory and file to my username:

    sudo chown -R $USER ~/.conda
    
    0 讨论(0)
  • 2020-12-23 20:23

    CONDA UPDATE - NO WRITE ACCESS PROBLEM ## FIXED##

    SIMPLE SOLUTION:

    1. Press the Windows+S combination button and type "cmd" into it.
    2. Right click on the Command Prompt App result that shows up and click on "Run as administrator"
    3. Now, in the black window that is open (i.e. your Command prompt), copy and paste the following to check for your version: conda --version
    4. If you want the latest update, then update Conda by running the update command by pasting the following and clicking enter in the command prompt(black window): conda update conda
    5. If a newer version is available, it will prompt you for a yes/no to install the update. Type "yes" and then press Enter to update.
    0 讨论(0)
  • 2020-12-23 20:26

    As an alternative, I would suggest looking at your conda config file.

    Reason

    Sometimes for creating a virtual env at a specified location other than the pre-defined path at ~/anaconda3/envs we append the conda config file using: conda config --append envs_dirs /path/to/envs where envs_dirs is a specified function in config file for allocating different paths where conda can find your virtual envs. Removing a recently added path in this config file may solve the problem.

    Solution

    $:> conda config --show envs_dirs
    
        envs_dirs:
        - /home/some_recent_path    # remove this
        - /home/.../anaconda3/envs
    

    Note the value specifing a different directory other than the predefined location, and remove it using

    $:> conda config --remove envs_dirs /home/some_recent_path
    

    Now the config file envs_dirs is set to default location of envs. Try creating a new env now.

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