Xwtek
Xwtek

Reputation: 1291

Installing a package in anaconda fails: conda has no write permission to the file /home/<redacted>/.conda/pkgs/urls.txt

I tried to install selenium on Ubuntu using this syntax:

conda install -c conda-forge selenium

It fails with this error

Collecting package metadata (current_repodata.json): failed

NotWritableError: The current user does not have write permissions to a required path.
  path: /home/<redacted>/.conda/pkgs/urls.txt
  uid: 1000
  gid: 1000

If you feel that permissions on this path are set incorrectly, you can manually
change them by executing

  $ sudo chown 1000:1000 /home/<redacted>/.conda/pkgs/urls.txt

In general, it's not advisable to use 'sudo conda'.

I tried to execute this command to check the permission of the file:

ls -l /home/<redacted>/.conda/pkgs/urls.txt

It turns out that the file doesn't exist:

ls: cannot access '/home/<redacted>/.conda/pkgs/urls.txt': No such file or directory

In fact, I checked the folder /home/<redacted>/.conda/, but the only file exists is environments.txt

-rw-r--r-- 1 root root 24 Agu 26 09:44 environments.txt

I don't know how to fix this. Should I just create an empty file?

Upvotes: 0

Views: 2987

Answers (1)

Michael
Michael

Reputation: 2414

Given that your environments.txt is owned by root, your .conda folder is probably also owned by root. Since you're not currently root, you can't modify the .conda folder or anything in it.

I'm guessing that you installed anaconda to your home area using the root user or sudo; good news, since you apparently have sudo privileges you can just give yourself recursive ownership of the .conda folder using chown: chown -R <redacted>:<redacted> .conda.

Upvotes: 2

Related Questions