Updating Anaconda fails: Environment Not Writable Error

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:ProgramDataAnaconda3

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

Any help?

5

start your command prompt with run as administrator

10

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”.

3

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.

3

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.

3

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.

On Windows in general, running command prompt with administrator works. But if you don’t want to do that every time, specify Full control permissions of your user (or simply all users) on Anaconda3 directory. Be aware that specifying it for all users allows other users to install their own packages and modify the content.

1

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

I had the same issue and the base environment was in C:ProgramDataAnaconda3. 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 AppDataLocalContinuumanaconda3. This now can be updated via conda update without admin privileges.

1

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.

1

On Windows,

  1. Create a new environment with

    conda create --name py35 python=3.5

see conda cheat sheet

  1. Activate this environment

    conda activate py35

  2. Now you don’t need to have root access to your new environment.

As mentioned in a comment to the accepted answer, the default environment base requires administrative rights on Windows:

On Windows, if you’re trying to install packages into the base
environment (which is installed to C:ProgramDataAnaconda3), you’ll
need admin access. If you first create an environment (which should
install in your user directory under .condaenvs) and activate it, you
no longer need admin right for that environment. Don’t forget to
activate the env after creating it. – C.J. Jackson

1

this line of code on your terminal, solves the problem

$ sudo chown -R $USER:$USER anaconda 3

1

WINDOWS:
I also got following error while (base) PS E:Python> conda install ConfigParser

Verifying transaction: failed

EnvironmentNotWritableError: The current user does not have write permissions to the target environment.
environment location: C:ProgramDataAnaconda3

My solution: Open Command prompt as administrator, then above command again and it worked.

C:WINDOWSsystem32>conda install ConfigParser

Collecting package metadata (current_repodata.json): done Solving environment: done

Package Plan

environment location: C:ProgramDataAnaconda3

added / updated specs:
– configparser

The following NEW packages will be INSTALLED:

configparser pkgs/main/noarch::configparser-5.0.2-pyhd3eb1b0_0

Proceed ([y]/n)? y

Preparing transaction: done Verifying transaction: done Executing
transaction: done

I had the same problem. The cause for me was that when downloading Anaconda, I chose ‘download for all users’ instead of ‘just for me’. I uninstalled it, re-installed it and corrected that. And I’m not getting this error anymore.

On Windows, I would suggest NOT manually tamper the permission list like the other answers suggest, as the permission of this directory by default is already allowing every user to write to this path, encountering this error is most likely because user (you or another user) have previously modified the permission list by mistake, and what we should do is to restore the original permissions rather than adding more entries.

Open the properties dialog of the corresponding folder of your conda distribution.

  • Anaconda: C:ProgramDataAnaconda3
  • Miniconda: C:toolsmambaforge

Navigate to Security – Advanced

An example of wrongly configured directory permissions shown below. (which is the case from myself)

The Inherited from field is None in this case indicating the permission has been manually modified. And User have no Modify permission to write to this folder.

Click the Enable inheritance button on the bottom left to restore original permissions from parent folder, and remove any entries whose Inherited from is None.

If done correctly, the folder permission should look like this.

run your conda commands now, and permission error should be gone.

In my case somehow CONDA_ENVS_PATH was removed, so I was having NotWritableError. So I fixed the error by specifying

CONDA_ENVS_PATH=~/my-envs:/opt/anaconda/envs

in the .bashrc file

I was also suffered by same problem. I resolved the problem by reinstalling anaconda(While installation at this time I selected “just for me” as user) and my problem was solved.Try the same

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

You can set Anaconda Navigator to always run as administrator on Windows 10 by following these steps

Right-click on the Anaconda Navigator icon and select “Properties”.
Click on the “Compatibility” tab.
Check the box next to “Run this program as an administrator”.
Click “Apply” and then click “OK”.
I hope this helps!

I had the same problem when I was trying to install pyLDAvis with the following code in Anaconda Prompt.

conda install -c conda-forge pyLDAvis

I ran the Anaconda Prompt in Administrator mode (run as administrator) and executed the code again. It was installed successfully!

Deleting file .condarc (eg./root/.condarc) in the user’s home directory before installation, resolved the issue.

1

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật