0

I am running the following command:

conda create -n jupyterlab-ext --override-channels --strict-channel-priority -c conda-forge -c nodefaults jupyterlab=3 cookiecutter nodejs jupyter-packaging

The above command is part of the Jupyter labextension tutorial and I have run this command (followed by jlpm described below) successfully every day for several days.

However today, after running the above conda create, and then activating the environment, when I try to run the jupyter-packaging program jlpm then I get the following:

~/code$ conda activate myenv
(myenv) ~/code$ jlpm
Segmentation fault: 11

This is happening consistently today on my MacBook. It worked fine yesterday, and the day before. (It is also working fine even today in my WLS2 environment on my PC).

I suspect that conda is installing a bad version of jupyter-packaging, or more likely, a bad version of something that jupyter-packaging depends upon. I tried rebooting my mac, same issue.

Any ideas?


running miniconda:

~/code$ conda --version
conda 23.1.0

Some additional information:

  • It is not actually jlpm that is crashing, but jupyter itself.

  • running jupyter with no args, or with no subcommand, works fine. For example:

    jupyter <enter>
    jupyter --help <enter>
    jupyter --version <enter>  # all of these work fine.
    
  • running jupyter with any subcommand, gives Segmentation fault: 11, for example:

    jupyter labextension --list <enter>
    jupyter lab <enter>
    jupyter notebook <enter>  # All of these Segmentation fault: 11
    
  • The Seg fault is always while importing main for the subcommand, for example:

    • "jupyter notebook " crashes on:
      from notebook.notebookapp import main
      
    • "jupyter labextension --list " crashes on:
      from jupyterlab.labextensions import main
      
  • There definitely seems to be something wrong with the conda version of jupyterlab. If I run the conda create command that I listed at the top of this question, except I leave out jupyterlab=3 so that jupyterlab is not installed, *and then after activating the environment I use **pip install jupyterlab then everything works fine!

  • If I had another macbook, I would test if this is an issue with all macs, or just mine. As mentioned above, I don't have this problem on WSL2 ubuntu.

  • pdb seemed to indicate that the crash was in lib/python3.11/importlib/_bootstrap.py but that does not mean that the problem isn't with the jupyter package (from conda) only that (as I mentioned above) the crash occurs while importing main from the specified subcommand.

Daniel Goldfarb
  • 6,937
  • 5
  • 29
  • 61
  • One thing to try would be to remove (or rename) `node_modules` directory and trying to run `jlpm` again. – krassowski Apr 27 '23 at 21:14
  • @krassowski - Thanks for the suggestion. The node_modules directory is not present. I'm starting from scratch every time. I can't even run **`jlpm --version`**, and that's even *before* running cookiecutter. – Daniel Goldfarb Apr 27 '23 at 21:58
  • What if you try to remove jupyterlab from the equation? What happens if you just run `node` - does it also segfault? – krassowski Apr 27 '23 at 22:11
  • @krassowski ... hmm good idea. node works fine. But jupyter itself does not. `jupyter notebook` or `jupyter lab` ... really `jupyter ` crashes with the same `Segmentation Fault 11` ... *however* `jupyter --option` with no subcommand works fine. For example `jupyter --help` and `jupyter --version` – Daniel Goldfarb Apr 28 '23 at 01:15
  • Can you compare `conda list` for a new environment and an older one that worked? Maybe there has been a problematic Conda Forge package build (it happens) – merv Apr 28 '23 at 13:22
  • Yes, I was thinking something like that. Or to delve into the Jupyter code and find exactly where it's seg faulting. I have an good idea now how to get at this. In the meantime I have another deadline so I will come back to this in a couple of days. (In the meantime maybe that conda forge dependency will get fixed ;-) ) – Daniel Goldfarb Apr 28 '23 at 15:52

1 Answers1

0

You can recover a working environment with last jupyterlab version by pinning libffi to 3.3.

micromamba create -f https://prefix.dev/envs/marcbernot/mojave/conda-lock.yml -n mojave or conda create -n testmojave python=3.9 libffi=3.3 notebook jupyterlab. See more details here.

Marc
  • 46
  • 4