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

pip install throws ValueError when installing a package built with poetry #3419

Closed
3 tasks done
orlevii opened this issue Nov 25, 2020 · 7 comments
Closed
3 tasks done
Labels
kind/bug Something isn't working as expected

Comments

@orlevii
Copy link

orlevii commented Nov 25, 2020

  • 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 (Catalina)
  • Poetry version: 1.1.4

Issue

I'm experimenting with monorepos, and I want to manage multiple packages under the same git repository.
Because of that, I want all of them to have the same dev-dependencies. so I decided to add another package for the common stuff.

This is my pyproject.toml:

[tool.poetry]
name = "data-tracker"
version = "0.1.0a"
description = ""
authors = ["Or Levi <orlevi128@gmail.com>"]

[tool.poetry.dependencies]
python = "^3.6.1"
pandas = { version = "1.*", optional = true }

[tool.poetry.dev-dependencies]
common-dev = { path = "../common-dev", develop = true }

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

As you can see, common-dev is a path dependency under the dev-dependencies section.

I want to install this package with pip, so I built it using poetry build command, nothing special here.

I tried installing the .whl file - everything works as expected

But when I tried installing the tar.gz I get the following message:

Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... error
    Complete output from command /Users/or.levi/temp/poetry_bug/venv/bin/python3 /Users/or.levi/temp/poetry_bug/venv/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /var/folders/fg/0l5kn8yx7z39kpcj9ryh08wm0000gn/T/tmpojun4eav:
    Traceback (most recent call last):
      File "/Users/or.levi/temp/poetry_bug/venv/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py", line 207, in <module>
        main()
      File "/Users/or.levi/temp/poetry_bug/venv/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py", line 197, in main
        json_out['return_val'] = hook(**hook_input['kwargs'])
      File "/Users/or.levi/temp/poetry_bug/venv/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py", line 69, in prepare_metadata_for_build_wheel
        return hook(metadata_directory, config_settings)
      File "/private/var/folders/fg/0l5kn8yx7z39kpcj9ryh08wm0000gn/T/pip-build-env-ok89w91y/overlay/lib/python3.7/site-packages/poetry/core/masonry/api.py", line 34, in prepare_metadata_for_build_wheel
        poetry = Factory().create_poetry(Path(".").resolve())
      File "/private/var/folders/fg/0l5kn8yx7z39kpcj9ryh08wm0000gn/T/pip-build-env-ok89w91y/overlay/lib/python3.7/site-packages/poetry/core/factory.py", line 111, in create_poetry
        name, constraint, category="dev", root_dir=package.root_dir
      File "/private/var/folders/fg/0l5kn8yx7z39kpcj9ryh08wm0000gn/T/pip-build-env-ok89w91y/overlay/lib/python3.7/site-packages/poetry/core/factory.py", line 249, in create_dependency
        extras=constraint.get("extras", []),
      File "/private/var/folders/fg/0l5kn8yx7z39kpcj9ryh08wm0000gn/T/pip-build-env-ok89w91y/overlay/lib/python3.7/site-packages/poetry/core/packages/directory_dependency.py", line 36, in __init__
        raise ValueError("Directory {} does not exist".format(self._path))
    ValueError: Directory ../common-dev does not exist

Looks like poetry tries to resolve common-dev even though it's a dev-dependency.

(This error also occurs when trying to install from path)

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

sinoroc commented Nov 25, 2020

Sounds like #2174 to me. The potential fix python-poetry/poetry-core#101 has been merged in poetry-core's master branch. If you agree that it indeed might be the same root cause, would you mind trying the fix?

@orlevii
Copy link
Author

orlevii commented Nov 25, 2020

@sinoroc
Thanks, it looks related.

How do I test this fix?

@sinoroc
Copy link

sinoroc commented Nov 25, 2020

How do I test this fix?

I am not sure. Maybe in the pyproject.toml:

[build-system]
requires = ["poetry-core @ git+https://github.com/python-poetry/poetry.git"]
build-backend = "poetry.core.masonry.api"

@orlevii
Copy link
Author

orlevii commented Nov 25, 2020

@sinoroc
Your suggestion works! 🎉

So just need to wait for the next poetry-core version release.
I guess I'll just avoid using path dependencies until then.

@sinoroc
Copy link

sinoroc commented Nov 25, 2020

Your suggestion works! tada

Great!

So just need to wait for the next poetry-core version release.

You could comment on the PR and lobby for a new release of poetry-core. There were a couple of interesting fixes since v1.0.0.

@sinoroc
Copy link

sinoroc commented Nov 25, 2020

@orlevii Should we close this ticket as a duplicate of #2174 then?

@orlevii orlevii closed this as completed Nov 26, 2020
@abn abn removed the status/triage This issue needs to be triaged label Mar 3, 2022
Copy link

github-actions bot commented Mar 2, 2024

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 Mar 2, 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
Projects
None yet
Development

No branches or pull requests

3 participants