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

Can't name my project 'integration' #7261

Closed
4 tasks done
vholmer opened this issue Dec 28, 2022 · 9 comments · Fixed by #7266
Closed
4 tasks done

Can't name my project 'integration' #7261

vholmer opened this issue Dec 28, 2022 · 9 comments · Fixed by #7266
Labels
kind/bug Something isn't working as expected status/triage This issue needs to be triaged

Comments

@vholmer
Copy link

vholmer commented Dec 28, 2022

  • Poetry version: 1.3.1
  • Python version: 3.8.9
  • OS version and name: Ubuntu 20.04 (on WSL)
  • pyproject.toml:
[tool.poetry]
name = "integration"
version = "0.1.0"
description = ""
authors = ["Your Name <you@example.com>"]


[tool.poetry.dependencies]
python = "3.8.9"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
  • I am on the latest stable Poetry version, installed using a recommended method.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have consulted the FAQ and blog for any relevant entries or release notes.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option) and have included the output below.

Issue

It seems like I can't name my project integration, poetry just crashes when running poetry install. If i change the name to anything else, it works.

Here's the output:

Stack trace:

  10  ~/.local/share/pypoetry/venv/lib/python3.8/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

   9  ~/.local/share/pypoetry/venv/lib/python3.8/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│

   8  ~/.local/share/pypoetry/venv/lib/python3.8/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│

   7  ~/.local/share/pypoetry/venv/lib/python3.8/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

   6  ~/.local/share/pypoetry/venv/lib/python3.8/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

   5  ~/.local/share/pypoetry/venv/lib/python3.8/site-packages/cleo/commands/base_command.py:119 in run
       117│         io.input.validate()
       118│
     → 119│         status_code = self.execute(io)
       120│
       121│         if status_code is None:

   4  ~/.local/share/pypoetry/venv/lib/python3.8/site-packages/cleo/commands/command.py:62 in execute
        60│
        61│         try:
     →  62│             return self.handle()
        63│         except KeyboardInterrupt:
        64│             return 1

   3  ~/.local/share/pypoetry/venv/lib/python3.8/site-packages/poetry/console/commands/install.py:174 in handle
       172│             return 0
       173│
     → 174│         builder.build()
       175│
       176│         if overwrite:

   2  ~/.local/share/pypoetry/venv/lib/python3.8/site-packages/poetry/masonry/builders/editable.py:80 in build
        78│         added_files += self._add_pth()
        79│         added_files += self._add_scripts()
     →  80│         self._add_dist_info(added_files)
        81│
        82│         path = self._path

   1  ~/.local/share/pypoetry/venv/lib/python3.8/site-packages/poetry/masonry/builders/editable.py:252 in _add_dist_info
       250│                 {
       251│                     "dir_info": {"editable": True},
     → 252│                     "url": self._poetry.file.path.parent.as_uri(),
       253│                 }
       254│             )

  ValueError

  relative path can't be expressed as a file URI

  at ~/.pyenv/versions/3.8.9/lib/python3.8/pathlib.py:747 in as_uri
       743│
       744│     def as_uri(self):
       745│         """Return the path as a 'file' URI."""
       746│         if not self.is_absolute():
    →  747│             raise ValueError("relative path can't be expressed as a file URI")
       748│         return self._flavour.make_uri(self)
       749│
       750│     @property
       751│     def _cparts(self):
@vholmer vholmer added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Dec 28, 2022
@vholmer
Copy link
Author

vholmer commented Dec 28, 2022

I tried printing the value of "self._poetry.file.path" in ~/.local/share/pypoetry/venv/lib/python3.8/site-packages/poetry/masonry/builders/editable.py:252, it has the following value: "integration/pyproject.toml"

@finswimmer
Copy link
Member

Hey @vholmer,

unfortunately I'm not able to reproduce your issue. Please share as much information as possible about your project/folder structure and Poetry installation. We need a minimal reproducible example for further debugging.

fin swimmer

@vholmer
Copy link
Author

vholmer commented Dec 28, 2022

@finswimmer I managed to produce a minimal reproducible example. First, here's the directory structure:

$ tree .
.
└── integration
    ├── integration
    │   └── meme.py
    ├── poetry.lock
    └── pyproject.toml

Notice that the project package integration itself contains a folder named integration, I think this is causing the issue. When I "poetry install -C integration/" from the root I just get "relative path can't be expressed as a file URI" as previously mentioned. Is this intended or a bug? (meme.py is just an empty file)

@finswimmer
Copy link
Member

Ah, you haven't told us in your original post, that you run poetry install with the -C option. With this I can reproduce your problem.

That's a bug, but we can fix it easily by resolving the given relative path.

@vholmer
Copy link
Author

vholmer commented Dec 28, 2022

@finswimmer Yes, my apologies. I wasn't sure it was related to the -C flag. Actually, I wasn't even sure what exactly caused this until I wrote up that reproducible example.

I'm glad to hear it can be fixed anyway! 👍

@vholmer
Copy link
Author

vholmer commented Dec 29, 2022

@finswimmer I want to emphasize that changing the name in the pyproject.toml to something else fixes the issue. In fact, it seems as if the issue only manifests if the innermost "integration" folder shares a name with the project.

@finswimmer
Copy link
Member

The reason for this is, that if you have a folder with the same name as in the pyproject.toml, Poetry autodetects this folder as the package folder and will install it in editable mode. And this is where the error arises, because in this code we use a method that does not work for relative paths.

@vholmer
Copy link
Author

vholmer commented Dec 29, 2022

@finswimmer Okay I see. I thought I would provide some information that could help you but you're already on the ball!

Looking forward to the fix, happy new year!

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 Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working as expected status/triage This issue needs to be triaged
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants