-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
π Bugs / Unexpected behaviors
Versions
Python: 3.8.10
OS: Ubuntu 20.04.5 LTS
Poetry: 1.6.1
pip: 23.2.1
Description
I am trying to set up a poetry environment with this library installed. I started off with a completely new, empty environment. Then I attempted to add the poetry3d
package:
poetry add -vvv git+https://github.com/facebookresearch/pytorch3d.git
Instead of adding it to the poetry environment, I got the following error:
Cloning https://github.com/facebookresearch/pytorch3d.git at 'HEAD' to /home/myfolder/poetry_env/poetry_env_demo/.venv/src/pytorch3d
Stack trace:
1 ~/.local/lib/python3.8/site-packages/poetry/utils/env/base_env.py:344 in _run
342β try:
343β if input_:
β 344β output: str = subprocess.run(
345β cmd,
346β stdout=subprocess.PIPE,
CalledProcessError
Command '['/tmp/tmpxdbpwgq0/.venv/bin/python', '-']' returned non-zero exit status 1.
at /usr/lib/python3.8/subprocess.py:516 in run
512β # We don't call process.wait() as .__exit__ does that for us.
513β raise
514β retcode = process.poll()
515β if check and retcode:
β 516β raise CalledProcessError(retcode, process.args,
517β output=stdout, stderr=stderr)
518β return CompletedProcess(process.args, retcode, stdout, stderr)
519β
520β
The following error occurred when trying to handle this error:
Stack trace:
3 ~/.local/lib/python3.8/site-packages/poetry/inspection/info.py:601 in get_pep517_metadata
599β *PEP517_META_BUILD_DEPS,
600β )
β 601β venv.run(
602β "python",
603β "-",
2 ~/.local/lib/python3.8/site-packages/poetry/utils/env/base_env.py:314 in run
312β def run(self, bin: str, *args: str, **kwargs: Any) -> str:
313β cmd = self.get_command_from_bin(bin) + list(args)
β 314β return self._run(cmd, **kwargs)
315β
316β def run_pip(self, *args: str, **kwargs: Any) -> str:
1 ~/.local/lib/python3.8/site-packages/poetry/utils/env/virtual_env.py:96 in _run
94β def _run(self, cmd: list[str], **kwargs: Any) -> str:
95β kwargs["env"] = self.get_temp_environ(environ=kwargs.get("env"))
β 96β return super()._run(cmd, **kwargs)
97β
98β def get_temp_environ(
EnvCommandError
Command ['/tmp/tmpxdbpwgq0/.venv/bin/python', '-'] errored with the following return code 1
Output:
Traceback (most recent call last):
File "/tmp/tmpxdbpwgq0/.venv/lib/python3.8/site-packages/build/__init__.py", line 466, in _handle_backend
yield
File "/tmp/tmpxdbpwgq0/.venv/lib/python3.8/site-packages/build/__init__.py", line 356, in get_requires_for_build
return set(get_requires(config_settings))
File "/tmp/tmpxdbpwgq0/.venv/lib/python3.8/site-packages/pyproject_hooks/_impl.py", line 166, in get_requires_for_build_wheel
return self._call_hook('get_requires_for_build_wheel', {
File "/tmp/tmpxdbpwgq0/.venv/lib/python3.8/site-packages/pyproject_hooks/_impl.py", line 311, in _call_hook
self._subprocess_runner(
File "/tmp/tmpxdbpwgq0/.venv/lib/python3.8/site-packages/build/__init__.py", line 302, in _runner
self._hook_runner(cmd, cwd, extra_environ)
File "/tmp/tmpxdbpwgq0/.venv/lib/python3.8/site-packages/pyproject_hooks/_impl.py", line 71, in quiet_subprocess_runner
check_output(cmd, cwd=cwd, env=env, stderr=STDOUT)
File "/usr/lib/python3.8/subprocess.py", line 415, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "/usr/lib/python3.8/subprocess.py", line 516, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/tmp/build-env-8vw3hcw7/bin/python', '/tmp/tmpxdbpwgq0/.venv/lib/python3.8/site-packages/pyproject_hooks/_in_process/_in_process.py', 'get_requires_for_build_wheel', '/tmp/tmp9cn0rpj_']' returned non-zero exit status 1.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 16, in <module>
File "/tmp/tmpxdbpwgq0/.venv/lib/python3.8/site-packages/build/__init__.py", line 356, in get_requires_for_build
return set(get_requires(config_settings))
File "/usr/lib/python3.8/contextlib.py", line 131, in __exit__
self.gen.throw(type, value, traceback)
File "/tmp/tmpxdbpwgq0/.venv/lib/python3.8/site-packages/build/__init__.py", line 474, in _handle_backend
raise BuildBackendException( # noqa: B904 # use raise from
build.BuildBackendException: Backend subprocess exited when trying to invoke get_requires_for_build_wheel
Input:
import build
import build.env
import pyproject_hooks
source = '/home/myfolder/poetry_env/poetry_env_demo/.venv/src/pytorch3d'
dest = '/tmp/tmpxdbpwgq0/dist'
with build.env.IsolatedEnvBuilder() as env:
builder = build.ProjectBuilder(
srcdir=source,
scripts_dir=env.scripts_dir,
python_executable=env.executable,
runner=pyproject_hooks.quiet_subprocess_runner,
)
env.install(builder.build_system_requires)
env.install(builder.get_requires_for_build('wheel'))
builder.metadata_path(dest)
at ~/.local/lib/python3.8/site-packages/poetry/utils/env/base_env.py:363 in _run
359β output = subprocess.check_output(
360β cmd, stderr=stderr, env=env, text=True, **kwargs
361β )
362β except CalledProcessError as e:
β 363β raise EnvCommandError(e, input=input_)
364β
365β return output
366β
367β def execute(self, bin: str, *args: str, **kwargs: Any) -> int:
The following error occurred when trying to handle this error:
Stack trace:
2 ~/.local/lib/python3.8/site-packages/poetry/utils/env/base_env.py:359 in _run
357β output = ""
358β else:
β 359β output = subprocess.check_output(
360β cmd, stderr=stderr, env=env, text=True, **kwargs
361β )
1 /usr/lib/python3.8/subprocess.py:415 in check_output
413β kwargs['input'] = empty
414β
β 415β return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
416β **kwargs).stdout
417β
CalledProcessError
Command '['/tmp/tmpxdbpwgq0/.venv/bin/python', 'setup.py', 'egg_info']' returned non-zero exit status 1.
at /usr/lib/python3.8/subprocess.py:516 in run
512β # We don't call process.wait() as .__exit__ does that for us.
513β raise
514β retcode = process.poll()
515β if check and retcode:
β 516β raise CalledProcessError(retcode, process.args,
517β output=stdout, stderr=stderr)
518β return CompletedProcess(process.args, retcode, stdout, stderr)
519β
520β
The following error occurred when trying to handle this error:
Stack trace:
3 ~/.local/lib/python3.8/site-packages/poetry/inspection/info.py:622 in get_pep517_metadata
620β os.chdir(path)
621β try:
β 622β venv.run("python", "setup.py", "egg_info")
623β info = PackageInfo.from_metadata(path)
624β except EnvCommandError as fbe:
2 ~/.local/lib/python3.8/site-packages/poetry/utils/env/base_env.py:314 in run
312β def run(self, bin: str, *args: str, **kwargs: Any) -> str:
313β cmd = self.get_command_from_bin(bin) + list(args)
β 314β return self._run(cmd, **kwargs)
315β
316β def run_pip(self, *args: str, **kwargs: Any) -> str:
1 ~/.local/lib/python3.8/site-packages/poetry/utils/env/virtual_env.py:96 in _run
94β def _run(self, cmd: list[str], **kwargs: Any) -> str:
95β kwargs["env"] = self.get_temp_environ(environ=kwargs.get("env"))
β 96β return super()._run(cmd, **kwargs)
97β
98β def get_temp_environ(
EnvCommandError
Command ['/tmp/tmpxdbpwgq0/.venv/bin/python', 'setup.py', 'egg_info'] errored with the following return code 1
Output:
Traceback (most recent call last):
File "setup.py", line 15, in <module>
import torch
ModuleNotFoundError: No module named 'torch'
at ~/.local/lib/python3.8/site-packages/poetry/utils/env/base_env.py:363 in _run
359β output = subprocess.check_output(
360β cmd, stderr=stderr, env=env, text=True, **kwargs
361β )
362β except CalledProcessError as e:
β 363β raise EnvCommandError(e, input=input_)
364β
365β return output
366β
367β def execute(self, bin: str, *args: str, **kwargs: Any) -> int:
The following error occurred when trying to handle this error:
Stack trace:
18 ~/.local/lib/python3.8/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
17 ~/.local/lib/python3.8/site-packages/poetry/console/application.py:190 in _run
188β self._load_plugins(io)
189β
β 190β exit_code: int = super()._run(io)
191β return exit_code
192β
16 ~/.local/lib/python3.8/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β
15 ~/.local/lib/python3.8/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
14 ~/.local/lib/python3.8/site-packages/cleo/application.py:457 in _run_command
455β
456β if command_event.command_should_run():
β 457β exit_code = command.run(io)
458β else:
459β exit_code = ConsoleCommandEvent.RETURN_CODE_DISABLED
13 ~/.local/lib/python3.8/site-packages/cleo/commands/base_command.py:119 in run
117β io.input.validate()
118β
β 119β status_code = self.execute(io)
120β
121β if status_code is None:
12 ~/.local/lib/python3.8/site-packages/cleo/commands/command.py:62 in execute
60β
61β try:
β 62β return self.handle()
63β except KeyboardInterrupt:
64β return 1
11 ~/.local/lib/python3.8/site-packages/poetry/console/commands/add.py:160 in handle
158β return 0
159β
β 160β requirements = self._determine_requirements(
161β packages,
162β allow_prereleases=self.option("allow-prereleases"),
10 ~/.local/lib/python3.8/site-packages/poetry/console/commands/init.py:375 in _determine_requirements
373β
374β result = []
β 375β for requirement in self._parse_requirements(requires):
376β if "git" in requirement or "url" in requirement or "path" in requirement:
377β result.append(requirement)
9 ~/.local/lib/python3.8/site-packages/poetry/console/commands/init.py:441 in _parse_requirements
439β cwd=cwd,
440β )
β 441β return [parser.parse(requirement) for requirement in requirements]
442β
443β def _format_requirements(self, requirements: list[dict[str, str]]) -> Requirements:
8 ~/.local/lib/python3.8/site-packages/poetry/console/commands/init.py:441 in <listcomp>
439β cwd=cwd,
440β )
β 441β return [parser.parse(requirement) for requirement in requirements]
442β
443β def _format_requirements(self, requirements: list[dict[str, str]]) -> Requirements:
7 ~/.local/lib/python3.8/site-packages/poetry/utils/dependency_specification.py:89 in parse
87β
88β specification = (
β 89β self._parse_url(requirement)
90β or self._parse_path(requirement)
91β or self._parse_simple(requirement)
6 ~/.local/lib/python3.8/site-packages/poetry/utils/dependency_specification.py:149 in _parse_url
147β
148β if url_parsed.scheme in GIT_URL_SCHEMES:
β 149β return self._parse_git_url(requirement)
150β
151β if url_parsed.scheme in ["http", "https"]:
5 ~/.local/lib/python3.8/site-packages/poetry/utils/dependency_specification.py:133 in _parse_git_url
131β
132β source_root = self._env.path.joinpath("src") if self._env else None
β 133β package = self._direct_origin.get_package_from_vcs(
134β "git",
135β url=url.url,
4 ~/.local/lib/python3.8/site-packages/poetry/packages/direct_origin.py:111 in get_package_from_vcs
109β raise ValueError(f"Unsupported VCS dependency {vcs}")
110β
β 111β return _get_package_from_git(
112β url=url,
113β branch=branch,
3 ~/.local/lib/python3.8/site-packages/poetry/packages/direct_origin.py:46 in _get_package_from_git
44β path = path.joinpath(subdirectory)
45β
β 46β package = DirectOrigin.get_package_from_directory(path)
47β package._source_type = "git"
48β package._source_url = url
2 ~/.local/lib/python3.8/site-packages/poetry/packages/direct_origin.py:75 in get_package_from_directory
73β @classmethod
74β def get_package_from_directory(cls, directory: Path) -> Package:
β 75β return PackageInfo.from_directory(path=directory).to_package(root_dir=directory)
76β
77β def get_package_from_url(self, url: str) -> Package:
1 ~/.local/lib/python3.8/site-packages/poetry/inspection/info.py:499 in from_directory
497β info = cls.from_setup_files(path)
498β else:
β 499β info = get_pep517_metadata(path)
500β except PackageInfoError:
501β if not info:
PackageInfoError
Unable to determine package info for path: /home/myfolder/poetry_env/poetry_env_demo/.venv/src/pytorch3d
Command ['/tmp/tmpxdbpwgq0/.venv/bin/python', '-'] errored with the following return code 1
Output:
Traceback (most recent call last):
File "/tmp/tmpxdbpwgq0/.venv/lib/python3.8/site-packages/build/__init__.py", line 466, in _handle_backend
yield
File "/tmp/tmpxdbpwgq0/.venv/lib/python3.8/site-packages/build/__init__.py", line 356, in get_requires_for_build
return set(get_requires(config_settings))
File "/tmp/tmpxdbpwgq0/.venv/lib/python3.8/site-packages/pyproject_hooks/_impl.py", line 166, in get_requires_for_build_wheel
return self._call_hook('get_requires_for_build_wheel', {
File "/tmp/tmpxdbpwgq0/.venv/lib/python3.8/site-packages/pyproject_hooks/_impl.py", line 311, in _call_hook
self._subprocess_runner(
File "/tmp/tmpxdbpwgq0/.venv/lib/python3.8/site-packages/build/__init__.py", line 302, in _runner
self._hook_runner(cmd, cwd, extra_environ)
File "/tmp/tmpxdbpwgq0/.venv/lib/python3.8/site-packages/pyproject_hooks/_impl.py", line 71, in quiet_subprocess_runner
check_output(cmd, cwd=cwd, env=env, stderr=STDOUT)
File "/usr/lib/python3.8/subprocess.py", line 415, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "/usr/lib/python3.8/subprocess.py", line 516, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/tmp/build-env-8vw3hcw7/bin/python', '/tmp/tmpxdbpwgq0/.venv/lib/python3.8/site-packages/pyproject_hooks/_in_process/_in_process.py', 'get_requires_for_build_wheel', '/tmp/tmp9cn0rpj_']' returned non-zero exit status 1.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 16, in <module>
File "/tmp/tmpxdbpwgq0/.venv/lib/python3.8/site-packages/build/__init__.py", line 356, in get_requires_for_build
return set(get_requires(config_settings))
File "/usr/lib/python3.8/contextlib.py", line 131, in __exit__
self.gen.throw(type, value, traceback)
File "/tmp/tmpxdbpwgq0/.venv/lib/python3.8/site-packages/build/__init__.py", line 474, in _handle_backend
raise BuildBackendException( # noqa: B904 # use raise from
build.BuildBackendException: Backend subprocess exited when trying to invoke get_requires_for_build_wheel
Input:
import build
import build.env
import pyproject_hooks
source = '/home/myfolder/poetry_env/poetry_env_demo/.venv/src/pytorch3d'
dest = '/tmp/tmpxdbpwgq0/dist'
with build.env.IsolatedEnvBuilder() as env:
builder = build.ProjectBuilder(
srcdir=source,
scripts_dir=env.scripts_dir,
python_executable=env.executable,
runner=pyproject_hooks.quiet_subprocess_runner,
)
env.install(builder.build_system_requires)
env.install(builder.get_requires_for_build('wheel'))
builder.metadata_path(dest)
Fallback egg_info generation failed.
Command ['/tmp/tmpxdbpwgq0/.venv/bin/python', 'setup.py', 'egg_info'] errored with the following return code 1
Output:
Traceback (most recent call last):
File "setup.py", line 15, in <module>
import torch
ModuleNotFoundError: No module named 'torch'
at ~/.local/lib/python3.8/site-packages/poetry/inspection/info.py:625 in get_pep517_metadata
621β try:
622β venv.run("python", "setup.py", "egg_info")
623β info = PackageInfo.from_metadata(path)
624β except EnvCommandError as fbe:
β 625β raise PackageInfoError(
626β path, e, "Fallback egg_info generation failed.", fbe
627β )
628β finally:
629β os.chdir(cwd)
Alright, so pytorch3d
has a dependency on torch
but despite this pre-requisite, the installation for some reason doesn't install the dependency. So I went ahead and installed torch
:
poetry add torch
Which went successfully. Now I retried the previous installation command, knowing that torch is certainly included in my environment by now:
poetry add -vvv git+https://github.com/facebookresearch/pytorch3d.git
But the error is exactly the same.
Edit 1
I saw this issue from earlier: #1619. But it doesn't offer a clear workaround on how to install pytorch3d with poetry. As I mentioned above, I also installed torch
separately before attempting to install pytorch3d
, but the installation still fails, as pytorch3d
somehow doesn't see the already present torch
dependency in the local venv.
Edit 2
I also came across this: #1479 . I assume this change would solve the issue, but it seems to have been never merged for some reason.