Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Poetry will not install packages using with Hatchling #9244

Closed
pkucmus opened this issue Mar 27, 2024 · 7 comments
Closed

Poetry will not install packages using with Hatchling #9244

pkucmus opened this issue Mar 27, 2024 · 7 comments
Labels
kind/feature Feature requests/implementations

Comments

@pkucmus
Copy link

pkucmus commented Mar 27, 2024

Issue Kind

Brand new capability

Description

I would like to be able to poetry add a package that is built with hatchling. Currently when I try one like Ariadne (which has a whl on PyPI so it's fine - just using it as an example) I get "Unable to create package with no name" from poetry.

To reproduce:

poetry add git+https://github.com/mirumee/ariadne.git

Impact

Quite high for my particular use case, no idea if it's a problem for many. I'm sure it has the potential to be impactful in the future as the likes of Hatchling or PDM tend to appear more and more. (I have no idea if there's a similar problem with a PDM package)

Workarounds

I'm looking for one for a few days now and nothing seems to work.

@pkucmus pkucmus added kind/feature Feature requests/implementations status/triage This issue needs to be triaged labels Mar 27, 2024
@Secrus
Copy link
Member

Secrus commented Mar 27, 2024

Sounds more like a user error not something Poetry is incapable of doing. Could you post your pyproject.toml and poetry config --list?

@dimbleby
Copy link
Contributor

dimbleby commented Mar 27, 2024

you need to use recent pkginfo in your poetry installation - duplicate #9191, #9195

@clintonroy
Copy link
Contributor

Following the bug template is always useful, it gives us more information to work from:

Using virtualenv: /home/clintonr/.cache/pypoetry/virtualenvs/poetry-6dahNO4U-py3.11
Checking if keyring is available
[keyring:keyring.backend] Loading KWallet
[keyring:keyring.backend] Loading SecretService
[keyring:keyring.backend] Loading Windows
[keyring:keyring.backend] Loading chainer
[keyring:keyring.backend] Loading libsecret
[keyring:keyring.backend] Loading macOS
Using keyring backend 'SecretService Keyring'
[urllib3:urllib3.connectionpool] Starting new HTTPS connection (1): github.com:443
[urllib3:urllib3.connectionpool] https://github.com:443 "GET /mirumee/ariadne.git/info/refs?service=git-upload-pack HTTP/1.1" 200 None
Cloning https://github.com/mirumee/ariadne.git at 'HEAD' to /home/clintonr/.cache/pypoetry/virtualenvs/poetry-6dahNO4U-py3.11/src/ariadne
[virtualenv] find interpreter for spec PythonSpec(path=/home/clintonr/.local/pipx/venvs/poetry/bin/python)
[filelock:filelock] Attempting to acquire lock 139770216609104 on /home/clintonr/.local/share/virtualenv/py_info/1/ca3ed784184f1b3bb7c3539bfb45e71710cd27667424f92c2d5bb4df9c107c23.lock
[filelock:filelock] Lock 139770216609104 acquired on /home/clintonr/.local/share/virtualenv/py_info/1/ca3ed784184f1b3bb7c3539bfb45e71710cd27667424f92c2d5bb4df9c107c23.lock
[virtualenv] got python info of %s from (PosixPath('/usr/bin/python3.11'), PosixPath('/home/clintonr/.local/share/virtualenv/py_info/1/ca3ed784184f1b3bb7c3539bfb45e71710cd27667424f92c2d5bb4df9c107c23.json'))
[filelock:filelock] Attempting to release lock 139770216609104 on /home/clintonr/.local/share/virtualenv/py_info/1/ca3ed784184f1b3bb7c3539bfb45e71710cd27667424f92c2d5bb4df9c107c23.lock
[filelock:filelock] Lock 139770216609104 released on /home/clintonr/.local/share/virtualenv/py_info/1/ca3ed784184f1b3bb7c3539bfb45e71710cd27667424f92c2d5bb4df9c107c23.lock
[virtualenv] proposed PythonInfo(spec=CPython3.11.8.final.0-64, system=/usr/bin/python3.11, exe=/home/clintonr/.local/pipx/venvs/poetry/bin/python, platform=linux, version='3.11.8 (main, Feb  7 2024, 21:52:08) [GCC 13.2.0]', encoding_fs_io=utf-8-utf-8)
[virtualenv] accepted PythonInfo(spec=CPython3.11.8.final.0-64, system=/usr/bin/python3.11, exe=/home/clintonr/.local/pipx/venvs/poetry/bin/python, platform=linux, version='3.11.8 (main, Feb  7 2024, 21:52:08) [GCC 13.2.0]', encoding_fs_io=utf-8-utf-8)
[virtualenv] filesystem is case-sensitive
[virtualenv] create virtual environment via CPython3Posix(dest=/tmp/tmpdanh_nnf/.venv, clear=False, no_vcs_ignore=False, global=False)
[virtualenv] create folder /tmp/tmpdanh_nnf/.venv/bin
[virtualenv] create folder /tmp/tmpdanh_nnf/.venv/lib/python3.11/site-packages
[virtualenv] write /tmp/tmpdanh_nnf/.venv/pyvenv.cfg
[virtualenv]    home = /usr/bin
[virtualenv]    implementation = CPython
[virtualenv]    version_info = 3.11.8.final.0
[virtualenv]    virtualenv = 20.25.1
[virtualenv]    include-system-site-packages = false
[virtualenv]    base-prefix = /usr
[virtualenv]    base-exec-prefix = /usr
[virtualenv]    base-executable = /usr/bin/python3.11
[virtualenv] symlink /usr/bin/python3.11 to /tmp/tmpdanh_nnf/.venv/bin/python
[virtualenv] create virtualenv import hook file /tmp/tmpdanh_nnf/.venv/lib/python3.11/site-packages/_virtualenv.pth
[virtualenv] create /tmp/tmpdanh_nnf/.venv/lib/python3.11/site-packages/_virtualenv.py
[virtualenv] ============================== target debug ==============================
[virtualenv] debug via /tmp/tmpdanh_nnf/.venv/bin/python /home/clintonr/.local/pipx/venvs/poetry/lib/python3.11/site-packages/virtualenv/create/debug.py
[virtualenv] {
[virtualenv]   "sys": {
[virtualenv]     "executable": "/tmp/tmpdanh_nnf/.venv/bin/python",
[virtualenv]     "_base_executable": "/usr/bin/python3.11",
[virtualenv]     "prefix": "/tmp/tmpdanh_nnf/.venv",
[virtualenv]     "base_prefix": "/usr",
[virtualenv]     "real_prefix": null,
[virtualenv]     "exec_prefix": "/tmp/tmpdanh_nnf/.venv",
[virtualenv]     "base_exec_prefix": "/usr",
[virtualenv]     "path": [
[virtualenv]       "/usr/lib/python311.zip",
[virtualenv]       "/usr/lib/python3.11",
[virtualenv]       "/usr/lib/python3.11/lib-dynload",
[virtualenv]       "/tmp/tmpdanh_nnf/.venv/lib/python3.11/site-packages"
[virtualenv]     ],
[virtualenv]     "meta_path": [
[virtualenv]       "<class '_virtualenv._Finder'>",
[virtualenv]       "<class '_frozen_importlib.BuiltinImporter'>",
[virtualenv]       "<class '_frozen_importlib.FrozenImporter'>",
[virtualenv]       "<class '_frozen_importlib_external.PathFinder'>"
[virtualenv]     ],
[virtualenv]     "fs_encoding": "utf-8",
[virtualenv]     "io_encoding": "utf-8"
[virtualenv]   },
[virtualenv]   "version": "3.11.8 (main, Feb  7 2024, 21:52:08) [GCC 13.2.0]",
[virtualenv]   "makefile_filename": "/usr/lib/python3.11/config-3.11-x86_64-linux-gnu/Makefile",
[virtualenv]   "os": "<module 'os' (frozen)>",
[virtualenv]   "site": "<module 'site' (frozen)>",
[virtualenv]   "datetime": "<module 'datetime' from '/usr/lib/python3.11/datetime.py'>",
[virtualenv]   "math": "<module 'math' (built-in)>",
[virtualenv]   "json": "<module 'json' from '/usr/lib/python3.11/json/__init__.py'>"
[virtualenv] }
[virtualenv] add seed packages via FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/clintonr/.local/share/virtualenv)
[virtualenv] install pip from wheel /home/clintonr/.local/pipx/venvs/poetry/lib/python3.11/site-packages/virtualenv/seed/wheels/embed/pip-24.0-py3-none-any.whl via CopyPipInstall
[virtualenv] install setuptools from wheel /home/clintonr/.local/pipx/venvs/poetry/lib/python3.11/site-packages/virtualenv/seed/wheels/embed/setuptools-69.1.0-py3-none-any.whl via CopyPipInstall
[filelock:filelock] Attempting to acquire lock 139769858390160 on /home/clintonr/.local/share/virtualenv/wheel/3.11/image/1/CopyPipInstall/pip-24.0-py3-none-any.lock
[virtualenv] install wheel from wheel /home/clintonr/.local/pipx/venvs/poetry/lib/python3.11/site-packages/virtualenv/seed/wheels/embed/wheel-0.42.0-py3-none-any.whl via CopyPipInstall
[filelock:filelock] Attempting to acquire lock 139769858379344 on /home/clintonr/.local/share/virtualenv/wheel/3.11/image/1/CopyPipInstall/wheel-0.42.0-py3-none-any.lock
[filelock:filelock] Lock 139769858390160 acquired on /home/clintonr/.local/share/virtualenv/wheel/3.11/image/1/CopyPipInstall/pip-24.0-py3-none-any.lock
[filelock:filelock] Lock 139769858379344 acquired on /home/clintonr/.local/share/virtualenv/wheel/3.11/image/1/CopyPipInstall/wheel-0.42.0-py3-none-any.lock
[filelock:filelock] Attempting to acquire lock 139769858391824 on /home/clintonr/.local/share/virtualenv/wheel/3.11/image/1/CopyPipInstall/setuptools-69.1.0-py3-none-any.lock
[filelock:filelock] Attempting to release lock 139769858390160 on /home/clintonr/.local/share/virtualenv/wheel/3.11/image/1/CopyPipInstall/pip-24.0-py3-none-any.lock
[filelock:filelock] Attempting to release lock 139769858379344 on /home/clintonr/.local/share/virtualenv/wheel/3.11/image/1/CopyPipInstall/wheel-0.42.0-py3-none-any.lock
[filelock:filelock] Lock 139769858391824 acquired on /home/clintonr/.local/share/virtualenv/wheel/3.11/image/1/CopyPipInstall/setuptools-69.1.0-py3-none-any.lock
[filelock:filelock] Lock 139769858379344 released on /home/clintonr/.local/share/virtualenv/wheel/3.11/image/1/CopyPipInstall/wheel-0.42.0-py3-none-any.lock
[filelock:filelock] Lock 139769858390160 released on /home/clintonr/.local/share/virtualenv/wheel/3.11/image/1/CopyPipInstall/pip-24.0-py3-none-any.lock
[filelock:filelock] Attempting to release lock 139769858391824 on /home/clintonr/.local/share/virtualenv/wheel/3.11/image/1/CopyPipInstall/setuptools-69.1.0-py3-none-any.lock
[filelock:filelock] Lock 139769858391824 released on /home/clintonr/.local/share/virtualenv/wheel/3.11/image/1/CopyPipInstall/setuptools-69.1.0-py3-none-any.lock
[virtualenv] copy directory /home/clintonr/.local/share/virtualenv/wheel/3.11/image/1/CopyPipInstall/wheel-0.42.0-py3-none-any/wheel-0.42.0.dist-info to /tmp/tmpdanh_nnf/.venv/lib/python3.11/site-packages/wheel-0.42.0.dist-info
[virtualenv] copy directory /home/clintonr/.local/share/virtualenv/wheel/3.11/image/1/CopyPipInstall/pip-24.0-py3-none-any/pip to /tmp/tmpdanh_nnf/.venv/lib/python3.11/site-packages/pip
[virtualenv] copy directory /home/clintonr/.local/share/virtualenv/wheel/3.11/image/1/CopyPipInstall/setuptools-69.1.0-py3-none-any/setuptools-69.1.0.dist-info to /tmp/tmpdanh_nnf/.venv/lib/python3.11/site-packages/setuptools-69.1.0.dist-info
[virtualenv] copy /home/clintonr/.local/share/virtualenv/wheel/3.11/image/1/CopyPipInstall/wheel-0.42.0-py3-none-any/wheel-0.42.0.virtualenv to /tmp/tmpdanh_nnf/.venv/lib/python3.11/site-packages/wheel-0.42.0.virtualenv
[virtualenv] copy directory /home/clintonr/.local/share/virtualenv/wheel/3.11/image/1/CopyPipInstall/wheel-0.42.0-py3-none-any/wheel to /tmp/tmpdanh_nnf/.venv/lib/python3.11/site-packages/wheel
[virtualenv] copy directory /home/clintonr/.local/share/virtualenv/wheel/3.11/image/1/CopyPipInstall/setuptools-69.1.0-py3-none-any/_distutils_hack to /tmp/tmpdanh_nnf/.venv/lib/python3.11/site-packages/_distutils_hack
[virtualenv] copy directory /home/clintonr/.local/share/virtualenv/wheel/3.11/image/1/CopyPipInstall/setuptools-69.1.0-py3-none-any/setuptools to /tmp/tmpdanh_nnf/.venv/lib/python3.11/site-packages/setuptools
[distlib:distlib.util] changing mode of /tmp/tmpdanh_nnf/.venv/bin/wheel-3.11 to 755
[distlib:distlib.util] changing mode of /tmp/tmpdanh_nnf/.venv/bin/wheel3 to 755
[distlib:distlib.util] changing mode of /tmp/tmpdanh_nnf/.venv/bin/wheel to 755
[distlib:distlib.util] changing mode of /tmp/tmpdanh_nnf/.venv/bin/wheel3.11 to 755
[virtualenv] generated console scripts wheel3.11 wheel wheel-3.11 wheel3
[virtualenv] copy /home/clintonr/.local/share/virtualenv/wheel/3.11/image/1/CopyPipInstall/setuptools-69.1.0-py3-none-any/setuptools-69.1.0.virtualenv to /tmp/tmpdanh_nnf/.venv/lib/python3.11/site-packages/setuptools-69.1.0.virtualenv
[virtualenv] copy directory /home/clintonr/.local/share/virtualenv/wheel/3.11/image/1/CopyPipInstall/setuptools-69.1.0-py3-none-any/pkg_resources to /tmp/tmpdanh_nnf/.venv/lib/python3.11/site-packages/pkg_resources
[virtualenv] copy /home/clintonr/.local/share/virtualenv/wheel/3.11/image/1/CopyPipInstall/setuptools-69.1.0-py3-none-any/distutils-precedence.pth to /tmp/tmpdanh_nnf/.venv/lib/python3.11/site-packages/distutils-precedence.pth
[virtualenv] generated console scripts 
[virtualenv] copy directory /home/clintonr/.local/share/virtualenv/wheel/3.11/image/1/CopyPipInstall/pip-24.0-py3-none-any/pip-24.0.dist-info to /tmp/tmpdanh_nnf/.venv/lib/python3.11/site-packages/pip-24.0.dist-info
[virtualenv] copy /home/clintonr/.local/share/virtualenv/wheel/3.11/image/1/CopyPipInstall/pip-24.0-py3-none-any/pip-24.0.virtualenv to /tmp/tmpdanh_nnf/.venv/lib/python3.11/site-packages/pip-24.0.virtualenv
[distlib:distlib.util] changing mode of /tmp/tmpdanh_nnf/.venv/bin/pip3 to 755
[distlib:distlib.util] changing mode of /tmp/tmpdanh_nnf/.venv/bin/pip3.11 to 755
[distlib:distlib.util] changing mode of /tmp/tmpdanh_nnf/.venv/bin/pip-3.11 to 755
[distlib:distlib.util] changing mode of /tmp/tmpdanh_nnf/.venv/bin/pip to 755
[virtualenv] generated console scripts pip pip3.11 pip3 pip-3.11
[virtualenv] add activators for Bash, CShell, Fish, Nushell, PowerShell, Python
[virtualenv] write /tmp/tmpdanh_nnf/.venv/pyvenv.cfg
[virtualenv]    home = /usr/bin
[virtualenv]    implementation = CPython
[virtualenv]    version_info = 3.11.8.final.0
[virtualenv]    virtualenv = 20.25.1
[virtualenv]    include-system-site-packages = false
[virtualenv]    base-prefix = /usr
[virtualenv]    base-exec-prefix = /usr
[virtualenv]    base-executable = /usr/bin/python3.11
Falling back to parsed setup.py file for /home/clintonr/.cache/pypoetry/virtualenvs/poetry-6dahNO4U-py3.11/src/ariadne

  Stack trace:

  18  ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/cleo/application.py:327 in run
       325│ 
       326│             try:
     → 327│                 exit_code = self._run(io)
       328│             except BrokenPipeError:
       329│                 # If we are piped to another process, it may close early and send a

  17  ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/poetry/console/application.py:190 in _run
       188│         self._load_plugins(io)
       189│ 
     → 190│         exit_code: int = super()._run(io)
       191│         return exit_code
       192│ 

  16  ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/poethepoet/plugin.py:274 in _run
       272│                 tokens.insert(task_name_index, "--")
       273│ 
     → 274│             return continue_run(self, io)
       275│ 
       276│         # Apply the patch

  15  ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/cleo/application.py:431 in _run
       429│             io.input.interactive(interactive)
       430│ 
     → 431│         exit_code = self._run_command(command, io)
       432│         self._running_command = None
       433│ 

  14  ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/cleo/application.py:473 in _run_command
       471│ 
       472│         if error is not None:
     → 473│             raise error
       474│ 
       475│         return terminate_event.exit_code

  13  ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/cleo/application.py:457 in _run_command
       455│ 
       456│             if command_event.command_should_run():
     → 457│                 exit_code = command.run(io)
       458│             else:
       459│                 exit_code = ConsoleCommandEvent.RETURN_CODE_DISABLED

  12  ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/cleo/commands/base_command.py:117 in run
       115│         io.input.validate()
       116│ 
     → 117│         return self.execute(io) or 0
       118│ 
       119│     def merge_application_definition(self, merge_args: bool = True) -> None:

  11  ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/cleo/commands/command.py:61 in execute
        59│ 
        60│         try:
     →  61│             return self.handle()
        62│         except KeyboardInterrupt:
        63│             return 1

  10  ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/poetry/console/commands/add.py:162 in handle
       160│             return 0
       161│ 
     → 162│         requirements = self._determine_requirements(
       163│             packages,
       164│             allow_prereleases=self.option("allow-prereleases"),

   9  ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/poetry/console/commands/init.py:375 in _determine_requirements
       373│ 
       374│         result = []
     → 375│         for requirement in self._parse_requirements(requires):
       376│             if "git" in requirement or "url" in requirement or "path" in requirement:
       377│                 result.append(requirement)

   8  ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/poetry/console/commands/init.py:441 in _parse_requirements
       439│             cwd=cwd,
       440│         )
     → 441│         return [parser.parse(requirement) for requirement in requirements]
       442│ 
       443│     def _format_requirements(self, requirements: list[dict[str, str]]) -> Requirements:

   7  ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/poetry/console/commands/init.py:441 in <listcomp>
       439│             cwd=cwd,
       440│         )
     → 441│         return [parser.parse(requirement) for requirement in requirements]
       442│ 
       443│     def _format_requirements(self, requirements: list[dict[str, str]]) -> Requirements:

   6  ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/poetry/utils/dependency_specification.py:89 in parse
        87│ 
        88│         specification = (
     →  89│             self._parse_url(requirement)
        90│             or self._parse_path(requirement)
        91│             or self._parse_simple(requirement)

   5  ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/poetry/utils/dependency_specification.py:149 in _parse_url
       147│ 
       148│         if url_parsed.scheme in GIT_URL_SCHEMES:
     → 149│             return self._parse_git_url(requirement)
       150│ 
       151│         if url_parsed.scheme in ["http", "https"]:

   4  ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/poetry/utils/dependency_specification.py:133 in _parse_git_url
       131│ 
       132│         source_root = self._env.path.joinpath("src") if self._env else None
     → 133│         package = self._direct_origin.get_package_from_vcs(
       134│             "git",
       135│             url=url.url,

   3  ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/poetry/packages/direct_origin.py:106 in get_package_from_vcs
       104│             raise ValueError(f"Unsupported VCS dependency {vcs}")
       105│ 
     → 106│         return _get_package_from_git(
       107│             url=url,
       108│             branch=branch,

   2  ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/poetry/packages/direct_origin.py:46 in _get_package_from_git
        44│         path = path.joinpath(subdirectory)
        45│ 
     →  46│     package = DirectOrigin.get_package_from_directory(path)
        47│     package._source_type = "git"
        48│     package._source_url = url

   1  ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/poetry/packages/direct_origin.py:75 in get_package_from_directory
        73│     @classmethod
        74│     def get_package_from_directory(cls, directory: Path) -> Package:
     →  75│         return PackageInfo.from_directory(path=directory).to_package(root_dir=directory)
        76│ 
        77│     def get_package_from_url(self, url: str) -> Package:

  RuntimeError

  Unable to create package with no name

  at ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/poetry/inspection/info.py:152 in to_package
      148│         """
      149│         name = name or self.name
      150│ 
      151│         if not name:
    → 152│             raise RuntimeError("Unable to create package with no name")
      153│ 
      154│         if not self.version:
      155│             # The version could not be determined, so we raise an error since it is
      156│             # mandatory.

So, for whatever reason, poetry isn't even trying to use hatchling as a backend?

@dimbleby
Copy link
Contributor

poetry is fine, you just need to get a recent pkginfo in the poetry installation

this is a duplicate of #9191, please close

@abn
Copy link
Member

abn commented Mar 27, 2024

Closing as this is not a feature request, and if it were a bug it is a duplicate of #9191.

Updating pkginfo in your Poetry installation environment or re-installing latest Poetry version will fix the issue.

# if you used install.python-poetry.org script
poetry self add pkginfo==1.10.0

# if you used pipx
pipx runpip poetry install pkginfo==1.10.0

@abn abn closed this as not planned Won't fix, can't repro, duplicate, stale Mar 27, 2024
@abn abn removed the status/triage This issue needs to be triaged label Mar 27, 2024
@pkucmus
Copy link
Author

pkucmus commented Mar 28, 2024

Just to report back, @abn solution solved my issue (tested the pipx variant). Thank you.

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/feature Feature requests/implementations
Projects
None yet
Development

No branches or pull requests

5 participants