jupyterlite / xeus-python-kernel

xeus-python in JupyterLite
https://xeus-python-kernel.readthedocs.io
BSD 3-Clause "New" or "Revised" License
30 stars 19 forks source link

jupyter lite build broken ? #145

Closed parmentelat closed 12 months ago

parmentelat commented 1 year ago

Description

jupyter lite build gives me an odd error

Reproduce

conda create -y -n jlite-tuto python=3.11
conda activate jlite-tuto

pip install jupyterlite
pip install jupyterlab_server
pip install jupyterlite-xeus-python

mkdir foo
cd foo
jupyter lite init
jupyter lite build

and I'm getting this error (full log below)

ValueError: '/private/tmp/xeus-python-kernel/envs/xeus-python-kernel/lib/python3.10/site-packages' is not in the subpath of '/tmp/xeus-python-kernel/envs/xeus-python-kernel' OR one path is relative and the other is absolute.
the full log
jupyter lite build
static:jupyter-lite.json
.  pre_status:static:jupyter-lite.json
    tarball:         jupyterlite-app-0.1.0.tgz 7MB
    output:          /Users/myusername/git/jlite-tuto/foo/_output
    lite dir:        /Users/myusername/git/jlite-tuto/foo
    apps:
    sourcemaps:      True
    unused packages: True
archive:archive
contents:contents
jupyterlite-pyodide-kernel-pyodide:pyodide
lite:jupyter-lite.json
mathjax:status
mimetypes:jupyter-lite.json
serve:contents
settings:overrides
translation:translation
.  status:archive:archive
[LiteBuildApp] No archive (yet): foo-jupyterlite.tgz
.  status:contents:contents
    contents: 0 files
.  status:jupyterlite-pyodide-kernel-pyodide:pyodide
     URL: None
 archive: []
   cache: 0 files
   local: 0 files
.  status:lite:jupyter-lite.json
[LiteBuildApp]     jupyter-lite.(json|ipynb): 0 files
.  status:mathjax:status
     jupyter-server-mathjax: None
     configured MathJax dir: /Users/myusername/git/jlite-tuto/foo/traitlets.Undefined
     effective MathJax dir: None
.  status:mimetypes:jupyter-lite.json
    filetypes:         26
.  status:serve:contents
    url: http://127.0.0.1:8000/
    server: tornado
    headers:
.  status:settings:overrides
    overrides.json: 0
.  status:translation:translation
    translation files: 0 files
