GithubHelp home page GithubHelp logo

tableau / tabpy Goto Github PK

View Code? Open in Web Editor NEW
1.5K 108.0 578.0 1.75 MB

Execute Python code on the fly and display results in Tableau visualizations:

Home Page: https://tableau.github.io/TabPy/

License: MIT License

Python 99.17% HTML 0.53% Dockerfile 0.09% Shell 0.17% Procfile 0.05%
tabpy tableau tabpy-tutorial startup python analytical-models

tabpy's Introduction

TabPy

Tableau Supported GitHub

GitHub Workflow Status Coverage Status Scrutinizer Code Quality Requirements Status

PyPI - Python Version PyPI version

Deploy

TabPy (the Tableau Python Server) is an Analytics Extension implementation which expands Tableau's capabilities by allowing users to execute Python scripts and saved functions via Tableau's table calculations.

Consider reading TabPy documentation in the following order:

Important security note:

  • By default, TabPy is configured without username/password authentication. We strongly advise using TabPy only with authentication enabled. For more information, see TabPy Server Configuration Instructions. Without authentication in place, if the TABPY_EVALUATE_ENABLE feature is enabled (as it is by default), there is the possibility that unauthenticated individuals could remotely execute code on the machine running TabPy. Leaving these two settings in their default states together is highly discouraged.

Troubleshooting:

More technical topics:

Other useful resources:

GitHub commit activity

tabpy's People

Contributors

0golovatyi avatar antesaj avatar bberan avatar belliveaujd avatar benlower avatar cgore1 avatar chairmanma0 avatar dleskosky avatar evaliula avatar harold-xi avatar hlee12 avatar hxi1 avatar jakeichikawasalesforce avatar jayvdb avatar jesspencer avatar jmoens avatar jnegara avatar johng42 avatar jtweeder avatar lelandweathers avatar neilgoldman avatar nmannheimer avatar phantomcosmonaut avatar raspnote avatar rrap0so avatar rxing-tableau avatar sbabayan avatar sulaxd avatar vtucherov avatar willayd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tabpy's Issues

Why does TabPy can't find endpoints of my function??

I have successfully deployed the function, but the tableau pop this error,

The endpoint you're trying to query did not respond. Please make sure the endpoint exists and the correct set of arguments are provided.

what is happen here??

Cross OS client.deploy() fails due to OS specific path issues

If you deploy from a Windows tabpy client to a Linux tabpy server the deploy will fail. This seems due to the fact that the client constructs part of the destination path on the client platform then concatenates that path part to a server path resulting in a path of the form /bla/bla\bla\bla this is not a valid Linux path.

Here is an example:

`
def ztest(p1, p2, n1, n2):
import math
def zstat(p1, p2, n1, n2):
p1 = float(p1)
try:
return (p1 - p2) / math.sqrt((p1 * (1 - p1))/n1 + (p2 * (1 - p2))/n2)
except TypeError: # handle the first value where p2, n2 return as None
return 0
return [zstat(p1, p2, n1, n2) for (p1, p2, n1, n2) in zip(p1, p2, n1, n2)]

client = tabpy_client.Client('http://tabpyserver:9004/')
client.deploy('ztest', ztest, 'ztest for tabPy Demo')
`
The error is:

WARNING:tabpy_client.query_object:Overwriting existing file '/home/ubuntu/anaconda/envs/Tableau-Python-Server/lib/python2.7/site-packages/tabpy_server/staging\endpoints\ztest\1' when saving query object ERROR:tabpy_client.rest:Error with server response. code=500; text={"info": "Error when /add_endpoint: Traceback\n Traceback (most recent call last):\n File \"/home/ubuntu/anaconda/envs/Tableau-Python-Server/lib/python2.7/site-packages/tabpy_server/tabpy.py\", line 307, in post\n err_msg = yield self._add_or_update_endpoint('add', name, 1, request_data)\n File \"/home/ubuntu/anaconda/envs/Tableau-Python-Server/lib/python2.7/site-packages/tornado/gen.py\", line 1008, in run\n value = future.result()\n File \"/home/ubuntu/anaconda/envs/Tableau-Python-Server/lib/python2.7/site-packages/tornado/concurrent.py\", line 232, in result\n raise_exc_info(self._exc_info)\n File \"/home/ubuntu/anaconda/envs/Tableau-Python-Server/lib/python2.7/site-packages/tornado/gen.py\", line 1014, in run\n yielded = self.gen.throw(*exc_info)\n File \"/home/ubuntu/anaconda/envs/Tableau-Python-Server/lib/python2.7/site-packages/tabpy_server/tabpy.py\", line 185, in _add_or_update_endpoint\n yield self._copy_po_future(src_path, target_path)\n File \"/home/ubuntu/anaconda/envs/Tableau-Python-Server/lib/python2.7/site-packages/tornado/gen.py\", line 1008, in run\n value = future.result()\n File \"/home/ubuntu/anaconda/envs/Tableau-Python-Server/lib/python2.7/site-packages/tornado/concurrent.py\", line 232, in result\n raise_exc_info(self._exc_info)\n File \"/home/ubuntu/anaconda/envs/Tableau-Python-Server/lib/python2.7/site-packages/tornado/gen.py\", line 1014, in run\n yielded = self.gen.throw(*exc_info)\n File \"/home/ubuntu/anaconda/envs/Tableau-Python-Server/lib/python2.7/site-packages/tabpy_server/tabpy.py\", line 231, in _copy_po_future\n ret = yield future\n File \"/home/ubuntu/anaconda/envs/Tableau-Python-Server/lib/python2.7/site-packages/tornado/gen.py\", line 1008, in run\n value = future.result()\n File \"/home/ubuntu/anaconda/envs/Tableau-Python-Server/lib/python2.7/site-packages/concurrent/futures/_base.py\", line 400, in result\n return self.__get_result()\n File \"/home/ubuntu/anaconda/envs/Tableau-Python-Server/lib/python2.7/site-packages/concurrent/futures/_base.py\", line 359, in __get_result\n reraise(self._exception, self._traceback)\n File \"/home/ubuntu/anaconda/envs/Tableau-Python-Server/lib/python2.7/site-packages/concurrent/futures/_compat.py\", line 107, in reraise\n exec('raise exc_type, exc_value, traceback', {}, locals_)\n File \"/home/ubuntu/anaconda/envs/Tableau-Python-Server/lib/python2.7/site-packages/concurrent/futures/thread.py\", line 61, in run\n result = self.fn(*self.args, **self.kwargs)\n File \"/home/ubuntu/anaconda/envs/Tableau-Python-Server/lib/python2.7/site-packages/tabpy_server/tabpy.py\", line 59, in copy_from_local\n shutil.copytree(localpath, remotepath)\n File \"/home/ubuntu/anaconda/envs/Tableau-Python-Server/lib/python2.7/shutil.py\", line 171, in copytree\n names = os.listdir(src)\nOSError: [Errno 2] No such file or directory: '/home/ubuntu/anaconda/envs/Tableau-Python-Server/lib/python2.7/site-packages/tabpy_server/staging\\\\endpoints\\\\ztest\\\\1'\n\nError type : OSError\nError message : [Errno 2] No such file or directory: '/home/ubuntu/anaconda/envs/Tableau-Python-Server/lib/python2.7/site-packages/tabpy_server/staging\\\\endpoints\\\\ztest\\\\1'\n", "message": "error adding endpoint"}

Missing dependencies: numpy

I was trying to play around with the examples in the tabpy server and client but had an issue while using the add endpoint even after deploying it.

I tried the following:

curl -X POST http://localhost:9004/evaluate
-d '{"data": {"_arg1":1, "_arg2":2},
"script": "return tabpy.query("add", x=_arg1, y=_arg2)["response"]"}'

