-vvv option).
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_)
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.
Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
Hey Stalebot go reboot yourself!
Could you test again with the latest beta release?
I've just tested with 1.0.0b4 and the problem seems to be solved. Nice. Thanks!
Most helpful comment
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 bothpoetry installandpoetry updatefail after the first run because../otherproject/pip-wheel-metadata/otherproject-0.0.0.dist-infoalready exists.The problem seems to be here: https://github.com/sdispater/poetry/blob/master/poetry/masonry/api.py#L39.
mkdirdoesn't check first to see if dist-info directory already exists. A simple fix might be to addexist_ok=Trueto themkdircall, but I'm not sure if this directory is supposed to be cleaned up elsewhere afterpoetry installorpoetry updateis run.