Fix conda init problem and revert changes to conda base env
This MR reverts all changes to the conda
base environment introduced in !14 (merged) (i.e. going back to 94c4248c) and provides an actual "fix" for the conda init error that currently (!) happens during conda base env container image builds.
In particular, the following
RUN /conda.sh conda init --system bash
is not a proper fix for
USER jovyan
RUN source ${CONDA_TARGET_DIR}/etc/profile.d/conda.sh && conda init bash
since it does not result in a properly initialized Bash shell for the Jovyan user
$ docker pull rz-container-registry00.rz.uni-kiel.de/cloudlab/base:v2022.09.22-conda
$ docker run -it --rm rz-container-registry00.rz.uni-kiel.de/cloudlab/base:v2022.09.22-conda bash
(base) jovyan@cloudlab:~$ conda --version
conda 4.14.0
(base) jovyan@cloudlab:~$ conda activate base
(base) jovyan@cloudlab:~$
(base) jovyan@cloudlab:~$ exit
$ docker pull rz-container-registry00.rz.uni-kiel.de/cloudlab/base:v2022.09.27-conda
$ docker run -it --rm rz-container-registry00.rz.uni-kiel.de/cloudlab/base:v2022.09.27-conda bash
jovyan@cloudlab:~$ conda --version
conda 22.9.0
jovyan@cloudlab:~$ conda activate base
CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
To initialize your shell, run
$ conda init <SHELL_NAME>
Currently supported shells are:
- bash
- fish
- tcsh
- xonsh
- zsh
- powershell
See 'conda init --help' for more information and options.
IMPORTANT: You may need to close and restart your shell after running 'conda init'.
because /etc/profile.d/conda.sh
, which is generated via the conda init --system bash
command is not loaded for interactive non-login shells. (Such as in a container environment, see also here.)
It seems, that the conda init error
Step 20/26 : RUN source ${CONDA_TARGET_DIR}/etc/profile.d/conda.sh && conda init bash
---> Running in b2bf2623e3f2
# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<
Traceback (most recent call last):
File "/miniconda3/lib/python3.9/site-packages/conda/exceptions.py", line 1129, in __call__
return func(*args, **kwargs)
File "/miniconda3/lib/python3.9/site-packages/conda/cli/main.py", line 86, in main_subshell
exit_code = do_call(args, p)
File "/miniconda3/lib/python3.9/site-packages/conda/cli/conda_argparse.py", line 93, in do_call
return getattr(module, func_name)(args, parser)
File "/miniconda3/lib/python3.9/site-packages/conda/cli/main_init.py", line 50, in execute
return initialize(context.conda_prefix, selected_shells, for_user, args.system,
File "/miniconda3/lib/python3.9/site-packages/conda/core/initialize.py", line 119, in initialize
run_plan_elevated(plan2)
File "/miniconda3/lib/python3.9/site-packages/conda/core/initialize.py", line 688, in run_plan_elevated
result = subprocess_call(
File "/miniconda3/lib/python3.9/site-packages/conda/gateways/subprocess.py", line 89, in subprocess_call
process = Popen(
File "/miniconda3/lib/python3.9/subprocess.py", line 951, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/miniconda3/lib/python3.9/subprocess.py", line 1821, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'sudo'
`$ /miniconda3/bin/conda init bash`
environment variables:
CIO_TEST=<not set>
CONDA_EXE=/miniconda3/bin/conda
CONDA_PYTHON_EXE=/miniconda3/bin/python
CONDA_ROOT=/miniconda3
CONDA_SHLVL=0
CONDA_TARGET_DIR=/miniconda3
CURL_CA_BUNDLE=<not set>
PATH=/miniconda3/condabin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
:/sbin:/bin
REQUESTS_CA_BUNDLE=<not set>
SSL_CERT_FILE=<not set>
active environment : None
shell level : 0
user config file : /home/jovyan/.condarc
populated config files :
conda version : 22.9.0
conda-build version : not installed
python version : 3.9.12.final.0
virtual packages : __linux=5.4.0=0
__glibc=2.35=0
__unix=0=0
__archspec=1=x86_64
base environment : /miniconda3 (read only)
conda av data dir : /miniconda3/etc/conda
conda av metadata url : None
channel URLs : https://repo.anaconda.com/pkgs/main/linux-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/r/linux-64
https://repo.anaconda.com/pkgs/r/noarch
package cache : /miniconda3/pkgs
/home/jovyan/.conda/pkgs
envs directories : /home/jovyan/.conda/envs
/miniconda3/envs
platform : linux-64
user-agent : conda/22.9.0 requests/2.28.1 CPython/3.9.12 Linux/5.4.0-126-generic ubuntu/22.04.1 glibc/2.35
UID:GID : 1000:1000
netrc file : None
offline mode : False
An unexpected error has occurred. Conda has prepared the above report.
The command '/bin/bash -c source ${CONDA_TARGET_DIR}/etc/profile.d/conda.sh && conda init bash' returned a non-zero code: 1
was introduced with the conda version jump from v4.12.0 to v22.9.0 (see also here) and that it is a bug, that is currently worked on.
So, this is a problem that needs to be fixed upstream. For now, we therefore simply drop the conda update conda
part after the miniconda latest installation, thereby sticking to the older conda 4.14.0 package, that is still distributed via Miniconda3-latest-Linux-x86_64.sh
.