Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Updating Anaconda fails: Environment Not Writable Error

Tags:

anaconda

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

Error message : EnvironmentNotWritableError: The current user does not have write permissions to the target environment. environment location: C:\ProgramData\Anaconda3

Environment location: C:\ProgramData\Anaconda3. I replaced the root with base, still I get the same error.

Any help?

like image 331
A. E. Fahim Avatar asked Mar 21 '19 22:03

A. E. Fahim


People also ask

How do I update my Anaconda as administrator?

To run with Administrator privilege: Start > Anaconda3 > Anaconda Prompt > Right-click > More > Run As Administrator.

What is notwritableerror in Anaconda?

NotWritableError: The current user does not have write permissions to a required path. During installing library your Anaconda program is running. This restricts you to make any changes in environment during working.

How do I update Anaconda to the latest version?

You can update Anaconda to the latest version on one of the following platforms. Windows: Open the start menu and choose the Anaconda Prompt. macOS or Linux: Open the terminal window. To update Anaconda to the latest version, type the following command. To update the Anaconda to a specific version, type the following command.

What to do when Anaconda won’t install library?

During installing library your Anaconda program is running. This restricts you to make any changes in environment during working. Solution-1 Close Anaconda program then try installing library on command prompt. Solution-2 Close Anaconda program then run Anaconda Prompt as Administrator.

Can Conda update IPython with Anaconda 2019?

In the case of the Anaconda metapackage, when you say conda update ipython but you have Anaconda 2019.2, conda can and should “downgrade” Anaconda to the “custom” version so that iPython can be updated.


5 Answers

If you face this issue in Linux, one of the common reasons can be that the folder "anaconda3" or "anaconda2" has root ownership. This prevents other users from writing into the folder. This can be resolved by changing the ownership of the folder from root to "USER" by running the command:

sudo chown -R $USER:$USER anaconda3

or sudo chown -R $USER:$USER <path of anaconda 3/2 folder>

Note: How to figure out whether a folder has root ownership? -- There will be a lock symbol on the top right corner of the respective folder. Or right-click on the folder->properties and you will be able to see the owner details

The -R argument lets the $USER access all the folders and files within the folder anaconda3 or anaconda2 or any respective folder. It stands for "recursive".

like image 30
Sushanth Avatar answered Oct 16 '22 21:10

Sushanth


start your command prompt with run as administrator

like image 179
Akshat Tamrakar Avatar answered Oct 16 '22 20:10

Akshat Tamrakar


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.

like image 52
Peter Bisimbeko Avatar answered Oct 16 '22 22:10

Peter Bisimbeko


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.

like image 24
lumbric Avatar answered Oct 16 '22 22:10

lumbric


Open this folder "C:\ProgramData\" and right-click on "\Anaconda3". go to properties -> security and check all the boxes for each user. This worked for me.

like image 21
Agu Yitzkak Avatar answered Oct 16 '22 21:10

Agu Yitzkak