Skip to content

AttributeError: module 'hatchling.build' has no attribute 'prepare_metadata_for_build_editable' #1382

Open
@otary

Description

@otary

Description

pip install -e ".[dev,test]"

Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Obtaining file:///C:/Users/chenzw/IdeaProjects/jupyterlab-git
  Installing build dependencies ... done
  Checking if build backend supports build_editable ... done
  Getting requirements to build editable ... done
  Installing backend dependencies ... done
  Preparing editable metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Preparing editable metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [36 lines of output]
      Traceback (most recent call last):
        File "C:\DPS\Python\Python3\Lib\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 "C:\DPS\Python\Python3\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
          main()
        File "C:\DPS\Python\Python3\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\DPS\Python\Python3\Lib\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 "C:\DPS\Python\Python3\Lib\site-packages\hatchling\build.py", line 61, in build_editable
          return os.path.basename(next(builder.build(wheel_directory, ['editable'])))
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\DPS\Python\Python3\Lib\site-packages\hatchling\builders\plugin\interface.py", line 80, in build
          self.metadata.validate_fields()
        File "C:\DPS\Python\Python3\Lib\site-packages\hatchling\metadata\core.py", line 167, in validate_fields
          _ = self.version
              ^^^^^^^^^^^^
        File "C:\DPS\Python\Python3\Lib\site-packages\hatchling\metadata\core.py", line 55, in version
          self._set_version()
        File "C:\DPS\Python\Python3\Lib\site-packages\hatchling\metadata\core.py", line 145, in _set_version
          core_metadata = self.core
                          ^^^^^^^^^
        File "C:\DPS\Python\Python3\Lib\site-packages\hatchling\metadata\core.py", line 94, in core
          metadata_hooks = self.hatch.metadata.hooks
                           ^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\DPS\Python\Python3\Lib\site-packages\hatchling\metadata\core.py", line 1325, in hooks
          raise UnknownPluginError(f'Unknown metadata hook: {hook_name}')
      hatchling.plugin.exceptions.UnknownPluginError: Unknown metadata hook: nodejs
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
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.

Context

> pip list
Package                   Version
------------------------- --------------
altgraph                  0.17.4
anyio                     4.6.2.post1
argon2-cffi               23.1.0
argon2-cffi-bindings      21.2.0
arrow                     1.3.0
asttokens                 2.4.1
async-lru                 2.0.4
attrs                     24.2.0
babel                     2.16.0
bcrypt                    4.1.2
beautifulsoup4            4.12.3
bleach                    6.2.0
build                     1.2.2.post1
certifi                   2024.6.2
cffi                      1.16.0
charset-normalizer        3.3.2
colorama                  0.4.6
comm                      0.2.2
configparser              6.0.0
cryptography              42.0.2
debugpy                   1.8.9
decorator                 5.1.1
defusedxml                0.7.1
editables                 0.5
executing                 2.1.0
fastjsonschema            2.20.0
fqdn                      1.5.1
h11                       0.14.0
hatchling                 1.7.0
httpcore                  1.0.7
httpx                     0.27.2
idna                      3.7
ipykernel                 6.29.5
ipython                   8.29.0
ipywidgets                8.1.5
isoduration               20.11.0
jedi                      0.19.2
Jinja2                    3.1.3
json5                     0.9.28
jsonpointer               3.0.0
jsonschema                4.23.0
jsonschema-specifications 2024.10.1
jupyter                   1.1.1
jupyter_client            8.6.3
jupyter-console           6.6.3
jupyter_core              5.7.2
jupyter-events            0.10.0
jupyter-lsp               2.2.5
jupyter_server            2.14.2
jupyter_server_terminals  0.5.3
jupyterlab                4.2.6
jupyterlab_pygments       0.3.0
jupyterlab_server         2.27.3
jupyterlab_widgets        3.0.13
MarkupSafe                2.1.5
matplotlib-inline         0.1.7
mistune                   3.0.2
nbclient                  0.10.0
nbconvert                 7.16.4
nbformat                  5.10.4
nest-asyncio              1.6.0
notebook                  7.2.2
notebook_shim             0.2.4
overrides                 7.7.0
packaging                 24.2
pandocfilters             1.5.1
paramiko                  3.4.0
parso                     0.8.4
pathspec                  0.12.1
pefile                    2023.2.7
pip                       24.3.1
platformdirs              4.3.6
pluggy                    1.5.0
prometheus_client         0.21.0
prompt_toolkit            3.0.48
psutil                    6.1.0
pure_eval                 0.2.3
pycparser                 2.22
Pygments                  2.18.0
pyinstaller               6.4.0
pyinstaller-hooks-contrib 2024.1
PyNaCl                    1.5.0
pyproject_hooks           1.2.0
python-dateutil           2.9.0.post0
python-json-logger        2.0.7
pywin32                   308
pywin32-ctypes            0.2.2
pywinpty                  2.0.14
PyYAML                    6.0.1
pyzmq                     26.2.0
referencing               0.35.1
requests                  2.32.3
rfc3339-validator         0.1.4
rfc3986-validator         0.1.1
rpds-py                   0.21.0
Send2Trash                1.8.3
setuptools                69.0.3
six                       1.16.0
sniffio                   1.3.1
soupsieve                 2.6
sqlparse                  0.4.4
stack-data                0.6.3
terminado                 0.18.1
tinycss2                  1.4.0
tornado                   6.4.2
tqdm                      4.66.2
traitlets                 5.14.3
trove-classifiers         2024.10.21.16
types-python-dateutil     2.9.0.20241003
uri-template              1.3.0
urllib3                   2.2.2
wcwidth                   0.2.13
webcolors                 24.11.1
webencodings              0.5.1
websocket-client          1.8.0
wheel                     0.43.0
widgetsnbextension        4.0.13

I don't konw how to resolve it,please help me!

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