Check target environment is writable before starting all tasks
Checklist
- I added a descriptive title
- I searched open requests and couldn't find a duplicate
What is the idea?
I use the CI image quite often to debug stuff locally. This image has conda preinstalled in /opt/conda, which requires sudo for modifications.
Running conda as a regular user is no problem because conda knows how to change back to ~/.conda/ for local caches and what not. However, to install new packages on base, you do need sudo.
The problem is that the user only learns this after downloading the repodatas, solving the specs AND downloading and extracting all packages!
test_user@a73662fc36e4:/opt/conda-src$ conda update conda
Collecting package metadata (current_repodata.json): done
Solving environment: done
## Package Plan ##
environment location: /opt/conda
added / updated specs:
- conda
The following packages will be downloaded:
package | build
---------------------------|-----------------
boltons-23.0.0 | pyhd8ed1ab_0 296 KB conda-forge
botocore-1.29.104 | pyhd8ed1ab_0 5.8 MB conda-forge
conda-23.3.1 | py310h4c7bcd0_0 944 KB conda-forge
coverage-7.2.2 | py310h734f5e8_0 275 KB conda-forge
cryptography-40.0.1 | py310he4ba0b1_0 1.4 MB conda-forge
curl-8.0.1 | h7c02cbb_0 88 KB conda-forge
exceptiongroup-1.1.1 | pyhd8ed1ab_0 18 KB conda-forge
expat-2.5.0 | hd600fc2_1 123 KB conda-forge
icu-72.1 | hcf00150_0 11.5 MB conda-forge
identify-2.5.22 | pyhd8ed1ab_0 76 KB conda-forge
importlib-metadata-6.1.0 | pyha770c72_0 24 KB conda-forge
jsonpatch-1.32 | pyhd8ed1ab_0 14 KB conda-forge
jsonpointer-2.0 | py_0 9 KB conda-forge
jupyter_core-5.3.0 | py310h4c7bcd0_0 90 KB conda-forge
lcms2-2.15 | h3e0bdec_1 282 KB conda-forge
libcurl-8.0.1 | h7c02cbb_0 365 KB conda-forge
libdeflate-1.18 | hb4cce97_0 65 KB conda-forge
libexpat-2.5.0 | hd600fc2_1 75 KB conda-forge
libjpeg-turbo-2.1.5.1 | hb4cce97_0 488 KB conda-forge
libtiff-4.5.0 | h536c0eb_6 443 KB conda-forge
libuuid-2.38.1 | hb4cce97_0 35 KB conda-forge
libwebp-base-1.3.0 | hb4cce97_0 350 KB conda-forge
libxml2-2.10.3 | h430b14f_6 737 KB conda-forge
openssl-3.1.0 | hb4cce97_0 2.5 MB conda-forge
pillow-9.4.0 | py310hcf0f7da_2 44.0 MB conda-forge
platformdirs-3.2.0 | pyhd8ed1ab_0 17 KB conda-forge
pyopenssl-23.1.1 | pyhd8ed1ab_0 125 KB conda-forge
pytz-2023.3 | pyhd8ed1ab_0 182 KB conda-forge
readline-8.2 | h8fc344f_1 287 KB conda-forge
typing-extensions-4.5.0 | hd8ed1ab_0 9 KB conda-forge
typing_extensions-4.5.0 | pyha770c72_0 31 KB conda-forge
tzdata-2023c | h71feb2d_0 115 KB conda-forge
urllib3-1.26.15 | pyhd8ed1ab_0 110 KB conda-forge
virtualenv-20.21.0 | pyhd8ed1ab_0 6.0 MB conda-forge
wheel-0.40.0 | pyhd8ed1ab_0 54 KB conda-forge
------------------------------------------------------------
Total: 76.8 MB
The following NEW packages will be INSTALLED:
boltons conda-forge/noarch::boltons-23.0.0-pyhd8ed1ab_0
jsonpatch conda-forge/noarch::jsonpatch-1.32-pyhd8ed1ab_0
jsonpointer conda-forge/noarch::jsonpointer-2.0-py_0
libexpat conda-forge/linux-aarch64::libexpat-2.5.0-hd600fc2_1
libjpeg-turbo conda-forge/linux-aarch64::libjpeg-turbo-2.1.5.1-hb4cce97_0
The following packages will be REMOVED:
jpeg-9e-h2a766a3_3
The following packages will be UPDATED:
botocore 1.29.84-pyhd8ed1ab_0 --> 1.29.104-pyhd8ed1ab_0
conda 23.1.0-py310h4c7bcd0_0 --> 23.3.1-py310h4c7bcd0_0
coverage 7.2.1-py310h734f5e8_0 --> 7.2.2-py310h734f5e8_0
cryptography 39.0.2-py310he4ba0b1_0 --> 40.0.1-py310he4ba0b1_0
curl 7.88.1-h6ad7c7a_0 --> 8.0.1-h7c02cbb_0
exceptiongroup 1.1.0-pyhd8ed1ab_0 --> 1.1.1-pyhd8ed1ab_0
expat 2.5.0-ha18d298_0 --> 2.5.0-hd600fc2_1
icu 70.1-ha18d298_0 --> 72.1-hcf00150_0
identify 2.5.18-pyhd8ed1ab_0 --> 2.5.22-pyhd8ed1ab_0
importlib-metadata 6.0.0-pyha770c72_0 --> 6.1.0-pyha770c72_0
jupyter_core 5.2.0-py310h4c7bcd0_0 --> 5.3.0-py310h4c7bcd0_0
lcms2 2.14-h7576be9_1 --> 2.15-h3e0bdec_1
libcurl 7.88.1-h6ad7c7a_0 --> 8.0.1-h7c02cbb_0
libdeflate 1.17-hb4cce97_0 --> 1.18-hb4cce97_0
libtiff 4.5.0-h4c1066a_2 --> 4.5.0-h536c0eb_6
libuuid 2.32.1-hf897c2e_1000 --> 2.38.1-hb4cce97_0
libwebp-base 1.2.4-h4e544f5_0 --> 1.3.0-hb4cce97_0
libxml2 2.10.3-h249b6dd_0 --> 2.10.3-h430b14f_6
openssl 3.0.8-hb4cce97_0 --> 3.1.0-hb4cce97_0
pillow 9.4.0-py310h2843b5e_1 --> 9.4.0-py310hcf0f7da_2
platformdirs 3.1.0-pyhd8ed1ab_0 --> 3.2.0-pyhd8ed1ab_0
pyopenssl 23.0.0-pyhd8ed1ab_0 --> 23.1.1-pyhd8ed1ab_0
pytz 2022.7.1-pyhd8ed1ab_0 --> 2023.3-pyhd8ed1ab_0
readline 8.1.2-h38e3740_0 --> 8.2-h8fc344f_1
typing-extensions 4.4.0-hd8ed1ab_0 --> 4.5.0-hd8ed1ab_0
typing_extensions 4.4.0-pyha770c72_0 --> 4.5.0-pyha770c72_0
tzdata 2022g-h191b570_0 --> 2023c-h71feb2d_0
urllib3 1.26.14-pyhd8ed1ab_0 --> 1.26.15-pyhd8ed1ab_0
virtualenv 20.20.0-pyhd8ed1ab_0 --> 20.21.0-pyhd8ed1ab_0
wheel 0.38.4-pyhd8ed1ab_0 --> 0.40.0-pyhd8ed1ab_0
Proceed ([y]/n)?
Downloading and Extracting Packages
Preparing transaction: done
Verifying transaction: failed
EnvironmentNotWritableError: The current user does not have write permissions to the target environment.
environment location: /opt/conda
uid: 1001
gid: 1001
Why is this needed?
To save everyone's time (and Anaconda.org some resources).
What should happen?
It would be nice to have that check performed at the beginning (if --dry-run is not enabled).
Additional Context
No response