This was the error I got:

 info Error when POST /evaluate: Traceback
 Traceback (most recent call last):
  File "/home/vathsala/anaconda2/envs/Tableau-Python-Server/lib/python2.7/site-packages/tabpy_server/tabpy.py", line 468, in post
    result = yield self.call_subprocess(function_to_evaluate, arguments)
  File "/home/vathsala/anaconda2/envs/Tableau-Python-Server/lib/python2.7/site-packages/tornado/gen.py", line 1008, in run
    value = future.result()
  File "/home/vathsala/anaconda2/envs/Tableau-Python-Server/lib/python2.7/site-packages/tornado/concurrent.py", line 232, in result
    raise_exc_info(self._exc_info)
  File "/home/vathsala/anaconda2/envs/Tableau-Python-Server/lib/python2.7/site-packages/tornado/gen.py", line 1014, in run
    yielded = self.gen.throw(*exc_info)
  File "/home/vathsala/anaconda2/envs/Tableau-Python-Server/lib/python2.7/site-packages/tabpy_server/tabpy.py", line 489, in call_subprocess
    ret = yield future
  File "/home/vathsala/anaconda2/envs/Tableau-Python-Server/lib/python2.7/site-packages/tornado/gen.py", line 1008, in run
    value = future.result()
  File "/home/vathsala/anaconda2/envs/Tableau-Python-Server/lib/python2.7/site-packages/concurrent/futures/_base.py", line 400, in result
    return self.__get_result()
  File "/home/vathsala/anaconda2/envs/Tableau-Python-Server/lib/python2.7/site-packages/concurrent/futures/_base.py", line 359, in __get_result
    reraise(self._exception, self._traceback)
  File "/home/vathsala/anaconda2/envs/Tableau-Python-Server/lib/python2.7/site-packages/concurrent/futures/_compat.py", line 107, in reraise
    exec('raise exc_type, exc_value, traceback', {}, locals_)
  File "/home/vathsala/anaconda2/envs/Tableau-Python-Server/lib/python2.7/site-packages/concurrent/futures/thread.py", line 61, in run
    result = self.fn(*self.args, **self.kwargs)
  File "<string>", line 2, in _user_script
KeyError: 'response'

When I removed response and tried

curl -X POST http://localhost:9004/evaluate -d '{"data": {"_arg1":1, "_arg2":2},
"script": "return tabpy.query("add", x=_arg1, y=_arg2)"}'

I got the error telling me numpy was missing.

I installed numpy and all was well, but maybe the documentation needs updating, as well as have the server return better error messages?

Setup Issues on Mac OSX Sierra

Tried the installation instructions and had issues with the permissions on setup.sh. After I resolved that by running chmod +x setup.sh I was able to complete the setup. In the log it looks like everythign was good, however I get a message "Installation Failed" at the very end.

I then proceeded to try and start the server by running startup.sh from the tabpy-server/tabpy_server/ dir and received a syntax error. Any tips on troubleshooting?

setup log

~~~~~~~~~~~~~~~  Downloading and installing Anaconda  ~~~~~~~~~~~~~~~
Anaconda installed already.
~~~~~~~~~~~~~~~  Activating the environment  ~~~~~~~~~~~~~~~
Conda env 'Tableau-Python-Server' already exists.
~~~~~~~~~~~~~~~  Installing dependencies  ~~~~~~~~~~~~~~~
Requirement already satisfied: awscli==1.6.2 in ./envs/Tableau-Python-Server/lib/python3.5/site-packages (from -r /Users/bensullins/git/TabPy/tabpy-server/requirements.txt (line 1))
Requirement already satisfied: futures==2.2.0 in ./envs/Tableau-Python-Server/lib/python3.5/site-packages (from -r /Users/bensullins/git/TabPy/tabpy-server/requirements.txt (line 2))
Requirement already satisfied: requests==2.3.0 in ./envs/Tableau-Python-Server/lib/python3.5/site-packages (from -r /Users/bensullins/git/TabPy/tabpy-server/requirements.txt (line 3))
Requirement already satisfied: simplejson==3.8.2 in ./envs/Tableau-Python-Server/lib/python3.5/site-packages (from -r /Users/bensullins/git/TabPy/tabpy-server/requirements.txt (line 4))
Requirement already satisfied: Tornado-JSON==1.2.0 in ./envs/Tableau-Python-Server/lib/python3.5/site-packages (from -r /Users/bensullins/git/TabPy/tabpy-server/requirements.txt (line 5))
Requirement already satisfied: tornado==4.3 in ./envs/Tableau-Python-Server/lib/python3.5/site-packages (from -r /Users/bensullins/git/TabPy/tabpy-server/requirements.txt (line 6))
Requirement already satisfied: cloudpickle in ./envs/Tableau-Python-Server/lib/python3.5/site-packages (from -r /Users/bensullins/git/TabPy/tabpy-server/requirements.txt (line 7))
Requirement already satisfied: six>=1.1.0 in ./envs/Tableau-Python-Server/lib/python3.5/site-packages (from awscli==1.6.2->-r /Users/bensullins/git/TabPy/tabpy-server/requirements.txt (line 1))
Requirement already satisfied: botocore<0.74.0,>=0.73.0 in ./envs/Tableau-Python-Server/lib/python3.5/site-packages (from awscli==1.6.2->-r /Users/bensullins/git/TabPy/tabpy-server/requirements.txt (line 1))
Requirement already satisfied: colorama==0.2.5 in ./envs/Tableau-Python-Server/lib/python3.5/site-packages (from awscli==1.6.2->-r /Users/bensullins/git/TabPy/tabpy-server/requirements.txt (line 1))
Requirement already satisfied: docutils>=0.10 in ./envs/Tableau-Python-Server/lib/python3.5/site-packages (from awscli==1.6.2->-r /Users/bensullins/git/TabPy/tabpy-server/requirements.txt (line 1))
Requirement already satisfied: rsa==3.1.2 in ./envs/Tableau-Python-Server/lib/python3.5/site-packages (from awscli==1.6.2->-r /Users/bensullins/git/TabPy/tabpy-server/requirements.txt (line 1))
Requirement already satisfied: bcdoc<0.13.0,>=0.12.0 in ./envs/Tableau-Python-Server/lib/python3.5/site-packages (from awscli==1.6.2->-r /Users/bensullins/git/TabPy/tabpy-server/requirements.txt (line 1))
Requirement already satisfied: jsonschema>=2.3.0 in ./envs/Tableau-Python-Server/lib/python3.5/site-packages (from Tornado-JSON==1.2.0->-r /Users/bensullins/git/TabPy/tabpy-server/requirements.txt (line 5))
Requirement already satisfied: jmespath==0.5.0 in ./envs/Tableau-Python-Server/lib/python3.5/site-packages (from botocore<0.74.0,>=0.73.0->awscli==1.6.2->-r /Users/bensullins/git/TabPy/tabpy-server/requirements.txt (line 1))
Requirement already satisfied: python-dateutil>=2.1 in ./envs/Tableau-Python-Server/lib/python3.5/site-packages (from botocore<0.74.0,>=0.73.0->awscli==1.6.2->-r /Users/bensullins/git/TabPy/tabpy-server/requirements.txt (line 1))
Requirement already satisfied: pyasn1>=0.1.3 in ./envs/Tableau-Python-Server/lib/python3.5/site-packages (from rsa==3.1.2->awscli==1.6.2->-r /Users/bensullins/git/TabPy/tabpy-server/requirements.txt (line 1))
Processing /Users/bensullins/git/TabPy/tabpy-client
  Requirement already satisfied (use --upgrade to upgrade): tabpy-client==0.1 from file:///Users/bensullins/git/TabPy/tabpy-client in ./envs/Tableau-Python-Server/lib/python3.5/site-packages
Requirement already satisfied: cloudpickle in ./envs/Tableau-Python-Server/lib/python3.5/site-packages (from tabpy-client==0.1)
Requirement already satisfied: decorator in ./envs/Tableau-Python-Server/lib/python3.5/site-packages (from tabpy-client==0.1)
Requirement already satisfied: python-dateutil in ./envs/Tableau-Python-Server/lib/python3.5/site-packages (from tabpy-client==0.1)
Requirement already satisfied: requests in ./envs/Tableau-Python-Server/lib/python3.5/site-packages (from tabpy-client==0.1)
Requirement already satisfied: genson in ./envs/Tableau-Python-Server/lib/python3.5/site-packages (from tabpy-client==0.1)
Requirement already satisfied: jsonschema in ./envs/Tableau-Python-Server/lib/python3.5/site-packages (from tabpy-client==0.1)
Requirement already satisfied: six>=1.5 in ./envs/Tableau-Python-Server/lib/python3.5/site-packages (from python-dateutil->tabpy-client==0.1)
Building wheels for collected packages: tabpy-client
  Running setup.py bdist_wheel for tabpy-client ... done
  Stored in directory: /Users/bensullins/Library/Caches/pip/wheels/05/52/e3/c9eaeed9f6770750a325976dc72677090b224f6047270a5049
Successfully built tabpy-client
Processing /Users/bensullins/git/TabPy/tabpy-server
  Requirement already satisfied (use --upgrade to upgrade): tabpy-server==0.1 from file:///Users/bensullins/git/TabPy/tabpy-server in ./envs/Tableau-Python-Server/lib/python3.5/site-packages
Requirement already satisfied: cloudpickle in ./envs/Tableau-Python-Server/lib/python3.5/site-packages (from tabpy-server==0.1)
Requirement already satisfied: decorator in ./envs/Tableau-Python-Server/lib/python3.5/site-packages (from tabpy-server==0.1)
Requirement already satisfied: python-dateutil in ./envs/Tableau-Python-Server/lib/python3.5/site-packages (from tabpy-server==0.1)
Requirement already satisfied: requests in ./envs/Tableau-Python-Server/lib/python3.5/site-packages (from tabpy-server==0.1)
Requirement already satisfied: genson in ./envs/Tableau-Python-Server/lib/python3.5/site-packages (from tabpy-server==0.1)
Requirement already satisfied: jsonschema in ./envs/Tableau-Python-Server/lib/python3.5/site-packages (from tabpy-server==0.1)
Requirement already satisfied: tabpy_client in ./envs/Tableau-Python-Server/lib/python3.5/site-packages (from tabpy-server==0.1)
Requirement already satisfied: six>=1.5 in ./envs/Tableau-Python-Server/lib/python3.5/site-packages (from python-dateutil->tabpy-server==0.1)
Building wheels for collected packages: tabpy-server
  Running setup.py bdist_wheel for tabpy-server ... done
  Stored in directory: /Users/bensullins/Library/Caches/pip/wheels/a0/fd/cb/20ea1aa20fa4d12d3399c8dab2110ad062ca52853ef9e6429c
Successfully built tabpy-server
~~~~~~~~~~~~~~~~~  Installation failed  ~~~~~~~~~~~~~~~~

startup log

Found existing state.ini
  File "/Users/bensullins/git/TabPy/tabpy-server/tabpy_server/tabpy.py", line 103
    print info
             ^
SyntaxError: Missing parentheses in call to 'print'

Unable to start Taby server on Windows 10

I'm getting this error whenever I click on external connection, "RServe: An error has occurred during connection to localhost:9004: No connection could be made because the target machine actively refused it ExtSvc: Couldn't connect to server"
I tried all possible ways, I'm using Python 2.7.
Kindly advice on this.
capture

Deploying objects on the TabPy server

Hi,

I think it would be great if there was the option to deploy not only functions but also objects on the TabPy server.

I am using scikit-learn models to predict values in Tableau. Currently, when having a pre-trained model (a Python object), I store it in a pickle file and read it from the file system every time I execute my TabPy deployed function.

Deploying the object to the TabPy server can save the trouble of manually managing pickle files. It may also slightly improve performance (considering my use case).

Best regards,
Ivan

Datetimes

Is there currently functionality around datetimes? I couldn't put one in and bring it back. I was originally using a module called businesstimedelta, but the error is the same for a simple function such as the one below. I have used tabpy successfully for integers, strings, and real. If I'm way off base and datetimes do function, could you provide an example with a deployed function and if you have time a function located in the Tableau calculated field? Thanks in advance for the help and for developing tabpy - the integration is extremely useful.

The below script gives me an non-existent endpoint error.

`import tabpy_client
import datetime

connection = tabpy_client.Client('http://localhost:9004/')

def string(x):
x_str = str(x)
x_dt = datetime.datetime.strptime(x_str, '%Y-%m-%d %H:%M:%S')
x_dt_str = str(x_dt)
return x_dt_str

connection.deploy('string', string, 'string -> datetime -> string', override = True)`

The endpoint you're trying to query did not respond. Please make sure the endpoint exists and the correct set of arguments are provided.

Hi,

I have installed tabpy according to the user manual and I have implemented the example breast cancer problem mentioned in the tutorial. The python script on the jupyter notebook runs fine without errors and I checked the connection of tableau to the server which is present. But still I am unable to run the code in tableau.

This is the python script:
import math
import numpy as np
import pandas as pd
from sklearn.grid_search import GridSearchCV
from sklearn.linear_model import LogisticRegressionCV
from sklearn.naive_bayes import GaussianNB
from sklearn import preprocessing, metrics, svm, ensemble
from sklearn.metrics import accuracy_score, classification_report
import tabpy_client

connection =tabpy_client.Client('http://localhost:9004/')

def SuggestDiagnosis(Cl_thickness, Cell_size, Cell_shape, Marg_adhesion, Epith_c_size,
Bare_nuclei, Bl_cromatin, Normal_nucleoli, Mitosis):
x = np.column_stack([Cl_thickness, Cell_size, Cell_shape, Marg_adhesion, Epith_c_size,
Bare_nuclei, Bl_cromatin, Normal_nucleoli, Mitosis])
x = scalar.transform(x)
return encoder.inverse_transform(gbclf.predict(x)).tolist()
connection.deploy('DiagnosticsDemo',SuggestDiagnosis,
'Returns diagnosis suggestion based on ensemble model trained using Wisconisn Breast Cancer dataset')

This is the calculation I have put in Tableau:
SCRIPT_STR("return tabpy.query('DiagnosticsDemo',_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8,_arg9)['response']",
[Cell Thickness], [Cell Size], [Cell Shape], [Marginal Adhesion], [Epithelial Cell Size],
[Bare Nuclei], [Bland Cromatin], [Normal Nucleoli], [Mitosis])

These are the errors I get when I try to change values in tableau to predict:
An error occurred while communicating with the Predictive Service.
Error processing script
The endpoint you're trying to query did not respond. Please make sure the endpoint exists and the correct set of arguments are provided.

Can you please help me out in resolving this issue. If you want any additional information, please let me know.

Thank you

Unable to Connect to Python, after the TabPy start

Hello,

I see the TabPy server has successfully started :

Starting the server for the first time...

Initializing TabPy...
Done initializing TabPy.
Web service listening on port 9004

But when Connecting from Tableau, using "External connection" It throws the below message

RServe: Rserve is busy or not responding. Failed to create socket to Rserve. ExtSvc: 403: <title>Access Denied</title> <style type="text/css"> </style>

Access Denied

An access request has been blocked due to one of the following reasons:
  • You do not have sufficient privileges to access this destination
  • Your corporate IT policies prohibit access to this content or application
  • McAfee Global Threat Intelligence has determined
    • this destination to have a suspicious or malicious reputation at this time
    • something in the connection that matches a threat defense signature
    • malware, spyware or other content should be blocked
Please contact your administrator if you feel this is incorrect.

Not able to use Python Calculated field into View-"Syntax error on Server End point"

