ctlab / sysbio-training

6 stars 2 forks source link

Conda env configuration problem in sysbio-training/masters-2020/epigenetics/Dockerfile #1

Open iromeo opened 4 years ago

iromeo commented 4 years ago

Due 'PATH="/opt/conda/envs/bio/bin:${PATH}"' >> ~/.profile & in the line

# Fix: R shell uses env variables from ~/profile
RUN echo 'PATH="/opt/conda/bin:${PATH}"' >> ~/.profile && \
    echo 'PATH="/opt/conda/envs/bio/bin:${PATH}"' >> ~/.profile && \
    echo 'LD_LIBRARY_PATH="/opt/conda/lib:${LD_LIBRARY_PATH}"' >> ~/.profile && \
    echo "export LC_ALL=C.UTF-8" >> ~/.profile && \
    echo "export LANG=C.UTF-8" >> ~/.profile

users get bio conda env bin folder even if the other environment is activated, this leads broken environments except bio:

(base) student@ad992674a9d9:~$ echo $PATH
/opt/conda/envs/bio/bin:/opt/conda/bin:/opt/conda/bin:/opt/conda/condabin:/opt/conda/envs/bio/bin:/opt/conda/bin:/opt/conda/envs/bio/bin:/opt/conda/bin:/opt/conda/envs/bio/bin:/opt/conda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/rstudio-server/bin/postback:/usr/lib/rstudio-server/bin/postback:/usr/lib/rstudio-server/bin/postback:/opt/conda/envs/bio/bin
(base) student@ad992674a9d9:~$ conda activate meth
(meth) student@ad992674a9d9:~$ echo $PATH
/opt/conda/envs/bio/bin:/home/student/.conda/envs/meth/bin:/opt/conda/bin:/opt/conda/condabin:/opt/conda/envs/bio/bin:/opt/conda/bin:/opt/conda/envs/bio/bin:/opt/conda/bin:/opt/conda/envs/bio/bin:/opt/conda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/rstudio-server/bin/postback:/usr/lib/rstudio-server/bin/postback:/usr/lib/rstudio-server/bin/postback:/opt/conda/envs/bio/bin
(meth) student@ad992674a9d9:~$ which multiqc
/opt/conda/envs/bio/bin/multiqc
(meth) student@ad992674a9d9:~$ cat /mnt/meth/conda_envs/meth.yaml | grep 'multiqc'
  - multiqc=1.9
(meth) student@ad992674a9d9:~$ multiqc --version^C
(meth) student@ad992674a9d9:~$ cat /mnt/meth/conda_envs/meth.yaml | grep 'python'
  - python=3.7
  - ipython=7.19.0
(meth) student@ad992674a9d9:~$ which python
/opt/conda/envs/bio/bin/python
(meth) student@ad992674a9d9:~$ python --version
Python 2.7.17 :: Anaconda, Inc.
(meth) student@ad992674a9d9:~$ multiqc --version
/opt/conda/envs/bio/lib/python2.7/site-packages/multiqc-1.0.dev0-py2.7.egg/multiqc/utils/config.py:44: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
  configs = yaml.load(f)
/opt/conda/envs/bio/lib/python2.7/site-packages/multiqc-1.0.dev0-py2.7.egg/multiqc/utils/config.py:50: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
  sp = yaml.load(f)
multiqc, version 1.0.dev0
iromeo commented 4 years ago

Line PATH="/opt/conda/bin:${PATH}"' >> ~/.profile also isn't valid, instead should be

/home/student/.bashrc:

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/opt/conda/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/opt/conda/etc/profile.d/conda.sh" ]; then
        . "/opt/conda/etc/profile.d/conda.sh"
    else
        export PATH="/opt/conda/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda initialize <<<