jupyter-widgets / ipydatagrid

Fast Datagrid widget for the Jupyter Notebook and JupyterLab
BSD 3-Clause "New" or "Revised" License
579 stars 51 forks source link

dev install as per `README.md` fails #510

Closed jgunstone closed 6 months ago

jgunstone commented 6 months ago

Describe the bug A clear and concise description of what the bug is.

To Reproduce

Run the steps defined here: https://github.com/bloomberg/ipydatagrid?tab=readme-ov-file#development-installation

note - I had to install nodejs also to progress...

looks like its to do with the jupyter hatch builder...

Expected behavior

Installation to work.

Environment (please complete the following information):

Screenshots image

Additional context

```bash Using cached pluggy-1.5.0-py3-none-any.whl (20 kB) Using cached trove_classifiers-2024.4.10-py3-none-any.whl (13 kB) Installing collected packages: trove-classifiers, pluggy, pathspec, packaging, editables, hatchling, hatch-jupyter-builder Successfully installed editables-0.5 hatch-jupyter-builder-0.9.1 hatchling-1.24.2 packaging-24.0 pathspec-0.12.1 pluggy-1.5.0 trove-classifiers-2024.4.10 Installing backend dependencies ... done Running command Preparing editable metadata (pyproject.toml) INFO:hatch_jupyter_builder.utils:Running jupyter-builder INFO:hatch_jupyter_builder.utils:Building with hatch_jupyter_builder.npm_builder INFO:hatch_jupyter_builder.utils:With kwargs: {'path': '.', 'build_cmd': 'build', 'npm': ['jlpm']} INFO:hatch_jupyter_builder.utils:Installing build dependencies with npm. This may take a while... INFO:hatch_jupyter_builder.utils:> /tmp/pip-build-env-kwawl8qa/overlay/bin/jlpm install ➤ YN0000: ┌ Resolution step ➤ YN0002: │ @jupyterlab/services@npm:7.0.9 doesn't provide react (p89091), requested by @jupyterlab/settingregistry ➤ YN0002: │ @lumino/commands@npm:1.21.1 doesn't provide crypto (p1d233), requested by @lumino/coreutils ➤ YN0002: │ @lumino/dragdrop@npm:1.14.5 doesn't provide crypto (p19e23), requested by @lumino/coreutils ➤ YN0002: │ @lumino/widgets@npm:1.37.2 doesn't provide crypto (pbd9eb), requested by @lumino/coreutils ➤ YN0060: │ ipydatagrid@workspace:. provides typescript (pde841) with version 4.2.4, which doesn't satisfy what ts-jest requests ➤ YN0002: │ svg-url-loader@npm:3.0.3 doesn't provide webpack (p260b6), requested by file-loader ➤ YN0000: │ Some peer dependencies are incorrectly met; run yarn explain peer-requirements for details, where is the six-letter p-prefixed code ➤ YN0000: └ Completed in 0s 245ms ➤ YN0000: ┌ Fetch step ➤ YN0000: └ Completed in 0s 488ms ➤ YN0000: ┌ Link step ➤ YN0000: └ Completed in 0s 620ms ➤ YN0000: Done with warnings in 1s 446ms INFO:hatch_jupyter_builder.utils:> /tmp/pip-build-env-kwawl8qa/overlay/bin/jlpm run build Traceback (most recent call last): File "/home/jovyan/miniforge3/envs/ipydatagrid-dev/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 167, in prepare_metadata_for_build_editable hook = backend.prepare_metadata_for_build_editable ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: module 'hatchling.build' has no attribute 'prepare_metadata_for_build_editable' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/jovyan/miniforge3/envs/ipydatagrid-dev/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in main() File "/home/jovyan/miniforge3/envs/ipydatagrid-dev/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main json_out['return_val'] = hook(**hook_input['kwargs']) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/jovyan/miniforge3/envs/ipydatagrid-dev/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 176, in prepare_metadata_for_build_editable whl_basename = build_hook(metadata_directory, config_settings) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/tmp/pip-build-env-kwawl8qa/overlay/lib/python3.12/site-packages/hatchling/build.py", line 83, in build_editable return os.path.basename(next(builder.build(directory=wheel_directory, versions=['editable']))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/tmp/pip-build-env-kwawl8qa/overlay/lib/python3.12/site-packages/hatchling/builders/plugin/interface.py", line 147, in build build_hook.initialize(version, build_data) File "/tmp/pip-build-env-kwawl8qa/normal/lib/python3.12/site-packages/hatch_jupyter_builder/plugin.py", line 94, in initialize raise e File "/tmp/pip-build-env-kwawl8qa/normal/lib/python3.12/site-packages/hatch_jupyter_builder/plugin.py", line 89, in initialize build_func(self.target_name, version, **build_kwargs) File "/tmp/pip-build-env-kwawl8qa/normal/lib/python3.12/site-packages/hatch_jupyter_builder/utils.py", line 117, in npm_builder run([*npm_cmd, "run", build_cmd], cwd=str(abs_path)) File "/tmp/pip-build-env-kwawl8qa/normal/lib/python3.12/site-packages/hatch_jupyter_builder/utils.py", line 231, in run return subprocess.check_call(cmd, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/jovyan/miniforge3/envs/ipydatagrid-dev/lib/python3.12/subprocess.py", line 413, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['/tmp/pip-build-env-kwawl8qa/overlay/bin/jlpm', 'run', 'build']' returned non-zero exit status 129. error: subprocess-exited-with-error × Preparing editable metadata (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> See above for output. note: This error originates from a subprocess, and is likely not a problem with pip. full command: /home/jovyan/miniforge3/envs/ipydatagrid-dev/bin/python3.12 /home/jovyan/miniforge3/envs/ipydatagrid-dev/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py prepare_metadata_for_build_editable /tmp/tmpqa57j_zt cwd: /home/jovyan/ipydatagrid Preparing editable metadata (pyproject.toml) ... error error: metadata-generation-failed × Encountered error while generating package metadata. ╰─> See above for output. note: This is an issue with the package mentioned above, not pip. hint: See above for details. ```
martinRenou commented 6 months ago

Thanks for opening an issue. Could you please make a wider screenshot? It seems the important part of the error message is missing.

jgunstone commented 6 months ago

the associated text is hiding in the details ^ dropdown

martinRenou commented 6 months ago

Thanks, arf I hate the AttributeError: module 'hatchling.build' has no attribute 'prepare_metadata_for_build_editable' message, it's noisy and hides errors.

It seems jlpm run build is failing for some reason, can you try running it after doing an jlpm install?

jgunstone commented 6 months ago

that sorted it - thanks

should I add something to the README.md?

martinRenou commented 6 months ago

I'm not sure. It seems jlpm run build has failed when you ran pip install -ve ., but it should not have. I'm not sure why it succeeded when you ran that alone.

jgunstone commented 6 months ago

okay - I'll just close it then -

for ref the things I did slightly different to what is defined here: https://github.com/bloomberg/ipydatagrid?tab=readme-ov-file#development-installation

git clone https://github.com/Bloomberg/ipydatagrid.git
cd ipydatagrid
mamba create -n ipydatagrid-dev ipywidgets=8 jupyterlab nodejs # added nodejs
pip install -ve .
# ^ if the above fails... 
jlpm install
pip install -ve .
# ^ this should now work