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

project directory can't have same name as a dependency used by project #3438

Closed
3 tasks done
zachvalenta opened this issue Dec 1, 2020 · 9 comments
Closed
3 tasks done
Labels
kind/bug Something isn't working as expected status/duplicate Duplicate issues

Comments

@zachvalenta
Copy link

  • I am on the latest Poetry version.

  • I have searched the issues of this repo and believe that this is not a duplicate.

  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).

  • OS version and name: macOS Mojave 10.14.6 18G103 x86_64

  • Poetry version: Poetry version 1.1.4

  • Link of a Gist with the contents of your pyproject.toml file: https://gist.github.com/zachvalenta/1f7051519003d41a568fbd3ea73f8a99

Issue

I noticed a Poetry project with the same name as a dependency used by the project seems to cause a conflict when downloading that dependency.

For example, I wanted to try out the BDD library behave and so created a new directory also called behave.

$ mkdir behave
$ cd behave
$ poetry init -n
$ poetry add -vvv behave

Using version ^1.2.6 for behave

Updating dependencies
Resolving dependencies... (0.0s)

  AssertionError

  at ~/.local/pipx/venvs/poetry/lib/python3.6/site-packages/poetry/mixology/incompatibility.py:111 in __str__
      107│         )
      108│
      109│     def __str__(self):
      110│         if isinstance(self._cause, DependencyCause):
    → 111│             assert len(self._terms) == 2
      112│
      113│             depender = self._terms[0]
      114│             dependee = self._terms[1]
      115│             assert depender.is_positive()

But when I rename the directory (and Poetry project) to test-behave this problem goes away. I tried the same thing with Django and found the same behavior. I don't know if this is a bug exactly; naming your project directory so uncreatively is an anti-pattern anyway and I was doing so only for a quick proof-of-concept. Still, figure other lazy namers might run into this issue :)

@zachvalenta zachvalenta added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Dec 1, 2020
@sinoroc
Copy link

sinoroc commented Dec 1, 2020

On some levels, your own project and its dependencies (or any other project installed in the same environment) are treated the same. So basically there are 2 projects with the same name that are supposed to be installed in 1 environment, this can not possibly work.

poetry could maybe deliver more informative error message, maybe, but really in my opinion that would be adding more code complexity to poetry for little gain.

@zachvalenta
Copy link
Author

Yeah I was definitely thinking of the 'solution' to this as a little notice in the docs vs. code change. Both plausible I suppose but docs feel more appropriate.

@cocoonkid
Copy link

Oh thanks. I had the same problem. A better error message would be great yes :-0

@xeor
Copy link

xeor commented May 5, 2021

Just linking this issue to #1051 (comment) as many people want this, even tho it doesnt reflect that on this issue only.

There are going to be situations where you want the same name, example when you are not using poetry not primary for packaging, but for keeping a version, example if I got a my-platform/ansible folder, and inside the ansible folder I want poetry to keep track of the package called ansible

@ndevenish
Copy link

Just had a confused 20 minutes tracking down to this issue. I wanted to try out using a package, so made a folder named the same thing.

@takeda
Copy link

takeda commented Jan 6, 2023

Just got this error. I see this open for 2 years so far. At least if there's no intention of fixing it, adding a an error message that states what's going on would help greatly.

@xhiroga
Copy link

xhiroga commented Apr 2, 2023

I guess this PR #3841 resolve this issue.

@radoering
Copy link
Member

Duplicate of #236, resolved by #3841

@radoering radoering closed this as not planned Won't fix, can't repro, duplicate, stale Apr 2, 2023
@radoering radoering added status/duplicate Duplicate issues and removed status/triage This issue needs to be triaged labels Apr 2, 2023
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/duplicate Duplicate issues
Projects
None yet
Development

No branches or pull requests

8 participants