question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

poetry install failed for {path=.../git=...} dependency if the package does not have setup.py

See original GitHub issue
  • 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).

Issue

I’m not sure if it’s a bug on poetry but I could not complete poetry install by the following exceptions. The minimum repository to reproduce this behavior has linked above.

With Poetry 1.0.5

Installing dependencies from lock file


Package operations: 1 install, 0 updates, 0 removals

  - Installing package-a (0.1.0 package-a)

[EnvCommandError]
Command ['/Users/alisue/Library/Caches/pypoetry/virtualenvs/poetry-test-MDzUKMz
t-py3.7/bin/pip', 'install', '--no-deps', '-U', '-e', '/Users/alisue/.ghq/githu
b.com/lambdalisue/poetry-test/package-a'] errored with the following return cod
e 1, and output:
Obtaining file:///Users/alisue/.ghq/github.com/lambdalisue/poetry-test/package-
a
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'done'
    Preparing wheel metadata: started
    Preparing wheel metadata: finished with status 'done'
Installing collected packages: package-a
  Running setup.py develop for package-a
    ERROR: Command errored out with exit status 1:
     command: /Users/alisue/Library/Caches/pypoetry/virtualenvs/poetry-test-MDz
UKMzt-py3.7/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"
'/Users/alisue/.ghq/github.com/lambdalisue/poetry-test/package-a/setup.py'"'"';
 __file__='"'"'/Users/alisue/.ghq/github.com/lambdalisue/poetry-test/package-a/
setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read()
.replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '
"'"'exec'"'"'))' develop --no-deps
         cwd: /Users/alisue/.ghq/github.com/lambdalisue/poetry-test/package-a/
    Complete output (3 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    ModuleNotFoundError: No module named 'setuptools'
    ----------------------------------------
ERROR: Command errored out with exit status 1: /Users/alisue/Library/Caches/pyp
oetry/virtualenvs/poetry-test-MDzUKMzt-py3.7/bin/python -c 'import sys, setupto
ols, tokenize; sys.argv[0] = '"'"'/Users/alisue/.ghq/github.com/lambdalisue/poe
try-test/package-a/setup.py'"'"'; __file__='"'"'/Users/alisue/.ghq/github.com/l
ambdalisue/poetry-test/package-a/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'
"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close
();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps Check the l
ogs for full command output.
WARNING: You are using pip version 19.2.3, however version 20.0.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

I have no idea but executing /Users/alisue/.../bin/python -c 'import setuptools' after above exception does NOT fail. Thus it seems setuptools is not available only during pip installation???

Poetry 1.1.0a1

Installing dependencies from lock file


Package operations: 1 install, 0 updates, 0 removals

  - Installing package-a (0.1.0 package-a)

  TypeError

  __init__() takes from 2 to 3 positional arguments but 4 were given

  at ~/.poetry/lib/poetry/installation/pip_installer.py:214 in install_director
y
      210|             # file since pip, as of this comment, does not support
      211|             # build-system for editable packages
      212|             # We also need it for non-PEP-517 packages
      213|             builder = SdistBuilder(
    > 214|                 Factory().create_poetry(pyproject.parent), NullEnv()
, NullIO()
      215|             )
      216|
      217|             with open(setup, "w", encoding="utf-8") as f:
      218|                 f.write(decode(builder.build_setup()))

I’ve followed SdistBuilder -> Builder on my environment and found the following on ~/.../python/3.7.7/lib/python3.7/site-packages/poetry/core/masonry/builders/builder.py (not in ~/.poetry but where python exists)

class Builder(object):
    AVAILABLE_PYTHONS = {"2", "2.7", "3", "3.4", "3.5", "3.6", "3.7"}

    format = None

    def __init__(
        self, poetry, ignore_packages_formats=False
    ):  # type: ("Poetry", "Env", "IO", bool) -> None
        self._poetry = poetry
        self._package = poetry.package

It seems the poetry-core version installed is wrong?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:5
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
lambdalisuecommented, Apr 8, 2020

It seems using pip 18.1 solves the issue for now. I’ll use the following as a workaround for this issue.

$ poetry env remove 3.7
$ poetry run pip install 'pip<19.0'
$ poetry install
$ poetry run python -c 'import package_a'
This is package A

Note that pip 19.0 implements PEP 517 and that cause 'setuptools' exception because no setuptools exists under the isolated environment for building.

3reactions
abncommented, May 24, 2020

This should be fixed in the next preview release.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dependency Management With Python Poetry
Learn how Python Poetry will help you start new projects, maintain existing ones, and master dependency management.
Read more >
Poetry won't install dependency in a tarball/zip file
I can successfully poetry install the extended package ( extension_of_my_package ) when the base package my_package is downloaded from gitlab.
Read more >
History | Poetry - Python dependency management and ...
Fix an issue where the installation of dependencies failed if pip is a dependency and is updated in parallel to other dependencies (#6582)....
Read more >
Poetry - The Blue Book
Sometimes packages are not updated with poetry update or poetryup , to debug why, you need to understand if some package is setting...
Read more >
Ask HN: Why Poetry did not become a mainstream package ...
With npm or go get, if I install a package I know exactly where it got ... for the dependencies needed for the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found