1. Install Python on your machine (or server)
A popular and easy way of doing it would be to through downloading and installing Anaconda.
2. Download TabPy server
Now we need to get the TabPy module. You can do this by downloading it through GitHub or by opening up Anaconda prompt on your machine and typing and running:
pip install tabpy
Note that there is also a package on the conda repository, which you could install as shown below but that is an old way of doing it.
conda install -c anaconda tabpy-server
You then type y and hit enter when it asks if you want to proceed.
Here is how that looks like.
3. Start TabPy server
If you downloaded TabPy using pip install tabpy (recommended way) then all you have to do to start the server is type and run:
tabpy
in your Anaconda prompt or other terminal where you used pip install tabpy earlier.
If you downloaded TabPy from GitHub and put it on your desktop you can get the address of your folder by clicking on the name like so:
Then in Anaconda promt you would want to type cd (cd is short for change directory) then your location and hit enter.
cd C:\\Users\\Alexander\\Desktop\\TabPy
Finally would want to type startup.cmd and hit enter.
Now it should be ready to run and look like this:
You can now minimize this window but don't close it until you're finished using TabPy in Tableau.
If you downloaded TabPy using Anaconda you can type and hit enter:
cd C:\\Users\\*your user name*\\Anaconda3\\pkgs\\tabpy-server-0.2-py37_1\\Lib\\site-packages\\tabpy_server
Finally you would want to type startup.bat and hit enter.
Now it should be ready to run and look like this:
4. Connect TabPy Server to Tableau Desktop
In Tableau go to:
Help > Settings and Performance > Manage External Connection
Select TabPy
Select Localhost
Make sure the port is 9004
If when you click 'Test Connection' you get the message 'Successfully connected to the external service.' then congratulations! You are ready to use Python in Tableau.
If you run into any issues, looking at the official documentation would be helpful: tableau.github.io/TabPy/
If you need more guidance or don't want to deal with this yourself, then by all means get in touch with us