You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using a version of [email protected] installed using python3.11, projects depending on local projects
by declaring dependencies using the file url (whilst also using the PEP508 specification) fails to
install said project with the following error: The requirement is invalid: invalid URL "file:../dummy".
Note that this error does not occur when poetry is installed using python3.12.
Reproduction
I've created a repository containing a dockerfile which reproduces this bug, and validates that this error does not occur when installing poetry using python3.12, which you may find here.
15 /usr/local/lib/python3.11/site-packages/cleo/application.py:327 in run
325│
326│ try:
→ 327│ exit_code = self._run(io)
328│ except BrokenPipeError:
329│ # If we are piped to another process, it may close early and send a
14 /usr/local/lib/python3.11/site-packages/poetry/console/application.py:236 in _run
234│
235│ with directory(self._working_directory):
→ 236│ exit_code: int = super()._run(io)
237│
238│ return exit_code
12 /usr/local/lib/python3.11/site-packages/cleo/application.py:473 in _run_command
471│
472│ if error is not None:
→ 473│ raise error
474│
475│ return terminate_event.exit_code
11 /usr/local/lib/python3.11/site-packages/cleo/application.py:454 in _run_command
452│
453│ try:
→ 454│ self._event_dispatcher.dispatch(command_event, COMMAND)
455│
456│ if command_event.command_should_run():
10 /usr/local/lib/python3.11/site-packages/cleo/events/event_dispatcher.py:26 in dispatch
24│
25│ if listeners:
→ 26│ self._do_dispatch(listeners, event_name, event)
27│
28│ return event
Description
Hey 👋
When using a version of
[email protected]
installed usingpython3.11
, projects depending on local projectsby declaring dependencies using the
file
url (whilst also using the PEP508 specification) fails toinstall said project with the following error:
The requirement is invalid: invalid URL "file:../dummy"
.Note that this error does not occur when
poetry
is installed usingpython3.12
.Reproduction
I've created a repository containing a dockerfile which reproduces this bug, and validates that this error does not occur when installing poetry using python3.12, which you may find here.
Workarounds
Install poetry using python3.12
Poetry Installation Method
pip
Operating System
Ubuntu 20.04.1
Poetry Version
Poetry (version 2.0.1)
Poetry Configuration
Python Sysconfig
sysconfig.log
Example pyproject.toml
Poetry Runtime Logs
Stack trace:
15 /usr/local/lib/python3.11/site-packages/cleo/application.py:327 in run
325│
326│ try:
→ 327│ exit_code = self._run(io)
328│ except BrokenPipeError:
329│ # If we are piped to another process, it may close early and send a
14 /usr/local/lib/python3.11/site-packages/poetry/console/application.py:236 in _run
234│
235│ with directory(self._working_directory):
→ 236│ exit_code: int = super()._run(io)
237│
238│ return exit_code
13 /usr/local/lib/python3.11/site-packages/cleo/application.py:431 in _run
429│ io.input.interactive(interactive)
430│
→ 431│ exit_code = self._run_command(command, io)
432│ self._running_command = None
433│
12 /usr/local/lib/python3.11/site-packages/cleo/application.py:473 in _run_command
471│
472│ if error is not None:
→ 473│ raise error
474│
475│ return terminate_event.exit_code
11 /usr/local/lib/python3.11/site-packages/cleo/application.py:454 in _run_command
452│
453│ try:
→ 454│ self._event_dispatcher.dispatch(command_event, COMMAND)
455│
456│ if command_event.command_should_run():
10 /usr/local/lib/python3.11/site-packages/cleo/events/event_dispatcher.py:26 in dispatch
24│
25│ if listeners:
→ 26│ self._do_dispatch(listeners, event_name, event)
27│
28│ return event
9 /usr/local/lib/python3.11/site-packages/cleo/events/event_dispatcher.py:85 in _do_dispatch
83│ break
84│
→ 85│ listener(event, event_name, self)
86│
87│ def _sort_listeners(self, event_name: str) -> None:
8 /usr/local/lib/python3.11/site-packages/poetry/console/application.py:343 in configure_env
341│
342│ io = event.io
→ 343│ poetry = command.poetry
344│
345│ env_manager = EnvManager(poetry, io=io)
7 /usr/local/lib/python3.11/site-packages/poetry/console/commands/command.py:24 in poetry
22│ def poetry(self) -> Poetry:
23│ if self._poetry is None:
→ 24│ return self.get_application().poetry
25│
26│ return self._poetry
6 /usr/local/lib/python3.11/site-packages/poetry/console/application.py:181 in poetry
179│ return self._poetry
180│
→ 181│ self._poetry = Factory().create_poetry(
182│ cwd=self._project_directory,
183│ io=self._io,
5 /usr/local/lib/python3.11/site-packages/poetry/factory.py:60 in create_poetry
58│ io = NullIO()
59│
→ 60│ base_poetry = super().create_poetry(cwd=cwd, with_groups=with_groups)
61│
62│ if version_str := base_poetry.local_config.get("requires-poetry"):
4 /usr/local/lib/python3.11/site-packages/poetry/core/factory.py:76 in create_poetry
74│ assert isinstance(version, str)
75│ package = self.get_package(name, version)
→ 76│ self.configure_package(
77│ package, pyproject, poetry_file.parent, with_groups=with_groups
78│ )
3 /usr/local/lib/python3.11/site-packages/poetry/core/factory.py:141 in configure_package
139│ cls._configure_package_metadata(package, project, tool_poetry, root)
140│ cls._configure_entry_points(package, project, tool_poetry)
→ 141│ cls._configure_package_dependencies(
142│ package, project, tool_poetry, with_groups=with_groups
143│ )
2 /usr/local/lib/python3.11/site-packages/poetry/core/factory.py:307 in _configure_package_dependencies
305│ for constraint in dependencies:
306│ group.add_dependency(
→ 307│ Dependency.create_from_pep_508(
308│ constraint, relative_to=package.root_dir
309│ )
1 /usr/local/lib/python3.11/site-packages/poetry/core/packages/dependency.py:360 in create_from_pep_508
358│ name += " ;" + rest.split(" ;", 1)[1]
359│
→ 360│ req = Requirement(name)
361│
362│ name = req.name
InvalidRequirementError
The requirement is invalid: invalid URL "file:../dummy"
at /usr/local/lib/python3.11/site-packages/poetry/core/version/requirements.py:51 in init
47│ url = url.value
48│ parsed_url = urlparse.urlparse(url)
49│ if parsed_url.scheme == "file":
50│ if urlparse.urlunparse(parsed_url) != url:
→ 51│ raise InvalidRequirementError(
52│ f'The requirement is invalid: invalid URL "{url}"'
53│ )
54│ elif (
55│ not (parsed_url.scheme and parsed_url.netloc)
The text was updated successfully, but these errors were encountered: