These are instructions on how to install the Anaconda Python distribution on a remote Linux server. It should not matter which operating system your local machine is running. You can also use this method to install anaconda if you are sitting at a Linux workstation.
Log on to the remote server using a ssh client (unless you are sitting at the machine you want to install anaconda on).
On your local machine go to https://www.anaconda.com/distribution/#download-section
Select the Linux version as shown in the image below.
Right click on the 'Download' button and select 'Copy link address'. Always choose Python 3.x unless there is a very good reason to choose Python 2.x which becomes unsupported in 2020 (see https://pythonclock.org).
We will use a program called 'wget' to download the installation package. In the terminal on the remote server type 'wget' then right click with the mouse in the terminal window and choose 'Paste'.
Press the return key. The anaconda installation package, which at the time of writing this was called Anaconda3-2019.07-Linux-x86_64.sh will start to download on to the remote server.
The complete command should be something like that below.
wget https://repo.anaconda.com/archive/Anaconda3-2019.07-Linux-x86_64.sh
Install the package using the command
bash Anaconda3-2019.07-Linux-x86_64.shUse the tab key to complete long file names.
Accept the license terms.
Agree to the default location.
Now wait a while while the Anaconda is downloaded and installed.
Say yes to allow the installer to initialise Anaconda3 each time you log in. Log in again.
alias ana3='export PATH=/home/your username here/anaconda3/bin:${PATH}'When you type ana3 and your PATH will be ammended to put the anaconda bin directory first, making the anaconda python the default python.
Let's create a virtual environment called env1 which has a specific version of python3.
conda create -n env1 python=3.7.3 anacondaand the appropriate packages will be installed from the anaconda repositry. Lets activate this environment so we can use it.
conda activate env1Your prompt will change, and if you type 'which python' or 'python --version' you will find that the correct version of python is being called. You can stop using and environment or deactivate an environment using the command:
conda deactivateIf you decide that you no longer want to use this environment, you can delete it with the following command.
conda remove -n env1 --all
conda create -n data_conversion_prog anacondaMaybe you have some python2 code you want to use, despite the fact it is a bad idea, see https://pythonclock.org. You can install a version of python2 using this command:
conda create -n env_obsolete python=2.7.16 anacondaA full description of python environments can be found at https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html.
One solution is to stop it automatically becoming the default python on login, and make a command that you type to make it the default python later.
So log on to the remote server using putty or mobaXterm not x2go.
Edit your .bashrc file using this command
nano ~/.bashrcat the end of the file, you will see the stuff the anaconda installer put in there, it starts with
# >>> conda initialize >>>comment that stuff out by putting a '#' at the start of each line until you get to
# <<< conda initialize <<<then add this line:
alias ana3='export PATH=${HOME}/anaconda3/bin:$PATH'Then save your .bashrc and log out.
Try connecting with x2go again, it should work. But when you type
which pythonyou get the old system python, so type
ana3 which pythonyou should get the anaconda python as the default python.