Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on running Plotly with batch jobs on remote server #1068

Closed
apal90 opened this issue Jul 23, 2018 · 8 comments
Closed

Error on running Plotly with batch jobs on remote server #1068

apal90 opened this issue Jul 23, 2018 · 8 comments
Milestone

Comments

@apal90
Copy link

apal90 commented Jul 23, 2018

I am a regular user of Plotly with python, but only on my own computer, where I don't run more than a couple of instances of plotly at the same time. However, I now need to run several copies of my program, which uses plotly, simultaneously on a remote server. I use the following lines at the top of my code:

import plotly.plotly as py
py.sign_in('id','key') ## necessary for server simulations
This has worked for me all along, but I now get the error message:

plotly.exceptions.PlotlyError: Sign in failed.

So, what is going on? Do I need to pay even for offline use of Plotly?

@jonmmease
Copy link
Contributor

Hi @apal90 ,

If you run just a single job on the remote server does it work? I'm wondering if it's something about the server configuration, or it it's some issue with having a bunch of jobs trying to sign in at the same time.

Also, what version of plotly.py are you running? I ask because in version 3 we added logic to automatically retry server requests if they fail at first.

And finally, what is your desired visualization output from the server jobs? You might consider just using plotly.py's offline mode (Where there is no sign-in involved and no communication with the plot.ly servers). This forum post might be helpful: https://community.plot.ly/t/plotly-plots-on-server/10780

@apal90
Copy link
Author

apal90 commented Jul 26, 2018

@jonmmease Indeed, a single job does work fine. Even upto 10-12 jobs work without problems. If I try to submit more than than simultaneously, several of them terminate with one of two errors:

/usr/local/lib/python2.7/dist-packages/plotly/tools.py:103: UserWarning:
Looks like you don't have 'read-write' permission to your 'home' ('') directory or to our '/.plotly' >directory. That means plotly's python api can't setup local configuration files. No problem though! >You'll just have to sign-in using 'plotly.plotly.sign_in()'. For help with that: 'help(plotly.plotly.sign_in)'.
Questions? Visit https://support.plot.ly

or

File "/usr/local/lib/python2.7/dist-packages/plotly/plotly/plotly.py", line 67, in sign_in
raise exceptions.PlotlyError('Sign in failed.')
plotly.exceptions.PlotlyError: Sign in failed.

Here is the sum total of my Plotly declarations --

#from plotly.tools import set_credentials_file
set_credentials_file(username='aas', api_key='asdasdasdasd') #, stream_ids=['xx', 'xx'])
from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot

Is this not sufficient to run plotly offline? I don't see where I am trying to connect online. I only used the set_credentials_file because of the first error message displayed above. I thought I could not access Plotly even offline without credentials.

My Plotly version is 2.5.1, and my desired output is simple 3D scatter plots and triplots, which I save directly to disk, as advised in the forum post that you shared. Please let me know if the above information tells you anything. Will upgrading Plotly suffice?

@jonmmease
Copy link
Contributor

Hi @apal90 ,

Yes, you can use plotly offline without any credentials. But I'm not sure I'm following your example any more. Can you remove the call toset_credentials_file and then copy the full stack trace that you get for the first error? I want to understand which top-level plotly method is resulting in the error.

It would also be helpful if you could update to the current version (3.1.0). I don't expect that it will fix the issue, but it will make debugging easier.

@apal90
Copy link
Author

apal90 commented Jul 27, 2018

Hi @jonmmease ,

I am sorry, but I had made an error in reporting my code. Also, I upgraded to the latest version, but that does not solve my problems. My Plotly declarations are as follows --

import plotly.plotly as py
py.sign_in('apal90','asasdasd') ## necessary for server simulations

import plotly.graph_objs as go
import plotly.figure_factory as FF
from plotly.offline import plot, iplot

So, as you see, I already use the offline versions of plot, iplot. Also, it seems that at some time I had read something online that had made me think that signing in was necessary for server simulations. Perhaps it was the same error as below that prompted it; I don't remember any more.

The error I get is the following:

/usr/local/lib/python2.7/dist-packages/plotly/tools.py:102: UserWarning:

Looks like you don't have 'read-write' permission to your 'home' ('~') directory or to our '~/.plotly' directory. That means plotly's python api can't setup local configuration files. No problem though! You'll just have to sign-in using 'plotly.plotly.sign_in()'. For help with that: 'help(plotly.plotly.sign_in)'.
Questions? Visit https://support.plot.ly

And that's it. The other error message stopped appearing. Does that make anything clearer?

@jonmmease
Copy link
Contributor

Ok, I think I might see what's going on here. It looks like we're automatically checking for read-write permissions on the ~/.plotly directory even if we don't need it for credentials etc.

This warning message is a bit misleading since you still don't need to call plotly.plotly.sign_in() if you're working offline. My guess is that this message predates plotly.py's offline support.

Please remove the sign_in call and try again. This is a warning and not an error so your code should continue to execute after the warning is raised. Do you get the expected output for instances that raise the warning?

Once we sort this out I'll create an issue to work on removing this check when it's not needed and not raise the warning when working offline, but I don't expect the warning itself to cause a problem.

Thanks

@apal90
Copy link
Author

apal90 commented Jul 27, 2018

@jonmmease I removed the sign_in call, and I still get the same error. But yes, as you said, the code continued to execute, so I am thankful for that. Thanks!

@jonmmease
Copy link
Contributor

Great! So you can just ignore the warning for now (and if it really bothers you, you could also suppress it altogether: https://docs.python.org/3/library/warnings.html)

I'm going to close this issue in favor of #1076 now. Thanks for reporting this!

@jonmmease
Copy link
Contributor

See #1195 for full resolution

@jonmmease jonmmease added this to the v3.3.0 milestone Sep 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants