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.

Installing with poetry a package build with poetry fails

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

Using poetry, I try to create a new empty project, build it, then use it in another project also with poetry. That fails. Following a set of commands that reproduces the problem:

# create a new package with poetry and build it
poetry new package
cd package
poetry build
cd ..

# use that new package in a new project
poetry new project
cd project
poetry add ../package
poetry install -vvv

This results in the following error message:

❯ poetry install -vvv
Using virtualenv: /home/antoine/.cache/pypoetry/virtualenvs/project-nwMIyaCB-py3.7
Installing dependencies from lock file


Package operations: 1 install, 0 updates, 0 removals, 10 skipped

  - Skipping more-itertools (7.2.0) Already installed
  - Skipping zipp (0.6.0) Already installed
  - Skipping importlib-metadata (0.20) Already installed
  - Skipping atomicwrites (1.3.0) Already installed
  - Skipping attrs (19.1.0) Already installed
  - Skipping colorama (0.4.1) Not needed for the current environment
  - Skipping pluggy (0.12.0) Already installed
  - Skipping py (1.8.0) Already installed
  - Skipping six (1.12.0) Already installed
  - Installing package (0.1.0 ../package)

[EnvCommandError]
Command ['/home/antoine/.cache/pypoetry/virtualenvs/project-nwMIyaCB-py3.7/bin/python', '-m', 'pip', 'install', '--no-deps', '-U', '-e', '/home/antoine/tmp/package'] errored with the following return code 1, and output: 
Obtaining file:///home/antoine/tmp/package
  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 'error'
    Complete output from command /home/antoine/.cache/pypoetry/virtualenvs/project-nwMIyaCB-py3.7/bin/python /home/antoine/.cache/pypoetry/virtualenvs/project-nwMIyaCB-py3.7/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmpf4alzprh:
    Traceback (most recent call last):
      File "/home/antoine/.cache/pypoetry/virtualenvs/project-nwMIyaCB-py3.7/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py", line 207, in <module>
        main()
      File "/home/antoine/.cache/pypoetry/virtualenvs/project-nwMIyaCB-py3.7/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py", line 197, in main
        json_out['return_val'] = hook(**hook_input['kwargs'])
      File "/home/antoine/.cache/pypoetry/virtualenvs/project-nwMIyaCB-py3.7/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 "/tmp/pip-build-env-50kj76t8/overlay/lib/python3.7/site-packages/poetry/masonry/api.py", line 39, in prepare_metadata_for_build_wheel
        dist_info.mkdir()
      File "/home/antoine/.pyenv/versions/3.7.4/lib/python3.7/pathlib.py", line 1258, in mkdir
        self._accessor.mkdir(self, mode)
    FileExistsError: [Errno 17] File exists: '/home/antoine/tmp/package/pip-wheel-metadata/package-0.1.0.dist-info'
    
    ----------------------------------------
Command "/home/antoine/.cache/pypoetry/virtualenvs/project-nwMIyaCB-py3.7/bin/python /home/antoine/.cache/pypoetry/virtualenvs/project-nwMIyaCB-py3.7/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmpf4alzprh" failed with error code 1 in /home/antoine/tmp/package
You are using pip version 19.0.3, however version 19.2.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.


Traceback (most recent call last):
  File "/home/antoine/.poetry/lib/poetry/_vendor/py3.7/clikit/console_application.py", line 132, in run
    status_code = command.handle(parsed_args, io)
  File "/home/antoine/.poetry/lib/poetry/_vendor/py3.7/clikit/api/command/command.py", line 119, in handle
    status_code = self._do_handle(args, io)
  File "/home/antoine/.poetry/lib/poetry/_vendor/py3.7/clikit/api/command/command.py", line 167, in _do_handle
    return getattr(handler, handler_method)(args, io, self)
  File "/home/antoine/.poetry/lib/poetry/_vendor/py3.7/cleo/commands/command.py", line 92, in wrap_handle
    return self.handle()
  File "/home/antoine/.poetry/lib/poetry/console/commands/install.py", line 63, in handle
    return_code = installer.run()
  File "/home/antoine/.poetry/lib/poetry/installation/installer.py", line 74, in run
    self._do_install(local_repo)
  File "/home/antoine/.poetry/lib/poetry/installation/installer.py", line 286, in _do_install
    self._execute(op)
  File "/home/antoine/.poetry/lib/poetry/installation/installer.py", line 302, in _execute
    getattr(self, '_execute_{}'.format(method))(operation)
  File "/home/antoine/.poetry/lib/poetry/installation/installer.py", line 327, in _execute_install
    self._installer.install(operation.package)
  File "/home/antoine/.poetry/lib/poetry/installation/pip_installer.py", line 32, in install
    self.install_directory(package)
  File "/home/antoine/.poetry/lib/poetry/installation/pip_installer.py", line 201, in install_directory
    return self.run(*args)
  File "/home/antoine/.poetry/lib/poetry/installation/pip_installer.py", line 109, in run
    return self._env.run('python', '-m', 'pip', *args, **kwargs)
  File "/home/antoine/.poetry/lib/poetry/utils/env.py", line 875, in run
    return super(VirtualEnv, self).run(bin, *args, **kwargs)
  File "/home/antoine/.poetry/lib/poetry/utils/env.py", line 708, in run
    raise EnvCommandError(e, input=input_)


Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
wyleecommented, Sep 4, 2019

I’m running into a similar problem with both 0.12.7 and 1.0.0b1. I have otherproject = { path = "../otherproject" } in my pyproject.toml and both poetry install and poetry update fail after the first run because ../otherproject/pip-wheel-metadata/otherproject-0.0.0.dist-info already exists.

The problem seems to be here: https://github.com/sdispater/poetry/blob/master/poetry/masonry/api.py#L39. mkdir doesn’t check first to see if dist-info directory already exists. A simple fix might be to add exist_ok=True to the mkdir call, but I’m not sure if this directory is supposed to be cleaned up elsewhere after poetry install or poetry update is run.

2reactions
antoine-gallixcommented, Nov 13, 2019

Hey Stalebot go reboot yourself!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Running poetry install fails sometimes with new-installer #3336
Issue. At random, poetry install will fail with the following error. The package being installed by pip changes, but the brotli error ......
Read more >
Poetry install fails with EnvCommandError: looks for version ...
I had this same error because for some reason poetry install always failed to create a virtual enviroment path in %APPDATA% .
Read more >
Python package installation issues with Poetry - Medium
My project.toml wanted to install scikit-learn v0.23.2 but somehow would fail with the following message every time i tried to run poetry update ......
Read more >
History | Poetry - Python dependency management and ...
Fix an issue where poetry install fails because of missing hashes for url ... Improved metadata inspection of packages by using the PEP-517...
Read more >
poetry - PyPI
Poetry helps you declare, manage and install dependencies of Python projects, ensuring you have the right stack everywhere. Poetry Install.
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