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

Plots doubled and problem closing ports #31

Open
ekwan opened this issue Aug 31, 2023 · 1 comment
Open

Plots doubled and problem closing ports #31

ekwan opened this issue Aug 31, 2023 · 1 comment

Comments

@ekwan
Copy link

ekwan commented Aug 31, 2023

Hi there,

With this code, I am seeing the interactive plot appear twice:

# generate a scatter plot
fig = px.scatter(plot_df, x="umap1", y="umap2", width=600, height=600)

# add molecules to the plotly graph - returns a Dash app
app = molplotly.add_molecules(fig=fig,
                            df=plot_df,
                            smiles_col='smiles'
                            )

# run Dash app inline in notebook (or in an external server)
app.run_server(mode='inline', port=8701, height=650)

Also, when I re-rerun this cell in Jupyter Lab, I get this error:

/Users/kwaneu/sw/miniconda/miniconda3/envs/python/lib/python3.11/site-packages/dash/dash.py:516: UserWarning:

JupyterDash is deprecated, use Dash instead.
See https://dash.plotly.com/dash-in-jupyter for more details.

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[49], line 11
      5 app = molplotly.add_molecules(fig=fig,
      6                             df=plot_df,
      7                             smiles_col='smiles'
      8                             )
     10 # run Dash app inline in notebook (or in an external server)
---> 11 app.run_server(mode='inline', port=8701, height=650) # height should be height+50

File ~/sw/miniconda/miniconda3/envs/python/lib/python3.11/site-packages/jupyter_dash/jupyter_app.py:222, in JupyterDash.run_server(self, mode, width, height, inline_exceptions, **kwargs)
    220 old_server = self._server_threads.get((host, port))
    221 if old_server:
--> 222     old_server.kill()
    223     old_server.join()
    224     del self._server_threads[(host, port)]

File ~/sw/miniconda/miniconda3/envs/python/lib/python3.11/site-packages/jupyter_dash/_stoppable_thread.py:16, in StoppableThread.kill(self)
     13 def kill(self):
     14     thread_id = self.get_id()
     15     res = ctypes.pythonapi.PyThreadState_SetAsyncExc(
---> 16         ctypes.c_long(thread_id), ctypes.py_object(SystemExit)
     17     )
     18     if res == 0:
     19         raise ValueError(f"Invalid thread id: {thread_id}")

TypeError: 'NoneType' object cannot be interpreted as an integer

Thanks!

@asiomchen
Copy link

@ekwan you could either install dash<=2.10 or use the solution I proposed in #32 (hope it would be accepted soon) to solve this problem

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