Skip to content

Error getting the version from source uv-dynamic-versioning: This does not appear to be a Git project #454

@yangguangpin

Description

@yangguangpin

Executing uv add "mcp[cli]" will result in this error. How can I resolve it?
python-version:3.12
Windows 11 专业版

PS E:\MCP\python-sdk-main\mcp-server-demo> uv add "mcp[cli]" Using CPython 3.12.9 interpreter at: C:\Users\yw0132185\AppData\Local\Programs\Python\Python312\python.exe Creating virtual environment at: E:\MCP\python-sdk-main\.venv x Failed to build mcp @ file:///E:/MCP/python-sdk-main|-> The build backend returned an error-> Call to hatchling.build.prepare_metadata_for_build_editable failed (exit code: 1)

  [stderr]
  Traceback (most recent call last):
    File "<string>", line 14, in <module>
    File "C:\Users\yw0132185\AppData\Local\uv\cache\builds-v0\.tmpTXjhVK\Lib\site-packages\hatchling\build.py", line 133, in
  prepare_metadata_for_build_editable
      directory = os.path.join(metadata_directory, f'{builder.artifact_project_id}.dist-info')
                                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\yw0132185\AppData\Local\uv\cache\builds-v0\.tmpTXjhVK\Lib\site-packages\hatchling\builders\wheel.py", line 815, in artifact_project_id    
      self.project_id
    File "C:\Users\yw0132185\AppData\Local\uv\cache\builds-v0\.tmpTXjhVK\Lib\site-packages\hatchling\builders\plugin\interface.py", line 374, in project_id  
      self.__project_id = f'{self.normalize_file_name_component(self.metadata.core.name)}-{self.metadata.version}'
                                                                                           ^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\yw0132185\AppData\Local\uv\cache\builds-v0\.tmpTXjhVK\Lib\site-packages\hatchling\metadata\core.py", line 149, in version
      self._version = self._get_version()
                      ^^^^^^^^^^^^^^^^^^^
    File "C:\Users\yw0132185\AppData\Local\uv\cache\builds-v0\.tmpTXjhVK\Lib\site-packages\hatchling\metadata\core.py", line 248, in _get_version
      version = self.hatch.version.cached
                ^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\yw0132185\AppData\Local\uv\cache\builds-v0\.tmpTXjhVK\Lib\site-packages\hatchling\metadata\core.py", line 1456, in cached
      raise type(e)(message) from None
  RuntimeError: Error getting the version from source `uv-dynamic-versioning`: This does not appear to be a Git project
  hint: This usually indicates a problem with the package or the build environment.

`
help: If you want to add the package regardless of the failed resolution, provide the ‘--frozen’ flag to skip locking and syncing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions