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 conda.core.path_actions:verify(963): Unable to create environments file. Path not writable. environment location: /Users/brandomiranda/.conda/environments.txt
or
Preparing transaction: done Verifying transaction: - WARNING conda.core.path_actions:verify(963): Unable to create environments file. Path not writable. environment location: /Users/brandomiranda/.conda/environments.txt done Executing transaction: - WARNING conda.core.envs_manager:register_env(52): Unable to register environment. Path not writable or missing. environment location: /Users/brandomiranda/miniconda3/envs/myenv registry file: /Users/brandomiranda/.conda/environments.txt done
a detailed outline of what I did can be found on the following gitissue:
https://github.com/conda/conda/issues/7267
which really isn't anything too fancy except re-install conda from scratch and run the following command:
bash Miniconda3-latest-MacOSX-x86_64.sh
and it installed this version of conda:
❯ conda -V conda 4.7.12
Example of command causing me the warnings:
conda create -n myenv python=3.6
More errors when I install packages with conda:
Collecting package metadata (current_repodata.json): done Solving environment: done ## Package Plan ## environment location: /Users/brandomiranda/miniconda3/envs/automl added / updated specs: - jupyterlab The following packages will be downloaded: package | build ---------------------------|----------------- jupyter_client-5.3.4 | py37_0 131 KB conda-forge ------------------------------------------------------------ Total: 131 KB The following NEW packages will be INSTALLED: appnope conda-forge/osx-64::appnope-0.1.0-py37_1000 attrs conda-forge/noarch::attrs-19.3.0-py_0 backcall conda-forge/noarch::backcall-0.1.0-py_0 bleach conda-forge/noarch::bleach-3.1.0-py_0 decorator conda-forge/noarch::decorator-4.4.1-py_0 defusedxml conda-forge/noarch::defusedxml-0.6.0-py_0 entrypoints conda-forge/osx-64::entrypoints-0.3-py37_1000 importlib_metadata conda-forge/osx-64::importlib_metadata-1.3.0-py37_0 ipykernel conda-forge/osx-64::ipykernel-5.1.3-py37h5ca1d4c_0 ipython conda-forge/osx-64::ipython-7.11.1-py37h5ca1d4c_0 ipython_genutils conda-forge/noarch::ipython_genutils-0.2.0-py_1 jedi conda-forge/osx-64::jedi-0.15.2-py37_0 jinja2 conda-forge/noarch::jinja2-2.10.3-py_0 json5 conda-forge/noarch::json5-0.8.5-py_0 jsonschema conda-forge/osx-64::jsonschema-3.2.0-py37_0 jupyter_client conda-forge/osx-64::jupyter_client-5.3.4-py37_0 jupyter_core conda-forge/osx-64::jupyter_core-4.6.1-py37_0 jupyterlab conda-forge/noarch::jupyterlab-1.2.4-py_0 jupyterlab_server conda-forge/noarch::jupyterlab_server-1.0.6-py_0 libsodium conda-forge/osx-64::libsodium-1.0.17-h01d97ff_0 markupsafe conda-forge/osx-64::markupsafe-1.1.1-py37h0b31af3_0 mistune conda-forge/osx-64::mistune-0.8.4-py37h0b31af3_1000 more-itertools conda-forge/noarch::more-itertools-8.0.2-py_0 nbconvert conda-forge/osx-64::nbconvert-5.6.1-py37_0 nbformat conda-forge/noarch::nbformat-5.0.3-py_0 notebook conda-forge/osx-64::notebook-6.0.1-py37_0 pandoc conda-forge/osx-64::pandoc-2.9.1.1-0 pandocfilters conda-forge/noarch::pandocfilters-1.4.2-py_1 parso conda-forge/noarch::parso-0.5.2-py_0 pexpect conda-forge/osx-64::pexpect-4.7.0-py37_0 pickleshare conda-forge/osx-64::pickleshare-0.7.5-py37_1000 prometheus_client conda-forge/noarch::prometheus_client-0.7.1-py_0 prompt_toolkit conda-forge/noarch::prompt_toolkit-3.0.2-py_0 ptyprocess conda-forge/noarch::ptyprocess-0.6.0-py_1001 pygments conda-forge/noarch::pygments-2.5.2-py_0 pyrsistent conda-forge/osx-64::pyrsistent-0.15.7-py37h0b31af3_0 python-dateutil conda-forge/noarch::python-dateutil-2.8.1-py_0 pyzmq pkgs/main/osx-64::pyzmq-18.1.0-py37h0a44026_0 send2trash conda-forge/noarch::send2trash-1.5.0-py_0 terminado conda-forge/osx-64::terminado-0.8.3-py37_0 testpath conda-forge/noarch::testpath-0.4.4-py_0 tornado conda-forge/osx-64::tornado-6.0.3-py37h0b31af3_0 traitlets conda-forge/osx-64::traitlets-4.3.3-py37_0 wcwidth conda-forge/noarch::wcwidth-0.1.8-py_0 webencodings conda-forge/noarch::webencodings-0.5.1-py_1 zeromq conda-forge/osx-64::zeromq-4.3.2-h6de7cb9_2 zipp conda-forge/noarch::zipp-0.6.0-py_0 The following packages will be UPDATED: ca-certificates pkgs/main::ca-certificates-2019.11.27~ --> conda-forge::ca-certificates-2019.11.28-hecc5488_0 The following packages will be SUPERSEDED by a higher-priority channel: certifi pkgs/main --> conda-forge openssl pkgs/main::openssl-1.1.1d-h1de35cc_3 --> conda-forge::openssl-1.1.1d-h0b31af3_0 Proceed ([y]/n)? y Downloading and Extracting Packages jupyter_client-5.3.4 | 131 KB | ################################################################################################################################################################# | 100% Preparing transaction: done Verifying transaction: | WARNING conda.core.path_actions:verify(963): Unable to create environments file. Path not writable. environment location: /Users/brandomiranda/.conda/environments.txt done Executing transaction: - WARNING conda.core.envs_manager:register_env(52): Unable to register environment. Path not writable or missing. environment location: /Users/brandomiranda/miniconda3/envs/automl registry file: /Users/brandomiranda/.conda/environments.txt done
command that I ran:
(automl) brandomiranda~/automl-meta-learning ❯ conda install -c conda-forge jupyterlab
I tried changing the permission according to the suggested answers, BUT it seems it won't work without sudo. Is it really safe to do sudo here? why isn't it writable to the correct set of users already?
(automl) brandomiranda~/.conda ❯ if [ -w "/Users/brandomiranda/.conda" ]; then echo "WRITABLE"; else echo "NOT WRITABLE"; fi NOT WRITABLE (automl) brandomiranda~/.conda ❯ chmod 775 /Users/brandomiranda/.conda chmod: Unable to change file mode on /Users/brandomiranda/.conda: Operation not permitted
I've ran the chmod command in sudo. I checked the permissions of that file and I got the following:
(automl-meta-learning) brandomiranda~/automl-meta-learning/automl/automl ❯ ls -lha /Users/brandomiranda/.conda total 8 drwxrwxr-x 3 root staff 96B Jan 5 16:57 . drwxr-xr-x+ 117 brandomiranda staff 3.7K Jan 19 17:25 .. -rw-r--r-- 1 root staff 32B Jan 5 16:57 environments.txt
I checked this because I tried to install conda-build
with conda install conda-build
command but got the error towards the end:
Preparing transaction: done Verifying transaction: \ WARNING conda.core.path_actions:verify(963): Unable to create environments file. Path not writable. environment location: /Users/brandomiranda/.conda/environments.txt done Executing transaction: \ WARNING conda.core.envs_manager:register_env(52): Unable to register environment. Path not writable or missing. environment location: /Users/brandomiranda/miniconda3/envs/automl-meta-learning registry file: /Users/brandomiranda/.conda/environments.txt done
which seemed weird and that when I notice the environment.txt
didn't have the same permissions as the other file/directories. I am tempted to chmod that file too but all this business seems to be putting a bandage on the problem. I feel this shouldn't have happened in the first place so I will ask:
/Users/brandomiranda/.conda
conda folder suppose to be and should all folders/files have the same permissions?for now I will run:
sudo chmod 775 /Users/brandomiranda/.conda/environments.txt
although, it makes me uneasy that I am having to run sudo
for conda related stuff. Anyone know how to do this without requiring sudo or is sudo supposed to be required?
As a side comment, I am glad I never tried installing anything from conda using sudo and only changed the permissions of a few folders/files. That seems much safer than allowing conda to run arbitrary code in sudo (instead here it can run its stuff to a specific location while NOT running in sudo, so I guess changing folder permissions isn't that bad?).
Go to C:\ProgramData\Anaconda3, press and hold or right-click the folder, and then tap or click Properties. Tap or click the Security tab. Under Group or user names, tap or click your name to see the permissions that you have.
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.
As an alternative solution, I changed the owner of ~/.conda
to myself:
$ chown -R $USER ~/.conda
I think the root cause of the problem (at least in my case) was that ~/.conda
was owned by root
for some reason. Other solutions suggest making its access more permissive (open writing to the group or even to all) as a workaround. While technically that should work, I think changing the owner (and keeping existing permissions) is a safer approach.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With