Skip to content

[Bug]: structure not showing when Jupyterlab is run in Jupyterhub or Visual Studio Code #473

@maurov

Description

@maurov

Code snippet

#run this in a Jupyterlab notebook
from pymatgen.core.lattice import Lattice
from pymatgen.core.structure import Structure
import crystal_toolkit

structure = Structure(Lattice.cubic(4.2), ["Na", "K"], [[0, 0, 0], [0.5, 0.5, 0.5]])

structure

What happened?

This is a follow-up of #472. After doing an upgrade to latest crystal-toolkit, I am not able to visualize a structure anymore when I run Jupyterlab notebook in Jupyterhub or via Visual Studio Code.

Context: I have my own Conda environment (let's call it mycondaenv) on a remote machine and the code provided above in a notebook (mynotebook.ipynb). I want to run the notebook remotely from a local machine.

Working case

I connect to the remote machine via SSH, activate mycondaenv, launch jupyter-lab, run mynotebook.ipynb

Failing cases (working with crystal_toolkit == 2025.1.24rc0)

  • from local machine open mynotebook.ipynb in Visual Studio Code (latest version) via SSH remote connection and run it with mycondaenv -> nothing is shown
  • start Jupyterlab using 'mycondaenv' from a remote JupyterHub server and run 'mynotebook.ipynb` -> I get an "Unable to connect" error saying "Firefox can’t establish a connection to the server at 127.0.0.1:8884".

Here some installed versions in mycondaenv that I think are related to the issue:

  • jupyterlab: 3.6.8
  • jupyterhub: 4.1.5
  • batchspawner: 1.3.0
  • dash: 3.2.0
  • dash_mp_components: 0.4.47

The versions for jupyterhub and batchspawner are forced by the JupyterHub remote service I am using at my institution, so cannot be changed. Do you think the problem could be related to the version 4 of the Jupyterhub?

Any idea is welcome. I suppose it is not easy to reproduce from your side.

By the way, is it foreseen that Crystal Toolkit will work with Jupyterlab 4? Or this is not a priority?

Thanks for your help

Version

v2025.7.31

Which OS?

  • MacOS
  • Windows
  • Linux

Log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions