What Anaconda is can be explained in many ways depending on how and what you use is for. In the case of TabPy Anaconda serves as Python environments manager which allows having different Python environments (different versions of Python with a different set of packages) on the same machine. To learn more about Anaconda and where it can be used to start at https://www.anaconda.com/.
First question to ask is why you may need to use Python environments. There are many reasons. Couple of the most important are:
- Your OS may have old version of “system wide” Python (e.g. Python 2.7) and it is not easy (or not possible at all) to update it without breaking something, and
- You may want to isolate TabPy environment with packages it needs from your other environment (development, training models, etc.), or
- You may want to have multiple independent TabPy instances each with their own set of packages awailable.
To manage Python environments Anaconda is not the only option, you can use Python virtualenv tools for example – https://virtualenv.pypa.io/en/latest/. However Anaconda has some advantages like nice UI app to manages environments and packages, saving/restoring/sharing enviroments, support for R environments, etc.
And when for Windows and Mac you can use UI app in many cases for Linux GUI is not an option. In other words you will need to use command line. And this is what rest of this post shows how to do.
After login to a Linux machine, you need to download Anaconda installer from https://www.anaconda.com/distribution/. The following commands assume you are in your home folder (run
cd ~ to navigate to your home folder). On the Anaconda distribution page find the link for the latest version for Linux and run the following command:
Now when you have the installer in your home folder run it:
When the installer finishes add path to the Anaconda to the environment variable (this assumes
bash is your Linux shell):
echo 'export PATH="~/anaconda3/bin:$PATH"' >> ~/.bashrc
In the command above we add
bin from the user home folder to environment variable
PATH so anaconda commands can be found regardless of what is the current folder. If you installed Anaconda in a different location the command need to be modified properly.
Now let’s restart shell (or you can unlog and log in again):
Next let’s update Anaconda:
conda update conda
In the command above
conda is the tool which will let us perform different Anaconda operations.
Next step is to create new environment for TabPy:
conda create --name TabPy python=3.7
What happens in the command above is new environment with name TabPy is created and it has Python 3.7 available for it.
You can have as many environments as you need with different or the same Python versions. As all of them are isolated and do not interfere it is possible to have different sets of packages or the same packages of different versions in them.
Now we can activate the environment:
conda activate TabPy
If the command succeeds you’ll the command prompt is updated to have the environment name in it.
And now you can install TabPy and other packages:
python -m pip install --upgrade pip install tabpy tabpy
To exit from the environment run
For how to configure TabPy read http://tabscifi.golovatyi.info/2020/01/tabpy-modifying-default-configuration/.
[…] TabPy from other Python applications you may want to use Anaconda (additional reading – How to run TabPy with Anaconda on Linux), Python virtual environment or similar […]