graphistry / pygraphistry

PyGraphistry is a Python library to quickly load, shape, embed, and explore big graphs with the GPU-accelerated Graphistry visual graph analyzer
BSD 3-Clause "New" or "Revised" License
2.17k stars 206 forks source link

[BUG] demo notebook for_analysis.ipynb throws 500 Server Error: Internal Server Error for url: #572

Open DataBoyTX opened 4 months ago

DataBoyTX commented 4 months ago

Describe the bug

User reported this issue, but I recalled they were not using register function from previous conversation. Some visualizations run without register, but this one fails.

demo notebook for_analysis.ipynb throws 500 Server Error: Internal Server Error for url: http://...

To Reproduce

Run demo notebook for_analysis.ipynb on private server without register() and see failure on cell 5

error produced in the notebook:

---------------------------------------------------------------------------
HTTPError                                 Traceback (most recent call last)
Cell In[5], line 17
      1 hg1 = graphistry.hypergraph(
      2     df,
      3 
   (...)
     13         }
     14     })
     16 hg1_g = hg1['graph']
---> 17 hg1_g.plot()

File /opt/conda/lib/python3.10/site-packages/graphistry/PlotterBase.py:1401, in PlotterBase.plot(self, graph, nodes, name, description, render, skip_upload, as_files, memoize, extra_html, override_html_style, validate)
   1399     if skip_upload:
   1400         return dataset
-> 1401     info = PyGraphistry._etl1(dataset)
   1402 elif api_version == 3:
   1403     logger.debug("3. @PloatterBase plot: PyGraphistry.org_name(): {}".format(PyGraphistry.org_name()))

File /opt/conda/lib/python3.10/site-packages/graphistry/pygraphistry.py:2199, in PyGraphistry._etl1(dataset)
   2191 out_file = PyGraphistry._get_data_file(dataset, "json")
   2192 response = requests.post(
   2193     PyGraphistry._etl_url(),
   2194     out_file.getvalue(),
   (...)
   2197     verify=PyGraphistry._config["certificate_validation"],
   2198 )
-> 2199 response.raise_for_status()
   2201 try:
   2202     jres = response.json()

File /opt/conda/lib/python3.10/site-packages/requests/models.py:1021, in Response.raise_for_status(self)
   1016     http_error_msg = (
   1017         f"{self.status_code} Server Error: {reason} for url: {self.url}"
   1018     )
   1020 if http_error_msg:
-> 1021     raise HTTPError(http_error_msg, response=self)

HTTPError: 500 Server Error: Internal Server Error for url: http://nginx/etl?usertag=bafda75a-pygraphistry-0.33.8&agent=pygraphistry&apiversion=1&agentversion=0.33.8&key=b2c49a1a6e4c7367532c3b2d90905369
lmeyerov commented 4 months ago

Yeah I'm guessing plot without register, and for complex encodings, maybe missing api=3 (which we should default to as that's annoying, it's been a long time coming cc @mj3cheun @aucahuasi )

lmeyerov commented 4 months ago

RE:Automatic login in notebooks,

Looking a bit more, maybe we can shuttle the graphistry_jwt cookie in graphistry servers via a notebook extension: https://chatgpt.com/share/550c2c64-e1ae-4009-8fe4-ed67baf86f49

Alternatively, maybe we can make .plot() in an unregistered context pop a login?

(We would also have to strip the GRAPHISTRY_TOKEN etc env vars, which is over due anyways)