-vvv option).A change introduced in 0.12.5 seems to have altered the behavior of poetry install in regards to checking version requirements when installing the project's package itself. For example, I have a project where I want to use the marshmallow library pre-release version 3.0.0rc6 so I specify a requirement of
marshmallow = {version = "^2.19",allows-prereleases = true}
which results in a /svtest.egg-info/requires.txt of:
marshmallow<3.0,>=2.19
On 0.12.4 the poetry install command runs fine, however, on 0.12.5 it fails when trying to install the project's own package:
$ poetry install -vvv
Creating virtualenv svtest-py3.7 in /Users/jtw/src/svtest/.venv
Using virtualenv: /Users/jtw/src/svtest/.venv
Installing dependencies from lock file
Package operations: 1 install, 0 updates, 0 removals
[EnvCommandError]
Command ['/Users/jtw/src/svtest/.venv/bin/python', '-m', 'pip', 'install', '-e', '/Users/jtw/src/svtest'] errored with the fo
llowing output:
Obtaining file:///Users/jtw/src/svtest
Exception:
Traceback (most recent call last):
File "/Users/jtw/src/svtest/.venv/lib/python3.7/site-packages/pip/_internal/req/req_install.py", line 391, in check_if_exis
ts
self.satisfied_by = pkg_resources.get_distribution(str(no_marker))
File "/Users/jtw/src/svtest/.venv/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 479, in get_dist
ribution
dist = get_provider(dist)
File "/Users/jtw/src/svtest/.venv/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 355, in get_prov
ider
return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
File "/Users/jtw/src/svtest/.venv/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 898, in require
needed = self.resolve(parse_requirements(requirements))
File "/Users/jtw/src/svtest/.venv/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 789, in resolve
raise VersionConflict(dist, req).with_context(dependent_req)
pip._vendor.pkg_resources.ContextualVersionConflict: (marshmallow 3.0.0rc6 (/Users/jtw/src/svtest/.venv/lib/python3.7/site-pa
ckages), Requirement.parse('marshmallow<3.0,>=2.19'), {'svtest'})
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/jtw/src/svtest/.venv/lib/python3.7/site-packages/pip/_internal/cli/base_command.py", line 179, in main
status = self.run(options, args)
File "/Users/jtw/src/svtest/.venv/lib/python3.7/site-packages/pip/_internal/commands/install.py", line 315, in run
resolver.resolve(requirement_set)
File "/Users/jtw/src/svtest/.venv/lib/python3.7/site-packages/pip/_internal/resolve.py", line 131, in resolve
self._resolve_one(requirement_set, req)
File "/Users/jtw/src/svtest/.venv/lib/python3.7/site-packages/pip/_internal/resolve.py", line 294, in _resolve_one
abstract_dist = self._get_abstract_dist_for(req_to_install)
File "/Users/jtw/src/svtest/.venv/lib/python3.7/site-packages/pip/_internal/resolve.py", line 226, in _get_abstract_dist_fo
r
req, self.require_hashes, self.use_user_site, self.finder,
File "/Users/jtw/src/svtest/.venv/lib/python3.7/site-packages/pip/_internal/operations/prepare.py", line 386, in prepare_ed
itable_requirement
req.check_if_exists(use_user_site)
File "/Users/jtw/src/svtest/.venv/lib/python3.7/site-packages/pip/_internal/req/req_install.py", line 402, in check_if_exis
ts
self.req.name
File "/Users/jtw/src/svtest/.venv/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 479, in get_dist
ribution
dist = get_provider(dist)
File "/Users/jtw/src/svtest/.venv/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 355, in get_prov
ider
return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
File "/Users/jtw/src/svtest/.venv/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 898, in require
needed = self.resolve(parse_requirements(requirements))
File "/Users/jtw/src/svtest/.venv/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 789, in resolve
raise VersionConflict(dist, req).with_context(dependent_req)
pip._vendor.pkg_resources.ContextualVersionConflict: (marshmallow 3.0.0rc6 (/Users/jtw/src/svtest/.venv/lib/python3.7/site-pa
ckages), Requirement.parse('marshmallow<3.0,>=2.19'), {'svtest'})
You are using pip version 19.0.3, however version 19.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Exception trace:
/Users/jtw/.poetry/lib/poetry/_vendor/py3.7/cleo/application.py in run() at line 94
status_code = self.do_run(input_, output_)
/Users/jtw/.poetry/lib/poetry/console/application.py in do_run() at line 88
return super(Application, self).do_run(i, o)
/Users/jtw/.poetry/lib/poetry/_vendor/py3.7/cleo/application.py in do_run() at line 197
status_code = command.run(input_, output_)
/Users/jtw/.poetry/lib/poetry/console/commands/command.py in run() at line 77
return super(BaseCommand, self).run(i, o)
/Users/jtw/.poetry/lib/poetry/_vendor/py3.7/cleo/commands/base_command.py in run() at line 146
status_code = self.execute(input_, output_)
/Users/jtw/.poetry/lib/poetry/_vendor/py3.7/cleo/commands/command.py in execute() at line 107
return self.handle()
/Users/jtw/.poetry/lib/poetry/console/commands/install.py in handle() at line 77
builder.build()
/Users/jtw/.poetry/lib/poetry/masonry/builders/editable.py in build() at line 17
return self._setup_build()
/Users/jtw/.poetry/lib/poetry/masonry/builders/editable.py in _setup_build() at line 42
"python", "-m", "pip", "install", "-e", str(self._path)
/Users/jtw/.poetry/lib/poetry/utils/env.py in run() at line 536
return super(VirtualEnv, self).run(bin, args, *kwargs)
/Users/jtw/.poetry/lib/poetry/utils/env.py in run() at line 385
raise EnvCommandError(e)
install [--no-dev] [--dry-run] [-E|--extras EXTRAS] [--develop DEVELOP]
Basically, the underlying machinery in 0.12.5 takes issue with trying to install a package with version 3.0.0rc6 when requires.txt has a version specifier of <3.0 whereas previously things worked as expected and the pre-release version was allowed to be installed.
I should note that I can work around the error by tweaking the way the library is specified in pyproject.toml, i.e., marshmallow = {version = ">=2.19",allows-prereleases = true} which will result in a requires.txt entry of: marshmallow>=2.19.
Correct me if I'm wrong, but the behaviour you describe sounds more like a bug in previous versions of poetry has been fixed.
Caret specifiers do not allow updates that modify the left-most non-zero digit, so your version specifier would only allow pre-releases within the 2.x.x series. The following version specifier should work:
marshmallow = {version = "^3.0.0",allows-prereleases = true}
Strangely, I actually had the same version specifier like you in my pyproject.toml. Unfortunately, this is now harder to reproduce, because marshmallow 3.0.0 was released three days ago (2019-08-18).
The following version specifier should work:
marshmallow = {version = "^3.0.0",allows-prereleases = true}
I believe that also didn't work because the release candidate (i.e., 3.0.0rc6) wasn't matched by ^3.0.0.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Closing this issue automatically because it has not had any activity since it has been marked as stale. If you think it is still relevant and should be addressed, feel free to open a new one.
Most helpful comment
I should note that I can work around the error by tweaking the way the library is specified in
pyproject.toml, i.e.,marshmallow = {version = ">=2.19",allows-prereleases = true}which will result in arequires.txtentry of:marshmallow>=2.19.