Skip to content

Instantly share code, notes, and snippets.

@thomasmooon
Last active January 9, 2020 07:18
Show Gist options
  • Save thomasmooon/20d2e673e4033e848aac2a9aeda71057 to your computer and use it in GitHub Desktop.
Save thomasmooon/20d2e673e4033e848aac2a9aeda71057 to your computer and use it in GitHub Desktop.
.bashrc file conda
# in order to load the .bashrc by default, it must be in the `.bash_profile`
# https://askubuntu.com/questions/161249/bashrc-not-executed-when-opening-new-terminal
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/home/bit/ashar/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/home/bit/ashar/anaconda3/etc/profile.d/conda.sh" ]; then
. "/home/bit/ashar/anaconda3/etc/profile.d/conda.sh"
else
export PATH="/home/bit/ashar/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
export PATH=~/anaconda3/bin:$HOME/curl/bin:$PATH
export R_USER=/home/bit/ashar/R
export R_LIBS="/home/bit/ashar/R/x86_64-pc-linux-gnu-library/3.6"
# example b-it servers anaconda installation
## purpose
recipe to run anaconda3 on the b-it server. there are two cases
### case 1
check if anaconda is installed.
- go to your home folder, look for an anconda folder, go into that folder and check the content
if it is installed, but you can't start it via typing `conda` in the terminal, then probably the
executable is not in the path and some initialization is missing,
then create/adapt the `.bashrc` in your home folder accordingly.
in addition create/adapt the `.bash_profile` in your home folder accordingly.
after you adapted/created the `.bashrc` and the `.bash_profile`, exit from terminal and reconnect.
if everything went fine, conda will be started automatically in the `base` env when connecting to the server.
### case 2
if anaconda isn't installed, follow the _## step by step installation_ procedure below.
## step by step installation
first, get the proper/desired version from https://www.anaconda.com/distribution/.
for the b-it case it’s https://repo.anaconda.com/archive/Anaconda3-2019.10-Linux-x86_64.sh
login to b-it server and download the file, eg `wget https://repo.anaconda.com/archive/Anaconda3-2019.10-Linux-x86_64.sh`
open a screen so that the installation can run in the background: `screen -R inst_anaconda`
start the setup, in this case: `bash Anaconda3-2019.10-Linux-x86_64.sh` and follow the setup instructions.
this may take a while!
then detach from screen using `CTRL + A + D`.
to re-attach to the screen later from the console, do `screen -r inst_anaconda`
if the installation has finished, exit from the attached screen with `exit + ENTER`
## check the installation
type `conda`. if this doesn't work, then create/update the `.bashrc` and `.bash_profile` file as described before in _### case 1_ section.
finally, enter `conda update --all --yes` to update anaconda.
# references
see the conda cheat sheet https://docs.conda.io/projects/conda/en/4.6.0/_downloads/52a95608c49671267e40c689e0bc00ca/conda-cheatsheet.pdf
using "screens" https://wiki.ubuntuusers.de/Screen/
https://mas-dse.github.io/startup/anaconda-ubuntu-install/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment