Trouble with image display in jupyter notebooks

I have a long-standing issue with rstudio making it unusable on NixOS. It’s been outstanding for quite some time, with no solution. I just got back to Python after a while, and seem to have a similar problem with Jupyter (ipynb) notebooks.

If I want to display an image with fig.show(), I get a blank area as output. There is something generated I think, because the blank area has scroll bars, just nothing gets displayed.

This happens both using Jupyter Lab itself as well as using VScode. I can write images to a file and open them in, eg. a browser, but that’s not the point of the notebooks. I can only get them to display in the notebooks if I use the flatpak version of vscode. The flatpak version of jupyter lab does not work.

What could be wrong? Is using plasma/wayland. Is anyone else experiencing this?

Thanks

here’s an example “input”

import plotly.express as px
df = px.data.iris()
fig = px.scatter(df, 
                 x="sepal_width", y='sepal_length', color="species",
                 width=800, height=600)
fig.show();

and the flake:

{
  description = "Your jupyenv project";

  nixConfig.extra-substituters = [
    "https://tweag-jupyter.cachix.org"
  ];
  nixConfig.extra-trusted-public-keys = [
    "tweag-jupyter.cachix.org-1:UtNH4Zs6hVUFpFBTLaA4ejYavPo5EFFqgd7G7FxGW9g="
  ];

  inputs.flake-compat.url = "github:edolstra/flake-compat";
  inputs.flake-compat.flake = false;
  inputs.flake-utils.url = "github:numtide/flake-utils";
  inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
  inputs.jupyenv.url = "github:tweag/jupyenv";

  outputs = {
    self,
    flake-compat,
    flake-utils,
    nixpkgs,
    jupyenv,
    ...
  } @ inputs:
    flake-utils.lib.eachSystem
    [
      flake-utils.lib.system.x86_64-linux
    ]
    (
      system: let
        inherit (jupyenv.lib.${system}) mkJupyterlabNew;
        jupyterlab = mkJupyterlabNew ({...}: {
          nixpkgs = inputs.nixpkgs;
          imports = [(import ./kernels.nix)];
        });
      in rec {
        packages = {inherit jupyterlab;};
        packages.default = jupyterlab;
        apps.default.program = "${jupyterlab}/bin/jupyter-lab";
        apps.default.type = "app";
      }
    );
}

And the associated kernel.nix

{pkgs, ...}: {
  kernel.python.scientific = {
    enable = true;
    extraPackages = ps: [ps.pandas ps.plotly ps.nbformat];
  };
}

I’ve tried it with more simple flakes with the same result. This is just my most recent try.