Closed caitlyngUR closed 5 years ago
@caitlyngUR What release of TabPy are you running? You can confirm it with curl localhost:9004/info
command.
For newer versions of TabPy it is tabpy_tools
you need to use, see more details here - https://github.com/tableau/TabPy/blob/master/docs/tabpy-tools.md. You may need to run pip install -e tabpy-tools
first for the steps to work.
I am running version 0.4
@caitlyngUR try pip install -e tabpy-tools
from the repo root folder to install tabpy-tools package and then follow the steps mentioned at https://github.com/tableau/TabPy/blob/master/docs/tabpy-tools.md.
@0golovatyi forgive me if this is trivial but I successfully installed in the Tabpy-master folder
I went through the the detailed post that you sent and everything seems to be in order but I am still getting the same error.
@caitlyngUR the main difference is you need to import tabpy-tools
and not tabpy-client
Sorry, this is the error I am getting...
Hi @caitlyngUR, are you running Jupyter in Anaconda? Is it possible that you are using multiple virtual environments and your Jupyter notebook is running in a different environment than the one you installed TabPy to?
@nmannheimer I am running Jupyter in Anaconda but I only have the one base environment.
Is that environment also where you installed TabPy? Ie did you run the 'activate ...' command before installing TabPy?
@nmannheimer yes it is installed in the same base(root) environment
@caitlyngUR Let's try this:
SET PYTHONPATH=.\tabpy-server;.\tabpy-tools;%PYTHONPATH%
@0golovatyi Okay that seemed to fix the original issue but then I am getting the following error:
1st Time I ran it:
Load failed: No module name 'sklearn'
2nd time:
Load failed: No module name 'keras'
When I import both of these in the beginning of the script I don't run into any errors
@caitlyngUR For all the modules you use in your model you need to install them for your Python environment with pip
, e.g. pip install sklearn
@0golovatyi I have them both installed and imported. They aren't throwing any errors throughout my script until I try and deploy the connection to TabPy server.
I would guess it means you run TabPy and your deployment code in different Python environments. If you stop running TabPy instance and run pip list
you can see if the packages are installed. And if they are not you'll need either to install them or use the same Python environment for both TabPy server and tabpy-tools deployment script.
So all of the modules seem to installed in the same environment:
But yet still getting this error:
I see console screenshot (is it Anaconda env?) and some other env (is it Jupiter or something similar)? My theory is the env you run deployment script is not the same as the env where tabpy server runs. If you run python from command line in the same console where you run pip you should be able to execute import sklearn
to prove the package can be used in that env.
@0golovatyi thank you! I seemed to have fixed that problem now. The Jupyter notebook runs with no errors but when I try to use the following calculation in Tableau it throws the following error:
I checked the localhost:9004/endpoints where my TabPy server is running:
And this is the error from the command line:
I've also checked to see if my model/function from Jupyter Notebook works and it seems to be working fine:
Hi @caitlyngUR when Tableau passes variables they are sent as lists to python, not single values (scalars). Looking at your code in block 20 in the last image you sent, it looks like you are expecting to receive single values in your function, so I suspect the lack of response from the endpoint is due to this. If you add index selectors to your code in your Tableau calculation, ie _arg1[0], _arg2[0], this should fix the problem.
@nmannheimer I tried adjusting the Tableau Calculation but I am getting the same error
Are you able to query the endpoint from your code as described in the query section here? https://github.com/tableau/TabPy/blob/master/docs/tabpy-tools.md
Hi @caitlyngUR , what happens if you pass the variables individually, ie connection.query('WineQuality', 6, .3, .3,...) instead of as a single tuple query_check? Also just to make sure on the last idea, did you add [0] to all variables in your Python code? Would you mind sending a picture of how your calculation looks now in Tableau?
Tried this instead connection.query('WineQuality', 6,.3,.3,2,.03,20,100,.98,3,.35,11)
but still getting the same error.
Also, here is the calc that still returns this error "Unable to complete action An error occurred while communicating with the External 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."
@caitlyngUR that's strange. Are you able to deploy and test a simple function like:
def add(x,y): return x + y
yeah that seems to work fine
Are all of your parameters the correct types that the model is expecting for each field? IE integer or float.
Yeah all of the parameters are set to datatype= float which is what each of the inputs are...
Could it be something with how I am returning the value?
So I have the model predicting what quality_bin a wine falls into (0,1,or 2). Then the function returns the inverse encoding:
And for Tableau I am starting off my calculation with SCRIPT_STR.
Hey @caitlyngUR , is it possible that you could send this jupyter notebook and data to nmannheimer@tableau.com so I can take a look?
The return type looks good, and the fact that you can deploy a simple function shows that TabPy tools is working as expected. Also, what library are you building your model with? Looking up the thread, I noticed you are importing keras, what API is it sitting on top of?
Hi @caitlyngUR , looking through your notebook I believe I've identified the issue: TabPy's model deployment service uses Pickle in Python. As has been documented in another feature request (https://github.com/tableau/TabPy/issues/120), and here: https://keras.io/getting-started/faq/ Keras does not fully support pickling of models. I've tested the same code with an sklearn logistic regression model to confirm that everything else is working as expected. This is something we would like to explore in the future, but as of now models from Keras are not supported by TabPy.
Ahhh I see. That would solve the problem. Thank you so much for all your help.
Caitlyn Garger | Business Intelligence Analyst C: (516) 474-8814 E: caitlyng@useready.commailto:caitlyng@useready.com [USEReady]http://t.sidekickopen69.com/e1t/c/5/f18dQhb0S7lC8dDMPbW2n0x6l2B9nMJW7t5XYg1p1FbvW1qMLx24WJ7JnW3MPft-56dGvtf7LtlY402?t=http://www.useready.com/&si=6407247951429632&pi=8004520d-daf8-44d0-cb4d-ad5897aab361
FAST TRACKING BUSINESS PERFORMANCE WITH ADVANCED BI, DATA AND SECURITY SOLUTIONS Follow Us: Twitterhttp://t.sidekickopen69.com/e1t/c/5/f18dQhb0S7lC8dDMPbW2n0x6l2B9nMJW7t5XYg1p1FbvW1qMLx24WJ7JnW3MPft-56dGvtf7LtlY402?t=https%3A%2F%2Ftwitter.com%2FUSEReadyInc&si=6407247951429632&pi=8004520d-daf8-44d0-cb4d-ad5897aab361 | Facebookhttp://www.facebook.com/usereadyinc | LinkedInhttp://t.sidekickopen69.com/e1t/c/5/f18dQhb0S7lC8dDMPbW2n0x6l2B9nMJW7t5XYg1p1FbvW1qMLx24WJ7JnW3MPft-56dGvtf7LtlY402?t=https%3A%2F%2Fwww.linkedin.com%2Fcompany%2Fuseready&si=6407247951429632&pi=8004520d-daf8-44d0-cb4d-ad5897aab361
From: nmannheimer notifications@github.com Sent: Monday, April 22, 2019 8:18 PM To: tableau/TabPy TabPy@noreply.github.com Cc: Caitlyn Garger caitlyng@useready.com; Mention mention@noreply.github.com Subject: Re: [tableau/TabPy] LoadFailed: "Load failed: No module named 'tabpy_client'" (#264)
Hi @caitlyngURhttps://github.com/caitlyngUR , looking through your notebook I believe I've identified the issue: TabPy's model deployment service uses Pickle in Python. As has been documented in another feature request (#120https://github.com/tableau/TabPy/issues/120), and here: https://keras.io/getting-started/faq/ Keras does not fully support pickling of models. I've tested the same code with an sklearn logistic regression model to confirm that everything else is working as expected. This is something we would like to explore in the future, but as of now models from Keras are not supported by TabPy.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/tableau/TabPy/issues/264#issuecomment-485596379, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ALWCOXLMJKQ72SYDUTIT5YDPRZITHANCNFSM4HHHN3JA.
@caitlyngUR Let's try this:
- in cmd navigate to you repo root folder
- run
SET PYTHONPATH=.\tabpy-server;.\tabpy-tools;%PYTHONPATH%
- start python
- try you script again
what is repo root folder?Pls help
@sahil0094 There is no repo folder unless you are developing for TabPy. If your scenario is using TabPy for Python script execution during Data Prep or Tableau viz calculation follow these instructions to install and configure TabPy - https://tableau.github.io/TabPy/
I am getting the following error when I go to publish a neural network model I had created to the TabPy localhost server:
I have already imported the module as so...
import tabpy_client
I even tried appending the PATH of the module to see if that would fix the issue...
And I have called the tabpy_client.Client previously with no error/warning:
connection = tabpy_client.Client('http://localhost:9004/')
I have already successfully connected to the localhost server through Tableau so it should run without a problem.
I am not sure as to what might be the issue. Any help would be fantastic!!