static:output_dir
-- pre_init:static:output_dir
static:unpack
-- init:static:unpack
federated_extensions:copy:ext:jupyterlab_pygments
federated_extensions:copy:ext:@jupyterlite/pyodide-kernel-extension
federated_extensions:copy:ext:@jupyterlite/xeus-python-kernel
federated_extensions:copy:ext:@jupyterlite/javascript-kernel-extension
.  pre_build:federated_extensions:copy:ext:jupyterlab_pygments
.  pre_build:federated_extensions:copy:ext:@jupyterlite/pyodide-kernel-extension
.  pre_build:federated_extensions:copy:ext:@jupyterlite/xeus-python-kernel
.  pre_build:federated_extensions:copy:ext:@jupyterlite/javascript-kernel-extension
translation:copy
.  build:translation:copy
federated_extensions:patch
jupyterlite-pyodide-kernel-piplite:patch
jupyterlite-xeus-python:xeus:copy:ext:@jupyterlite/xeus-python-kernel
Collecting package metadata (current_repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: /tmp/xeus-python-kernel/envs/xeus-python-kernel

Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
#     $ conda activate /tmp/xeus-python-kernel/envs/xeus-python-kernel
#
# To deactivate an active environment, use
#
#     $ conda deactivate

Collecting package metadata (current_repodata.json): done
Solving environment: |
Warning: >10 possible package resolutions (only showing differing packages):
  - conda-forge/noarch::executing-1.2.0-pyhd8ed1ab_0, conda-forge/noarch::ptyprocess-0.7.0-pyhd3deb0d_0, conda-forge/noarch::pure_eval-0.2.2-pyhd8ed1ab_0, conda-forge/noarch::six-1.16.0-pyh6c4a22f_0
  - conda-forge/noarch::executing-1.2.0-pyhd8ed1ab_0, conda-forge/noarch::ptyprocess-0.7.0-pyhd3deb0d_0, conda-forge/noarch::pure_eval-0.2.2-pyhd8ed1ab_0, https://repo.mamba.pm/conda-forge/noarch::six-1.16.0-pyh6c4a22f_0
  - conda-forge/noarch::executing-1.2.0-pyhd8ed1ab_0, conda-forge/noarch::ptyprocess-0.7.0-pyhd3deb0d_0, conda-forge/noarch::six-1.16.0-pyh6c4a22f_0, https://repo.mamba.pm/conda-forge/noarch::pure_eval-0.2.2-pyhd8ed1ab_0
  - conda-forge/noarch::executing-1.2.0-pyhd8ed1ab_0, conda-forge/noarch::ptyprocess-0.7.0-pyhd3deb0d_0, https://repo.mamba.pm/conda-forge/noarch::pure_eval-0.2.2-pyhd8ed1ab_0, https://repo.mamba.pm/conda-forge/noarch::six-1.16.0-pyh6c4a22f_0
  - conda-forge/noarch::ptyprocess-0.7.0-pyhd3deb0d_0, conda-forge/noarch::six-1.16.0-pyh6c4a22f_0, https://repo.mamba.pm/conda-forge/noarch::executing-1.2.0-pyhd8ed1ab_0, https://repo.mamba.pm/conda-forge/noarch::pure_eval-0.2.2-pyhd8ed1ab_0
  - conda-forge/noarch::ptyprocess-0.7.0-pyhd3deb0d_0, https://repo.mamba.pm/conda-forge/noarch::executing-1.2.0-pyhd8ed1ab_0, https://repo.mamba.pm/conda-forge/noarch::pure_eval-0.2.2-pyhd8ed1ab_0, https://repo.mamba.pm/conda-forge/noarch::six-1.16.0-pyh6c4a22f_0
  - conda-forge/noarch::ptyprocess-0.7.0-pyhd3deb0d_0, conda-forge/noarch::pure_eval-0.2.2-pyhd8ed1ab_0, conda-forge/noarch::six-1.16.0-pyh6c4a22f_0, https://repo.mamba.pm/conda-forge/noarch::executing-1.2.0-pyhd8ed1ab_0
  - conda-forge/noarch::ptyprocess-0.7.0-pyhd3deb0d_0, conda-forge/noarch::pure_eval-0.2.2-pyhd8ed1ab_0, https://repo.mamba.pm/conda-forge/noarch::executing-1.2.0-pyhd8ed1ab_0, https://repo.mamba.pm/conda-forge/noarch::six-1.16.0-pyh6c4a22f_0
  - conda-forge/noarch::pure_eval-0.2.2-pyhd8ed1ab_0, conda-forge/noarch::six-1.16.0-pyh6c4a22f_0, https://repo.mamba.pm/conda-forge/noarch::executing-1.2.0-pyhd8ed1ab_0, https://repo.mamba.pm/conda-forge/noarch::ptyprocess-0.7.0-pyhd3deb0d_0
  - conda-forge/noarch::executing-1.2.0-pyhd8ed1ab_0, conda-forge/noarch::pure_eval-0.2.2-pyhd8ed1ab_0, conda-forge/noarch::six-1.16.0-pyh6c4a22f_0, https://repo.mamba.pm/conda-forge/noarch::ptyprocess-0.7.0-pyhd3deb0d_0
  ... and othedone

## Package Plan ##

  environment location: /tmp/xeus-python-kernel/envs/xeus-python-kernel

  added / updated specs:
    - python=3.10
    - xeus-lite
    - xeus-python=0.15.9

The following NEW packages will be INSTALLED:

  asttokens          conda-forge/noarch::asttokens-2.2.1-pyhd8ed1ab_0
  backcall           conda-forge/noarch::backcall-0.2.0-pyh9f0ad1d_0
  backports          conda-forge/noarch::backports-1.0-pyhd8ed1ab_3
  backports.functoo~ conda-forge/noarch::backports.functools_lru_cache-1.6.5-pyhd8ed1ab_0
  decorator          conda-forge/noarch::decorator-5.1.1-pyhd8ed1ab_0
  emscripten-abi     emscripten-forge/noarch::emscripten-abi-3.1.27-hb0f4dca_6
  executing          conda-forge/noarch::executing-1.2.0-pyhd8ed1ab_0
  ipython            emscripten-forge/emscripten-32::ipython-8.14.0-py310h8bed8af_1
  jedi               conda-forge/noarch::jedi-0.18.2-pyhd8ed1ab_0
  matplotlib-inline  conda-forge/noarch::matplotlib-inline-0.1.6-pyhd8ed1ab_0
  numpy              emscripten-forge/emscripten-32::numpy-1.25.1-py310h6d2fff6_0
  parso              conda-forge/noarch::parso-0.8.3-pyhd8ed1ab_0
  pexpect            conda-forge/noarch::pexpect-4.8.0-pyh1a96a4e_2
  pickleshare        conda-forge/noarch::pickleshare-0.7.5-py_1003
  pip                conda-forge/noarch::pip-23.2.1-pyhd8ed1ab_0
  prompt-toolkit     conda-forge/noarch::prompt-toolkit-3.0.39-pyha770c72_0
  ptyprocess         conda-forge/noarch::ptyprocess-0.7.0-pyhd3deb0d_0
  pure_eval          conda-forge/noarch::pure_eval-0.2.2-pyhd8ed1ab_0
  pygments           conda-forge/noarch::pygments-2.15.1-pyhd8ed1ab_0
  pyparsing          conda-forge/noarch::pyparsing-3.1.0-pyhd8ed1ab_0
  python             emscripten-forge/emscripten-32::python-3.10.2-h_hash_26_cpython
  requests-wasm-pol~ emscripten-forge/emscripten-32::requests-wasm-polyfill-0.3.0-h8bed8af_0
  setuptools         emscripten-forge/emscripten-32::setuptools-64.0.0-py310h8bed8af_0
  six                conda-forge/noarch::six-1.16.0-pyh6c4a22f_0
  stack_data         conda-forge/noarch::stack_data-0.6.2-pyhd8ed1ab_0
  traitlets          conda-forge/noarch::traitlets-5.9.0-pyhd8ed1ab_0
  wcwidth            conda-forge/noarch::wcwidth-0.2.6-pyhd8ed1ab_0
  wheel              conda-forge/noarch::wheel-0.41.0-pyhd8ed1ab_0
  xeus-lite          emscripten-forge/emscripten-32::xeus-lite-1.0.1-hf0acc6b_0
  xeus-python        emscripten-forge/emscripten-32::xeus-python-0.15.9-h4d17c68_1
  xeus-python-shell  conda-forge/noarch::xeus-python-shell-0.6.0-pyhd8ed1ab_0
  xeus-python-shell~ conda-forge/noarch::xeus-python-shell-raw-0.6.0-pyhd8ed1ab_0

Downloading and Extracting Packages

Preparing transaction: done
Verifying transaction: done
Executing transaction: done
[LiteBuildApp] ERROR | [lite] [post_build] [jupyterlite-xeus-python] [ERR] '/private/tmp/xeus-python-kernel/envs/xeus-python-kernel/lib/python3.10/site-packages' is not in the subpath of '/tmp/xeus-python-kernel/envs/xeus-python-kernel' OR one path is relative and the other is absolute.
Traceback (most recent call last):
  File "/Users/myusername/miniconda3/envs/jlite-tuto/lib/python3.11/site-packages/doit/doit_cmd.py", line 294, in run
    return command.parse_execute(args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/myusername/miniconda3/envs/jlite-tuto/lib/python3.11/site-packages/doit/cmd_base.py", line 150, in parse_execute
    return self.execute(params, args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/myusername/miniconda3/envs/jlite-tuto/lib/python3.11/site-packages/doit/cmd_base.py", line 570, in execute
    return self._execute(**exec_params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/myusername/miniconda3/envs/jlite-tuto/lib/python3.11/site-packages/doit/cmd_run.py", line 265, in _execute
    return runner.run_all(self.control.task_dispatcher())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/myusername/miniconda3/envs/jlite-tuto/lib/python3.11/site-packages/doit/runner.py", line 254, in run_all
    self.run_tasks(task_dispatcher)
  File "/Users/myusername/miniconda3/envs/jlite-tuto/lib/python3.11/site-packages/doit/runner.py", line 213, in run_tasks
    node = task_dispatcher.generator.send(node)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/myusername/miniconda3/envs/jlite-tuto/lib/python3.11/site-packages/doit/control.py", line 629, in _dispatcher_generator
    next_step = node.step()
                ^^^^^^^^^^^
  File "/Users/myusername/miniconda3/envs/jlite-tuto/lib/python3.11/site-packages/doit/control.py", line 336, in step
    return next(self.generator)
           ^^^^^^^^^^^^^^^^^^^^
  File "/Users/myusername/miniconda3/envs/jlite-tuto/lib/python3.11/site-packages/doit/control.py", line 345, in _func
    for value in decorated(*args, **kwargs):
  File "/Users/myusername/miniconda3/envs/jlite-tuto/lib/python3.11/site-packages/doit/control.py", line 473, in _add_task
    new_tasks = generate_tasks(to_load, task_gen, ref.__doc__)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/myusername/miniconda3/envs/jlite-tuto/lib/python3.11/site-packages/doit/loader.py", line 390, in generate_tasks
    for task_dict, x_doc in flat_generator(gen_result, gen_doc):
  File "/Users/myusername/miniconda3/envs/jlite-tuto/lib/python3.11/site-packages/doit/loader.py", line 27, in flat_generator
    for item in gen:
  File "/Users/myusername/miniconda3/envs/jlite-tuto/lib/python3.11/site-packages/jupyterlite_core/manager.py", line 145, in _delayed_gather
    for task in _gather():
  File "/Users/myusername/miniconda3/envs/jlite-tuto/lib/python3.11/site-packages/jupyterlite_core/manager.py", line 138, in _gather
    raise error
  File "/Users/myusername/miniconda3/envs/jlite-tuto/lib/python3.11/site-packages/jupyterlite_core/manager.py", line 128, in _gather
    for task in getattr(addon, attr)(self):
  File "/Users/myusername/miniconda3/envs/jlite-tuto/lib/python3.11/site-packages/jupyterlite_xeus_python/env_build_addon.py", line 82, in post_build
    env_prefix = build_and_pack_emscripten_env(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/myusername/miniconda3/envs/jlite-tuto/lib/python3.11/site-packages/jupyterlite_xeus_python/build.py", line 343, in build_and_pack_emscripten_env
    raise e
  File "/Users/myusername/miniconda3/envs/jlite-tuto/lib/python3.11/site-packages/jupyterlite_xeus_python/build.py", line 304, in build_and_pack_emscripten_env
    pack_env(
  File "/Users/myusername/miniconda3/envs/jlite-tuto/lib/python3.11/site-packages/empack/pack.py", line 143, in pack_env
    included_files = filter_env(
                     ^^^^^^^^^^^
  File "/Users/myusername/miniconda3/envs/jlite-tuto/lib/python3.11/site-packages/empack/filter_env.py", line 113, in filter_env
    for pkg_meta in iterate_env_pkg_meta(env_prefix):
  File "/Users/myusername/miniconda3/envs/jlite-tuto/lib/python3.11/site-packages/empack/filter_env.py", line 69, in iterate_env_pkg_meta
    for pkg_meta in iterate_pip_pkg_record(env_prefix):
  File "/Users/myusername/miniconda3/envs/jlite-tuto/lib/python3.11/site-packages/empack/filter_env.py", line 20, in iterate_pip_pkg_record
    relative_site_packages = site_packages.relative_to(env_prefix)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/myusername/miniconda3/envs/jlite-tuto/lib/python3.11/pathlib.py", line 730, in relative_to
    raise ValueError("{!r} is not in the subpath of {!r}"
ValueError: '/private/tmp/xeus-python-kernel/envs/xeus-python-kernel/lib/python3.10/site-packages' is not in the subpath of '/tmp/xeus-python-kernel/envs/xeus-python-kernel' OR one path is relative and the other is absolute.

Context

I am using macos monterey 12.6.7, Intel processor

uname -a
Darwin zoi 21.6.0 Darwin Kernel Version 21.6.0: Thu Jun  8 23:57:12 PDT 2023; root:xnu-8020.240.18.701.6~1/RELEASE_X86_64 x86_64
jtpio commented 1 year ago

cc @martinRenou in case this might be related to the recent releases of jupyterlite-xeus-python.

martinRenou commented 1 year ago

Can you try to pin empack to 3.0.1 and jupyterlite-xeus-python to 0.9.1 for now? This may fix your issue.

martinRenou commented 1 year ago

Actually, it would be great if you could try with jupyterlite-xeus-python 0.9.2 and empack installed from https://github.com/emscripten-forge/empack/pull/77

martinRenou commented 12 months ago

This should be fixed