Syntax Error after placing the calculated field into view.

  1. I was able to setup the tabpy with instruction -worked well
  2. I was able to connect to tabpy server from tableau Desktop 10.1 - Connection Successfull
  3. Created a calculated field with below info as it is in Documentation -
    SCRIPT_REAL(
    "import numpy as np
    return np.corrcoef(_arg1,_arg2[0,1]",SUM([Sales]),SUM([Profit]))

I was able to create the above Calculated field without any Error.

  1. When i drag drop the field into view getting the following error ..
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    Error processing script
    Error when POST /evaluate: Traceback
    Traceback (most recent call last):
    File "tabpy.py", line 468, in post
    result = yield self.call_subprocess(function_to_evaluate, arguments)
    File "C:\Users\ctsuser1\Anaconda\envs\Tableau-Python-Server\lib\site-packages\tornado\gen.py", line 1008, in run
    value = future.result()
    File "C:\Users\ctsuser1\Anaconda\envs\Tableau-Python-Server\lib\site-packages\tornado\concurrent.py", line 232, in result
    raise_exc_info(self._exc_info)
    File "C:\Users\ctsuser1\Anaconda\envs\Tableau-Python-Server\lib\site-packages\tornado\gen.py", line 282, in wrapper
    yielded = next(result)
    File "tabpy.py", line 483, in call_subprocess
    exec(function_to_evaluate)
    File "", line 3
    return np.corrcoef(_arg1,_arg2[0,1]
    ^
    SyntaxError: invalid syntax
    Error type : SyntaxError
    Error message : invalid syntax (, line 3)
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

Tried with all Example but none of the simple example is working and every thing throwing syntax error "An Error Occurred while communicating to predictive service"
...
Syntax error in return ... blah blah .

End point Test:
I am able to deploy end point no issue here is successful end point deployment

def add(x,y):
... import numpy as np
... return np.add(x, y).tolist()
...
client.deploy('add', add, 'Adds two numbers x and y')
add(5,6)
11

Query method of Client fails because of incorrect timeout value

Walking through the Client Tutorial and I got as far as trying to query the function I just deployed. I get an error from urllib:
ValueError: Attempted to set connect timeout to 0.0, but the timeout cannot be set to a value less than or equal to 0.

Code snippet to reproduce (copied from tutorial):

import tabpy_client

client = tabpy_client.Client('http://localhost:9004/')

def clustering(x, y):
    import numpy as np
    from sklearn.cluster import DBSCAN
    from sklearn.preprocessing import StandardScaler
    X = np.column_stack([x, y])
    X = StandardScaler().fit_transform(X)
    db = DBSCAN(eps=1, min_samples=3).fit(X)
    return db.labels_.tolist()

client.deploy('clustering',
                clustering,
                'Returns cluster Ids for each data point specified by the pairs in x and y')

x = [6.35, 6.40, 6.65, 8.60, 8.90, 9.00, 9.10]
y = [1.95, 1.95, 2.05, 3.05, 3.05, 3.10, 3.15]

client.query('clustering', x, y)

ValueErrorTraceback (most recent call last)
in ()
2 y = [1.95, 1.95, 2.05, 3.05, 3.05, 3.10, 3.15]
3
----> 4 client.query('clustering', x, y)

/Tableau-Python-Server/lib/python2.7/site-packages/tabpy_client/client.pyc in query(self, name, *args, **kwargs)
187 uuid : a unique id for the request.
188 """
--> 189 return self._service.query(name, *args, **kwargs)
190
191 #

/Tableau-Python-Server/lib/python2.7/site-packages/tabpy_client/rest_client.pyc in query(self, name, *args, **kwargs)
151 return self.service_client.POST('query/'+name,
152 data={'data':args or kwargs},
--> 153 timeout=self.query_timeout)
154
155

/Tableau-Python-Server/lib/python2.7/site-packages/tabpy_client/rest.pyc in POST(self, url, data, timeout)
170 def POST(self, url, data=None, timeout=None):
171 """Prepends self.endpoint to the url and issues a POST request."""
--> 172 return self.network_wrapper.POST(self.endpoint + url, data, timeout)
173
174 def PUT(self, url, data=None, timeout=None):

/Tableau-Python-Server/lib/python2.7/site-packages/tabpy_client/rest.pyc in POST(self, url, data, timeout)
104 'content-type': 'application/json',
105 },
--> 106 timeout=timeout)
107 if response.status_code not in (200, 201):
108 self.raise_error(response)

/Tableau-Python-Server/lib/python2.7/site-packages/requests/sessions.pyc in post(self, url, data, json, **kwargs)
533 """
534
--> 535 return self.request('POST', url, data=data, json=json, **kwargs)
536
537 def put(self, url, data=None, **kwargs):

/Tableau-Python-Server/lib/python2.7/site-packages/requests/sessions.pyc in request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)
486 }
487 send_kwargs.update(settings)
--> 488 resp = self.send(prep, **send_kwargs)
489
490 return resp

/Tableau-Python-Server/lib/python2.7/site-packages/requests/sessions.pyc in send(self, request, **kwargs)
607
608 # Send the request
--> 609 r = adapter.send(request, **kwargs)
610
611 # Total elapsed time of the request (approximately)

/Tableau-Python-Server/lib/python2.7/site-packages/requests/adapters.pyc in send(self, request, stream, timeout, verify, cert, proxies)
407 raise ValueError(err)
408 else:
--> 409 timeout = TimeoutSauce(connect=timeout, read=timeout)
410
411 try:

/Tableau-Python-Server/lib/python2.7/site-packages/requests/packages/urllib3/util/timeout.pyc in init(self, total, connect, read)
92
93 def init(self, total=None, connect=_Default, read=_Default):
---> 94 self._connect = self._validate_timeout(connect, 'connect')
95 self._read = self._validate_timeout(read, 'read')
96 self.total = self._validate_timeout(total, 'total')

/Tableau-Python-Server/lib/python2.7/site-packages/requests/packages/urllib3/util/timeout.pyc in _validate_timeout(cls, value, name)
131 raise ValueError("Attempted to set %s timeout to %s, but the "
132 "timeout cannot be set to a value less "
--> 133 "than or equal to 0." % (name, value))
134 except TypeError: # Python 3
135 raise ValueError("Timeout value %s was %s, but it must be an "

ValueError: Attempted to set connect timeout to 0.0, but the timeout cannot be set to a value less than or equal to 0.

Windows Error

Hi, in trying to run TabPy server using the startup.bat command but I get an error message (WindowsError 5) regarding access to temp folders. Is there a way to run TabPy without creating temporary folders?
Or are there other solutions to this error?

image

Error adding endpoint to TabPy Server on Google Cloud VM Instance

Hi,

We've been trying to get a TabPy server running on a Google Cloud VM so that we can deploy models from Datalab. I've installed TabPy and the server is running fine - navigating to the ip address in a browser brings up the Tableau logo, and I'm able to connect Tableau to the predictive service and execute python code using the SCRIPT_ functions - however I'm getting an error when using the client to deploy from Datalab.

Using the code:

import tabpy_client
client = tabpy_client.Client('http://{0}:9004/').format(server_ip)

def add(x,y):
    import numpy as np
    return np.add(x, y).tolist()

client.deploy('add', add, 'Adds two numbers x and y')

Brings up the error:

image

I may well have overlooked something in getting it set up as it is working fine locally, but can't work out what's causing it.

Thanks in advance,

Adam

Publishing to Tableau Online

I was able to replicate the work presented in the following blog, using a different data set of interest, https://www.tableau.com/about/blog/2017/1/building-advanced-analytics-applications-tabpy-64916
where Bora used Breast Cancer data set, completed model training within jupyter notebook, and deployed the best model as a function to Tableau via tabpy_client. The calculated field which I created which works via parameter control works well on Tableau Desktop. I would like to publish to Tableau Online to share my work, but have the following error raised "The workbook you are attempting to publish contains scripts for an external service. External service scripts are not allowed in public workbooks."

I understand that external connection to jupyter notebook causes this error, but I would like to know what is the best way to publish to online version ie. should I use .py connection or inline python scripting within Tableau (similar to what was completed in the Seattle Police Department example).

Best,
Orysya

Issue with installing TabPy

Hi, this is what I receive when I download TabPy.

Anaconda installed already.
~~~~~~~~~~~~~~~  Activating the environment  ~~~~~~~~~~~~~~~
Conda env 'Tableau-Python-Server' already exists.
~~~~~~~~~~~~~~~  Installing dependencies  ~~~~~~~~~~~~~~~
Processing /Users/brianlin1000/Desktop/TabPy-master/tabpy-client
  Requirement already satisfied (use --upgrade to upgrade): tabpy-client==0.2 from file:///Users/brianlin1000/Desktop/TabPy-master/tabpy-client in ./envs/Tableau-Python-Server/lib/python3.6/site-packages
Requirement already satisfied: cloudpickle in ./envs/Tableau-Python-Server/lib/python3.6/site-packages (from tabpy-client==0.2)
Requirement already satisfied: decorator in ./envs/Tableau-Python-Server/lib/python3.6/site-packages (from tabpy-client==0.2)
Requirement already satisfied: python-dateutil in ./envs/Tableau-Python-Server/lib/python3.6/site-packages (from tabpy-client==0.2)
Requirement already satisfied: requests in ./envs/Tableau-Python-Server/lib/python3.6/site-packages (from tabpy-client==0.2)
Requirement already satisfied: genson in ./envs/Tableau-Python-Server/lib/python3.6/site-packages (from tabpy-client==0.2)
Requirement already satisfied: jsonschema in ./envs/Tableau-Python-Server/lib/python3.6/site-packages (from tabpy-client==0.2)
Requirement already satisfied: six>=1.5 in ./envs/Tableau-Python-Server/lib/python3.6/site-packages (from python-dateutil->tabpy-client==0.2)
Building wheels for collected packages: tabpy-client
  Running setup.py bdist_wheel for tabpy-client ... done
  Stored in directory: /Users/brianlin1000/Library/Caches/pip/wheels/dd/6d/46/d32a062442736c91b86e2a68ffe482ddb45d13e35a1813d210
Successfully built tabpy-client
Processing /Users/brianlin1000/Desktop/TabPy-master/tabpy-server
  Requirement already satisfied (use --upgrade to upgrade): tabpy-server==0.2 from file:///Users/brianlin1000/Desktop/TabPy-master/tabpy-server in ./envs/Tableau-Python-Server/lib/python3.6/site-packages
Requirement already satisfied: future in ./envs/Tableau-Python-Server/lib/python3.6/site-packages (from tabpy-server==0.2)
Requirement already satisfied: futures in ./envs/Tableau-Python-Server/lib/python3.6/site-packages (from tabpy-server==0.2)
Requirement already satisfied: requests in ./envs/Tableau-Python-Server/lib/python3.6/site-packages (from tabpy-server==0.2)
Requirement already satisfied: simplejson in ./envs/Tableau-Python-Server/lib/python3.6/site-packages (from tabpy-server==0.2)
Requirement already satisfied: Tornado-JSON in ./envs/Tableau-Python-Server/lib/python3.6/site-packages (from tabpy-server==0.2)
Requirement already satisfied: tornado in ./envs/Tableau-Python-Server/lib/python3.6/site-packages (from tabpy-server==0.2)
Requirement already satisfied: cloudpickle in ./envs/Tableau-Python-Server/lib/python3.6/site-packages (from tabpy-server==0.2)
Requirement already satisfied: decorator in ./envs/Tableau-Python-Server/lib/python3.6/site-packages (from tabpy-server==0.2)
Requirement already satisfied: python-dateutil in ./envs/Tableau-Python-Server/lib/python3.6/site-packages (from tabpy-server==0.2)
Requirement already satisfied: genson in ./envs/Tableau-Python-Server/lib/python3.6/site-packages (from tabpy-server==0.2)
Requirement already satisfied: jsonschema in ./envs/Tableau-Python-Server/lib/python3.6/site-packages (from tabpy-server==0.2)
Requirement already satisfied: tabpy_client in ./envs/Tableau-Python-Server/lib/python3.6/site-packages (from tabpy-server==0.2)
Requirement already satisfied: numpy in ./envs/Tableau-Python-Server/lib/python3.6/site-packages (from tabpy-server==0.2)
Requirement already satisfied: six>=1.5 in ./envs/Tableau-Python-Server/lib/python3.6/site-packages (from python-dateutil->tabpy-server==0.2)
Building wheels for collected packages: tabpy-server
  Running setup.py bdist_wheel for tabpy-server ... done
  Stored in directory: /Users/brianlin1000/Library/Caches/pip/wheels/75/5b/d6/9673e0df71a45fef46acf76b0fc9ae29bc91f434ebe8d2e894
Successfully built tabpy-server
~~~~~~~~~~~~~~~~~  Installation failed  ~~~~~~~~~~~~~~~~

I'm not sure why it is not installing.

TabPy is slow

When I pass data to TabPy, I wait 10s before to start to excute the python function. This time increases when I pass more data from Tableau to TabPy. It is normal ? What do I do to reduce this time?

Daemon mode?

Does TabPy currently have some sort of daemon mode built in? If not, what's the current recommended practice - screen/tmux? Docker container?

Tabpy installation fails

Hi, Let me ask one question:
Our customer trying to install Tabpy on MAC OS.
When running sh setup.sh , it fails with following logs.
Please give me advice on how to install Tabpy on MAC.

MAC-0035N:TabPy gm3293$ sh setup.sh

Anaconda installed already.
prepending //anaconda/bin to PATH
~~~~~~~~~~~~~~~ Activating the environment ~~~~~~~~~~~~~~~
Conda env 'Tableau-Python-Server' already exists.
prepending //anaconda/envs/Tableau-Python-Server/bin to PATH
~~~~~~~~~~~~~~~ Installing dependencies ~~~~~~~~~~~~~~~
Processing /Users/gm3293/TabPy/tabpy-client
Requirement already satisfied (use --upgrade to upgrade): tabpy-client==0.2 from file:///Users/gm3293/TabPy/tabpy-client in ./envs/Tableau-Python-Server/lib/python3.5/site-packages
Requirement already satisfied (use --upgrade to upgrade): cloudpickle in ./envs/Tableau-Python-Server/lib/python3.5/site-packages (from tabpy-client==0.2)
Requirement already satisfied (use --upgrade to upgrade): decorator in ./envs/Tableau-Python-Server/lib/python3.5/site-packages (from tabpy-client==0.2)
Requirement already satisfied (use --upgrade to upgrade): python-dateutil in ./envs/Tableau-Python-Server/lib/python3.5/site-packages (from tabpy-client==0.2)
Requirement already satisfied (use --upgrade to upgrade): requests in ./envs/Tableau-Python-Server/lib/python3.5/site-packages (from tabpy-client==0.2)
Requirement already satisfied (use --upgrade to upgrade): genson in ./envs/Tableau-Python-Server/lib/python3.5/site-packages (from tabpy-client==0.2)
Requirement already satisfied (use --upgrade to upgrade): jsonschema in ./envs/Tableau-Python-Server/lib/python3.5/site-packages (from tabpy-client==0.2)
Requirement already satisfied (use --upgrade to upgrade): six>=1.5 in ./envs/Tableau-Python-Server/lib/python3.5/site-packages (from python-dateutil->tabpy-client==0.2)
Building wheels for collected packages: tabpy-client
Running setup.py bdist_wheel for tabpy-client ... done
Stored in directory: /Users/gm3293/Library/Caches/pip/wheels/f5/75/7a/7335361e6574d929e9815d4d8cdd7c24de279153f0cc3e3001
Successfully built tabpy-client
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Processing /Users/gm3293/TabPy/tabpy-server
Requirement already satisfied (use --upgrade to upgrade): tabpy-server==0.2 from file:///Users/gm3293/TabPy/tabpy-server in ./envs/Tableau-Python-Server/lib/python3.5/site-packages
Requirement already satisfied (use --upgrade to upgrade): future in ./envs/Tableau-Python-Server/lib/python3.5/site-packages (from tabpy-server==0.2)
Requirement already satisfied (use --upgrade to upgrade): futures in ./envs/Tableau-Python-Server/lib/python3.5/site-packages (from tabpy-server==0.2)
Requirement already satisfied (use --upgrade to upgrade): requests in ./envs/Tableau-Python-Server/lib/python3.5/site-packages (from tabpy-server==0.2)
Requirement already satisfied (use --upgrade to upgrade): simplejson in ./envs/Tableau-Python-Server/lib/python3.5/site-packages (from tabpy-server==0.2)
Requirement already satisfied (use --upgrade to upgrade): Tornado-JSON in ./envs/Tableau-Python-Server/lib/python3.5/site-packages (from tabpy-server==0.2)
Requirement already satisfied (use --upgrade to upgrade): tornado in ./envs/Tableau-Python-Server/lib/python3.5/site-packages (from tabpy-server==0.2)
Requirement already satisfied (use --upgrade to upgrade): cloudpickle in ./envs/Tableau-Python-Server/lib/python3.5/site-packages (from tabpy-server==0.2)
Requirement already satisfied (use --upgrade to upgrade): decorator in ./envs/Tableau-Python-Server/lib/python3.5/site-packages (from tabpy-server==0.2)
Requirement already satisfied (use --upgrade to upgrade): python-dateutil in ./envs/Tableau-Python-Server/lib/python3.5/site-packages (from tabpy-server==0.2)
Requirement already satisfied (use --upgrade to upgrade): genson in ./envs/Tableau-Python-Server/lib/python3.5/site-packages (from tabpy-server==0.2)
Requirement already satisfied (use --upgrade to upgrade): jsonschema in ./envs/Tableau-Python-Server/lib/python3.5/site-packages (from tabpy-server==0.2)
Requirement already satisfied (use --upgrade to upgrade): tabpy-client in ./envs/Tableau-Python-Server/lib/python3.5/site-packages (from tabpy-server==0.2)
Requirement already satisfied (use --upgrade to upgrade): numpy in ./envs/Tableau-Python-Server/lib/python3.5/site-packages (from tabpy-server==0.2)
Requirement already satisfied (use --upgrade to upgrade): six>=1.5 in ./envs/Tableau-Python-Server/lib/python3.5/site-packages (from python-dateutil->tabpy-server==0.2)
Building wheels for collected packages: tabpy-server
Running setup.py bdist_wheel for tabpy-server ... done
Stored in directory: /Users/gm3293/Library/Caches/pip/wheels/50/db/71/f27071d4a2cafa208f19a43bc95f14a6d1b497d401c59355e7
Successfully built tabpy-server
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
~~~~~~~~~~~~~~~~~ Installation failed ~~~~~~~~~~~~~~~~
MAC-0035N:TabPy gm3293$ pip install --upgrade pip
Requirement already up-to-date: pip in /anaconda/lib/python3.5/site-packages

TabPy logs - server just crashes

Hi,

My TabPy server seems to suddenly crash with no warning. Is there a log somewhere that shows what might have happened?

Vlad

RuntimeError: LoadFailed: 'Load failed: range() integer end argument expected, got list.'

I get this error when I deploy this Gradient Boosting Regressor model in our server.

This is my function:

def gBRModel(f, i, p, r):
    X = np.transpose([f, i, p, r]).astype(np.float64)
    X = scaler.transform(X)
    return gBR.predict(X).tolist()

When I run it on my local server Jupyter Notebook on Python 3.6 Windows. It works:

image

I rewrote the script in our server ipython running Python 2.7 because of the common bug (Cross OS client.deploy()) and the fact that our remote TabPy is on 2.7 .

But when I try to deploy it in our remote linux server with Python 2.7, it does not work.

client.deploy('gBoost',
gBRModel,
'Returns the predicted GTI score given fatalities, injuries, properties and rank', override = True)

image

I get this error. Any thoughts?

Error on executing setup.bat

Hi,

Whenever I try to install the setup.bat file the installation runs for a while but stops on this error:

install_fail

any ideas what is going on here?

Kind Regards,
Tim Dries

Hosting TabPy on sub-directories

Hello dear maintainer,

it is currently not possible to host TabPy Server on a subdirectory such as myserver.com/mytabpyinstance.
Aside from being inflexible, this also makes tabpy easy to find via portscans, especially when running on the default port.
I've whipped up a small PR that allows someone to specify a subdirectory in the state.ini.

-Felix

Python 3 compatibility

Thanks so much for posting this integration!

I'm working on a fork for python3 compatibility https://github.com/samuelleach/TabPy

I'm not an expert on migrating code from 2.7 to 3.5 but the changes in the above fork seem to start the server (I need to test it soon).

@BBeran Do you foresee any real roadblocks migrating to 3.5?

How to Run Tabadmin for TabPy Server

I have the TabPy server running in Python 3.6 on the same machine as Tableau desktop. Connecting to it in Tableau 10.2 and clicking "Test Connection" results in this error: External Service: The external server is busy or not responding. Failed to create socket to it. ExtSvc: Timeout was reached.

Based on this error, I think I need to extend the timeout threshold with tabadmin set vizqlserver.extsvc.connect_timeout_ms ####. I tried running this command in the folder where the TabPy files live (/lib/site-packages/tabpy_server). This results in 'tabadmin' is not recognized as an internal or external command, operable program or batch file. Where should I run tabadmin? The examples for tabadmin say to run it in the Tableau Server location in Program Files. However, I don't have this location, and I'm not attempting to connect to Tableau Server.

I do not have administrator rights on my laptop, and I realize it may be a firewall issue. However, I got through the mprtia error by using 127.0.0.1 instead of localhost in the Tableau connection to the TabPy server.

Thank you for any insight!

Tabpy Installation failed

Any help please. Getting the following error when installing from windows

image

C:\Users\yyy1k64\Documents\TabPy-master>setup.bat
Server will be initialized using port: 9004


Existing Anaconda installation found.

~~~~~~~~~~~~~~~~~~~~~~~~  Activating the environment  ~~~~~~~~~~~~~~~~~~~~~~~~~

Found existing Tableau-Python-Server environment.
C:\Users\yyy1k64\Anaconda\envs\Tableau-Python-Server
Activating environment "Tableau-Python-Server"...

~~~~~~~~~~~~~~~~~~~~~~~~~~  Installing dependencies  ~~~~~~~~~~~~~~~~~~~~~~~~~~

Processing c:\users\yyy1k64\documents\tabpy-master\tabpy-client
Collecting cloudpickle (from tabpy-client==0.2)
  Could not find a version that satisfies the requirement cloudpickle (from tabp
y-client==0.2) (from versions: )
No matching distribution found for cloudpickle (from tabpy-client==0.2)
Processing c:\users\yyy1k64\documents\tabpy-master\tabpy-server
Collecting future (from tabpy-server==0.2)
  Could not find a version that satisfies the requirement future (from tabpy-ser
ver==0.2) (from versions: )
No matching distribution found for future (from tabpy-server==0.2)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~  Installation failed  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Error - Python code

Hi,

I was able to install and connect tableau with TabPy Server, but when I tried to create a calculated field with python code, it returned an error:
TypeError : unsupported operand type(s) for +: 'float' and 'NoneType'

Could you give me a help on what is wrong and how can I troubleshoot this kind of error?

Thanks in advance.
I'm sending the images of the calculated field and the error.

image

image

tabpy_client.rest.ResponseError: (500) Error querying GLS {'uri': 'calc_periodic_index_return_df', 'error': "AttributeError : 'TypeError' object has no attribute 'message'", 'type': 'QueryFailed'}

I am getting a 500. Internally, I am trying to call an API which does index return calculation. Below is the code. Can someone please tell me why? When calling the API alone, it works fine but not after deploying using Tabpy.

def calc_periodic_index_return_df(date, exposure, return_type='simple'):
import pandas as pd
import requests

df_exposure = pd.DataFrame({ 'Date':date, 'Exposure': exposure })
res = requests.post('<api URL>', json=df_exposure.to_json()
                    , headers=<header>
                    , params={'returnType': return_type})
return res

Thanks so much.
Roy

installation failed on ubuntu 16

Hello,

I have issues trying to install it on ubuntu behind a corporate issue.

I can't find any wait to customize the proxy in the setup.sh file

Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f4c4f130650>, 'Connection to pypi.python.org timed out. (connect timeout=15)')': /simple/genson/

Issue with installing TabPy

Running into problem installing TabPy. It runs through the script and seems to have built both the tabpy server and tabpy client, but the installation still says that it has failed. See attached screenshot.
installation failed
Not sure what it means or what to do to correct the issue. Please advise.

An error Occurred while communicating with the Predictive Service

i'm using a very simple script that works on the tabpy server through ipython server console but when I add this to tableau I get the following error

Here is what's in tableau:
SCRIPT_REAL(
"return tabpy.query('subtract2', _arg1, _arg2)['response']",SUM([6]),SUM([5])
)

Here is the Error Block
Error processing script
Error when POST /evaluate: Traceback
Traceback (most recent call last):
File "tabpy.py", line 467, in post
result = yield self.call_subprocess(function_to_evaluate, arguments)
File "C:\Users\SCrocker\Anaconda\envs\Tableau-Python-Server\lib\site-packages\tornado\gen.py", line 1008, in run
value = future.result()
File "C:\Users\SCrocker\Anaconda\envs\Tableau-Python-Server\lib\site-packages\tornado\concurrent.py", line 232, in result
raise_exc_info(self._exc_info)
File "C:\Users\SCrocker\Anaconda\envs\Tableau-Python-Server\lib\site-packages\tornado\gen.py", line 1014, in run
yielded = self.gen.throw(*exc_info)
File "tabpy.py", line 488, in call_subprocess
ret = yield future
File "C:\Users\SCrocker\Anaconda\envs\Tableau-Python-Server\lib\site-packages\tornado\gen.py", line 1008, in run
value = future.result()
File "C:\Users\SCrocker\Anaconda\envs\Tableau-Python-Server\lib\site-packages\concurrent\futures_base.py", line 400, in result
return self.__get_result()
File "C:\Users\SCrocker\Anaconda\envs\Tableau-Python-Server\lib\site-packages\concurrent\futures_base.py", line 359, in __get_result
reraise(self._exception, self.traceback)
File "C:\Users\SCrocker\Anaconda\envs\Tableau-Python-Server\lib\site-packages\concurrent\futures_compat.py", line 107, in reraise
exec('raise exc_type, exc_value, traceback', {}, locals
)
File "C:\Users\SCrocker\Anaconda\envs\Tableau-Python-Server\lib\site-packages\concurrent\futures\thread.py", line 61, in run
result = self.fn(*self.args, **self.kwargs)
File "", line 2, in _user_script
KeyError: 'response'
Error type : KeyError
Error message : 'response'

Python calls the Java code, and then calls the Python program using TabPy. The first calculation succeeds, and when it is recalculated, the table is computed, and then the Python will hang up.

Python calls the Java code, and then calls the Python program using TabPy. The first calculation succeeds, and when it is recalculated, the table is computed, and then the Python will hang up.

SCRIPT_STR("import jpype
import os.path
jarpath = os.path.join(os.path.abspath('.'), 'E:/resource/test.jar')
if not jpype.isJVMStarted():
jpype.startJVM(jpype.getDefaultJVMPath(),'-ea', '-Djava.class.path=%s' % jarpath)

jprint = jpype.java.lang.System.out.println
JDClass = jpype.JClass('com.Utils')
a = JDClass()

text = a.encryptData_ECB(_arg[0])

return text",ATTR([็ป†ๅˆ†]))

Cannot setup

I ran setup.bat, and ran into a failed install. I also tried installing manually, but in both cases I have one error. During the "pip install -r ./tabpy-server/requirements.txt" command I get "no such file or directory". And indeed, there is no tabpy-server directory anywhere in the Anaconda directory. I'm assuming one of the previous commands didn't retrieve it or something.

Tableau Desktop can't connect to the TabPy service

Hi All,
I have installed TabPy service on my Windows 7 machine as stated. I started the service through Administrator cmd and its running on Port 9004. The browser is showing the tableau icon on http://localhost:9004 and i can see the service running using netstat -na at the same port.
When I use External Service Connection Dialog inside Tableau 10.2.0 to test this connection it says "an error occurred while communication...." The details are
External Service: The external server is busy or not responding. Failed to create socket to it. ExtSvc: 504:<TITLE>Unknown Host</TITLE>

Unknown Host


Description: Unable to locate the server named "localhost" --- the server does not have a DNS entry. Perhaps there is a misspelling in the server name, or the server no longer exists. Double-check the name and try again.

Any help?
Thanks!

Getting RServe error while conencting to TabPy

Hi All,

I am quite new to Tableau. Wanted to connect Tableau to Python. As per the instruction mentioned, I installed TabPy server and started it. But while Testing the connection using Tableau ( Help --> Manage External Service Connection : Sever as 127.0.0.1 and Port as 9004). I am unable to Test connection. It gives me below error:
RServe: Rserve is busy or not responding. Failed to create socket to Rserve. ExtSvc: Server returned nothing (no headers, no data)

I was Earlier using Rserve to connect Tableau to R to access Python code using rPython.

Not sure, where I am doing wrong. Any help will be appreciated. Thanks.

Regards
Amir

Error while using Tableau with TabPy

Hi!

I currently have my TabPy server running on the localhost under port 9004. However, when I try to drag a pill containing a python script, I receive these comments and errors from the command line:
error

the pill contains this script:
error1

Additionally, Tableau gives me this error:
error2
and in show details it says invalid JSON.

If you can help me with this issue, it would be greatly appreciated!

Thanks!

RuntimeError: LoadFailed: 'Load failed: code() takes at most 14 arguments (15 given)

Hello -

I'm attempting to deploy a model but I am receiving the below error message. What I'm trying to do is call the model from Tableau, use a string parameter to pass new text, and return the spam prediction based on the string input. I tested my function within my notebook and it's working as expected so I'm trying to understand the error raised by the # of arguments.

My notebook is here: https://github.com/GirlMeetsData/data_analysis/blob/master/TabPy%20Example%20-%20Naive%20Bayes%20to%20Detect%20Spam.ipynb

Error Message:

/Users/brit.cava/anaconda/envs/snakes/lib/python3.5/site-packages/tabpy_client/client.py in deploy(self, name, obj, description, schema, override)
330 self._service.set_endpoint(_Endpoint(**obj))
331
--> 332 self._wait_for_endpoint_deployment(obj['name'], obj['version'])
333
334 def _gen_endpoint(self, name, obj, description, version=1, schema=[]):

/Users/brit.cava/anaconda/envs/snakes/lib/python3.5/site-packages/tabpy_client/client.py in _wait_for_endpoint_deployment(self, endpoint_name, version, interval)
451 if ep['status'] == 'LoadFailed':
452 raise RuntimeError("LoadFailed: %r" % (
--> 453 ep['last_error'],
454 ))
455

RuntimeError: LoadFailed: 'Load failed: code() takes at most 14 arguments (15 given)'

Thanks!
Brit

Getting error occurred while communicating with predictive service message.

I deployed a function that performs sentiment analysis to the tabpy server via the tabpy client and i am able to query it, with it returning the expected result via the client using the query method. But when i try to do the same via a calculated field in Tableau:

SCRIPT_REAL("return ('polarity',_arg1)['response']",ATTR([F1]))

I get this error message:

Error processing script
Error when POST /evaluate: Traceback
Traceback (most recent call last):
File "tabpy.py", line 467, in post
result = yield self.call_subprocess(function_to_evaluate, arguments)
File "C:\Users\toguntuga\Anaconda\envs\Tableau-Python-Server\lib\site-packages\tornado\gen.py", line 1008, in run
value = future.result()
File "C:\Users\toguntuga\Anaconda\envs\Tableau-Python-Server\lib\site-packages\tornado\concurrent.py", line 232, in result
raise_exc_info(self._exc_info)
File "C:\Users\toguntuga\Anaconda\envs\Tableau-Python-Server\lib\site-packages\tornado\gen.py", line 1014, in run
yielded = self.gen.throw(*exc_info)
File "tabpy.py", line 488, in call_subprocess
ret = yield future
File "C:\Users\toguntuga\Anaconda\envs\Tableau-Python-Server\lib\site-packages\tornado\gen.py", line 1008, in run
value = future.result()
File "C:\Users\toguntuga\Anaconda\envs\Tableau-Python-Server\lib\site-packages\concurrent\futures_base.py", line 400, in result
return self.__get_result()
File "C:\Users\toguntuga\Anaconda\envs\Tableau-Python-Server\lib\site-packages\concurrent\futures_base.py", line 359, in __get_result
reraise(self._exception, self.traceback)
File "C:\Users\toguntuga\Anaconda\envs\Tableau-Python-Server\lib\site-packages\concurrent\futures_compat.py", line 107, in reraise
exec('raise exc_type, exc_value, traceback', {}, locals
)
File "C:\Users\toguntuga\Anaconda\envs\Tableau-Python-Server\lib\site-packages\concurrent\futures\thread.py", line 61, in run
result = self.fn(*self.args, **self.kwargs)
File "", line 2, in _user_script
KeyError: 'response'
Error type : KeyError
Error message : 'response'

Am i doing something wrong with how i have the calculated field written in tableau?

Setup ignores installed Anaconda3

I have Anaconda3 on Windows, and tried to run a setup. Setup script told me "No existing Anaconda installations found". It then proceeded to download it's own Anaconda and failed.

I tried doing a fresh install of Anaconda3, and it did not help.

Unable to execute python code from calculated field

Hi All,

For installation I followed the steps in the github: https://github.com/tableau/TabPy/blob/master/server.md#setup-on-windows so that it is installed on the same machine as Tableau Desktop (version 10.1.5, Windows 10).

I installed the TabPy server, by downloading the zip and running the startup.bat, this in turn installs Anaconda and after a while it mentions it is running and listening on port 9004.

Next I perform the steps in Tableau desktop to connect to it: Help > Settings and Performance > External Service Connection, and add as server localhost and port 9004. I check the connection and it responds that it can communicate with the Predictive Service.

Using the blog found here: https://www.tableau.com/about/blog/2016/12/using-python-sentiment-analysis-tableau-63606 I performed a test drive. I removed all the comments to have the calculated field accept the code, and get to the following;

SCRIPT_REAL(
"
from nltk.sentiment import SentimentIntensityAnalyzer

text = _arg1
scores = []
sid = SentimentIntensityAnalyzer()

for word in text:
ss = sid.polarity_scores(word)
scores.append(ss['compound'])

return scores"
,ATTR([Word]))

When executing the calculated field, it returns;

Error processing script
ImportError : No module named sentiment

The blogpost found here nltk/nltk#1259 points to a version issue wrt NLTK therefore I upgraded conda, python and nltk accordingly, with all versions meeting requirements.

After restarting the python server it still responds with;

ERROR:main:{"info": "ImportError : No module named sentiment", "ERROR": "Error processing script"}
ERROR:tornado.access:500 POST /evaluate (::1) 35.00ms

Okay, so maybe something is still an issue related to the NLTK package, so I try steps found in another blog, where the following calculated field is defined;

SCRIPT_REAL(
"import numpy as np
return np.corrcoef(_arg1,_arg2)[0,1]",SUM([Sales]),SUM([Profit]))

this results in no errors but warnings;

C:\Users<user>\Anaconda\envs\Tableau-Python-Server\lib\site-packages\numpy\lib\function_base.py:1890: RuntimeWarning: Degrees of freedom <= 0 for slice
warnings.warn("Degrees of freedom <= 0 for slice", RuntimeWarning)
C:\Users<user>\Anaconda\envs\Tableau-Python-Server\lib\site-packages\numpy\lib\function_base.py:1901: RuntimeWarning: invalid value encountered in true_divide
return (dot(X, X.T.conj()) / fact).squeeze()

yet nothing happens in the accompanied workbook or views.

In some other case this script results in the output;

Error processing script
TypeError : unsupported operand type(s) for +: 'float' and 'NoneType'

Any clue why the tableau python server (seems to) refuse to handle the requests from calculated fields with python scripts in Tableau?

Kind regards,

Tim

An error occurred while communicating with the Predictive Service.

Hi All,
I would like to try Correlation coefficient analysis with Python on tableau.Then I create a new calculated field.
image
but tableau return the error :An error occurred while communicating with the Predictive Service.
image

I want to know How to deal with this.
thanks very much for your help.

When login in to TABPY there comes and error

Hey

Have installed TABPY perfectly on my windows 10 computer. But when trying to login to TABPY from TABLEAU it writes the following error message

image

I have been using the Rserver before on this computer, but it havn't been turn on for a long time, so its weird why Tableau still refers to it.

How to use the function after function deployment?

I have successfully deploy the function.

client.deploy('add_test', add_test, 'Adds test for two numbers x and y',override=True)

but I can't import or use it in tableau. How do I use it exactly??

An error occurred while communicating with the Predictive Service.
Error processing script
NameError : global name 'add_test' is not defined

Grand Totals on a TabPy calc return incorrect values

Grand Totals don't work well with TabPy calcs.

(using Superstore data set) This calc SCRIPT_REAL("return [1]", ATTR([Segment])) returns 1's when displayed against the Segment dimension. The Grand Total is also 1, which is incorrect as it should be 3 in this "table viz".

Upon further digging, we find if Grand Totals are displayed and the python code attempts to make use of the Segment dimension as an input, then python will receive [None] as an input with what seems to be a second call python.

The implication is you can't easily combine Grand Totals with TabPy calcs:

  • Trying to compute the Grand Total inside python isn't possible because the dimension is passed along to python as ['Consumer', 'Corporate', 'Home Office'] in one call to TabPy and [None] in a second call. The first list isn't available to python during the second call to be able to figure out the total on the python side (during the second call).
  • Relying on Tableau to calculate Grand Totals will produce the incorrect Grand Total of the TabPy calc.

Tableau 10.2.0 No connection to tabpy

Hi All,

I installed the latest Tabpy version in my OS (win7, Tableau Version 10.2.0). The installation was successful and the "Tableau-Python-Server" instance was created. Just after the installation the server started itself without problems using the startup.bat script.

Now I am having the following issue, when I open tableau or a workbook in Tableau with Python code I am not able to create a connection, I am following the steps described in the Github documentation, but I keep getting the same error:
image

I know, the error-message is in German, but I guess the important is the one in English.

I did not see any errors while installing Tabpy, and the server seems to be running:
[Tableau-Python-Server] C:\Users\RODRIR\Anaconda\envs\Tableau-Python-Server\Lib
site-packages\tabpy_server>startup.bat
Deactivating environment "Tableau-Python-Server"...
Activating environment "Tableau-Python-Server"...
Initializing TabPy...
Done initializing TabPy.
Web service listening on port 9004

Did I miss something? why I am not able to create a connection?

Hope someone can help me here.

Error connecting to endpoint.

Hello,

I commented on this article you posted but realized this is a better place to post this issue I'm facing.

I'm attempting to reproduce your ML code and breast cancer example in Tableau. I used your Jupyter notebook to run the code and deploy it to the TabPy client. I then created the parameters and calculation you used in Tableau. Once I tried to use it, I got this error:

Tableau Error: The endpoint you're trying to query did not respond. Please make sure the endpoint exists and the correct set of arguments are provided.

I checked the Jupyter notebook again to ensure I didn't miss any error messages and each step ran properly (aside from warnings about deprecated things). In fact, I when running the code again I saw this error:

RuntimeError: An endpoint with that name ('DiagnosticsDemo') already exists. Use 'override = True' to force update an existing endpoint.

Do you have any recommendations on how to troubleshoot this or any suspicions as to why I wouldn't be able to to communicate with the endpoint? I am running TabPy successfully and verified I'm successfully connected.

Thanks,
Brit

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.