Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pip install from sources fails with cargo dependencies identified by a relative path #330

Closed
Tpt opened this issue Jul 19, 2020 · 6 comments

Comments

@Tpt
Copy link
Contributor

Tpt commented Jul 19, 2020

First, thank you so much for PyO3 and Maturin. They are amazing libraries!

pip install . --verbose fails with the following Maturin error when run in this project:

    💥 maturin failed
      Caused by: Cargo metadata failed. Do you have cargo in your PATH?
      Caused by: Error during execution of `cargo metadata`: error: failed to get `oxigraph` as a dependency of package `oxigraph_python v0.1.0 (/tmp/pip-req-build-ra6buqc7)`

    Caused by:
      failed to load source for dependency `oxigraph`

    Caused by:
      Unable to update /tmp/lib

    Caused by:
      failed to read `/tmp/lib/Cargo.toml`

    Caused by:
      No such file or directory (os error 2)

maturin develop works without any problem. I guess the error is caused by the importation of a workspace crate with a relative path:

[dependencies]
oxigraph = {path = "../lib", features=["sled"]}
pyo3 = {version="0.11", features = ["extension-module"]}

The pyproject.toml is the usual

[build-system]
requires = ["maturin"]
build-backend = "maturin"

Version information:

  • Your python version (python -V): 3.8.3
  • Your pip version (pip -V): 20.1.1
  • Your Maturin version: 0.8.2
  • The version of the bindings you're using, if any: Pyo3 0.11
  • Does cargo build work? Yes
  • Does maturin develop work? Yes
@konstin
Copy link
Member

konstin commented Jul 29, 2020

See also #238

@konstin
Copy link
Member

konstin commented Apr 9, 2021

This should be fixed in 0.10

@konstin konstin closed this as completed Apr 9, 2021
@Tpt
Copy link
Contributor Author

Tpt commented Apr 9, 2021

Thank you so much for working on this problem. I just tried again with Maturin 0.10.2 and sadly it does not seem to work for me.

Here is the pip install . --verbose output:

[log about maturin and toml installation]
Successfully installed maturin-0.10.2 toml-0.10.2
  Removed build tracker: '/tmp/pip-req-tracker-e6qjspn5'
  Installing build dependencies ... done
  Running command ~/oxigraph/venv/bin/python ~/oxigraph/venv/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmp5a7ojwme
  Getting requirements to build wheel ... done
    Created temporary directory: /tmp/pip-modern-metadata-tw5ipz44
    Running command ~/oxigraph/venv/bin/python ~/oxigraph/venv/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmpqr5_f0ai
    💥 maturin failed
      Caused by: Cargo metadata failed. Does your crate compile with `cargo build`?
      Caused by: `cargo metadata` exited with an error: error: failed to get `oxigraph` as a dependency of package `pyoxigraph v0.2.2 (/tmp/pip-req-build-fvuumciz)`

    Caused by:
      failed to load source for dependency `oxigraph`

    Caused by:
      Unable to update /tmp/lib

    Caused by:
      failed to read `/tmp/lib/Cargo.toml`

    Caused by:
      No such file or directory (os error 2)
    Error running maturin: Command '['maturin', 'pep517', 'write-dist-info', '--metadata-directory', '/tmp/pip-modern-metadata-tw5ipz44', '--interpreter', '~/oxigraph/venv/bin/python']' returned non-zero exit status 1.
    Checking for Rust toolchain....
    Running `maturin pep517 write-dist-info --metadata-directory /tmp/pip-modern-metadata-tw5ipz44 --interpreter ~/oxigraph/venv/bin/python`
    Preparing wheel metadata ... error
WARNING: Discarding file://~/oxigraph/python. Command errored out with exit status 1: ~/oxigraph/venv/bin/python ~/oxigraph/venv/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmpqr5_f0ai Check the logs for full command output.
ERROR: Command errored out with exit status 1: ~/oxigraph/venv/bin/python ~/oxigraph/venv/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmpqr5_f0ai Check the logs for full command output.
Exception information:
Traceback (most recent call last):
  File "~/oxigraph/venv/lib/python3.9/site-packages/pip/_internal/cli/base_command.py", line 189, in _main
    status = self.run(options, args)
  File "~/oxigraph/venv/lib/python3.9/site-packages/pip/_internal/cli/req_command.py", line 178, in wrapper
    return func(self, options, args)
  File "~/oxigraph/venv/lib/python3.9/site-packages/pip/_internal/commands/install.py", line 316, in run
    requirement_set = resolver.resolve(
  File "~/oxigraph/venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 100, in resolve
    r = self.factory.make_requirement_from_install_req(
  File "~/oxigraph/venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 316, in make_requirement_from_install_req
    raise self._build_failures[ireq.link]
  File "~/oxigraph/venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 167, in _make_candidate_from_link
    self._link_candidate_cache[link] = LinkCandidate(
  File "~/oxigraph/venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 300, in __init__
    super().__init__(
  File "~/oxigraph/venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 144, in __init__
    self.dist = self._prepare()
  File "~/oxigraph/venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 226, in _prepare
    dist = self._prepare_distribution()
  File "~/oxigraph/venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 311, in _prepare_distribution
    return self._factory.preparer.prepare_linked_requirement(
  File "~/oxigraph/venv/lib/python3.9/site-packages/pip/_internal/operations/prepare.py", line 457, in prepare_linked_requirement
    return self._prepare_linked_requirement(req, parallel_builds)
  File "~/oxigraph/venv/lib/python3.9/site-packages/pip/_internal/operations/prepare.py", line 500, in _prepare_linked_requirement
    dist = _get_prepared_distribution(
  File "~/oxigraph/venv/lib/python3.9/site-packages/pip/_internal/operations/prepare.py", line 66, in _get_prepared_distribution
    abstract_dist.prepare_distribution_metadata(finder, build_isolation)
  File "~/oxigraph/venv/lib/python3.9/site-packages/pip/_internal/distributions/sdist.py", line 41, in prepare_distribution_metadata
    self.req.prepare_metadata()
  File "~/oxigraph/venv/lib/python3.9/site-packages/pip/_internal/req/req_install.py", line 549, in prepare_metadata
    self.metadata_directory = self._generate_metadata()
  File "~/oxigraph/venv/lib/python3.9/site-packages/pip/_internal/req/req_install.py", line 534, in _generate_metadata
    return generate_metadata(
  File "~/oxigraph/venv/lib/python3.9/site-packages/pip/_internal/operations/build/metadata.py", line 34, in generate_metadata
    distinfo_dir = backend.prepare_metadata_for_build_wheel(
  File "~/oxigraph/venv/lib/python3.9/site-packages/pip/_vendor/pep517/wrappers.py", line 193, in prepare_metadata_for_build_wheel
    return self._call_hook('prepare_metadata_for_build_wheel', {
  File "~/oxigraph/venv/lib/python3.9/site-packages/pip/_vendor/pep517/wrappers.py", line 274, in _call_hook
    self._subprocess_runner(
  File "~/oxigraph/venv/lib/python3.9/site-packages/pip/_internal/utils/subprocess.py", line 289, in runner
    call_subprocess(
  File "~/oxigraph/venv/lib/python3.9/site-packages/pip/_internal/utils/subprocess.py", line 258, in call_subprocess
    raise InstallationSubprocessError(proc.returncode, command_desc)
pip._internal.exceptions.InstallationSubprocessError: Command errored out with exit status 1: ~/oxigraph/venv/bin/python ~/oxigraph/venv/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmpqr5_f0ai Check the logs for full command output.
Removed file://~/oxigraph/python from build tracker '/tmp/pip-req-tracker-e6qjspn5'
Removed build tracker: '/tmp/pip-req-tracker-e6qjspn5'

@chriamue
Copy link

chriamue commented Apr 24, 2021

I had the same problem.

PIP 21.1 is out now. I tested it with

pip install . --use-feature=in-tree-build

and it works now.

@messense
Copy link
Member

I've just done a test locally and It works fine with pip 21.3.1.

Closing, feel free to reopen if there are still issues unresolved.

@xnlongit
Copy link

xnlongit commented May 4, 2024

ERROR: Command errored out with exit status 1:
command: /home/xuanlong/Projects/Lasuco_GIS/venv/bin/python /home/xuanlong/Projects/Lasuco_GIS/venv/lib/python3.6/site-packages/pip/_vendor/pep517/in_process/in_process.py prepare_metadata_for_build_wheel /tmp/tmpy35yt2e
cwd: /tmp/pip-install-ctwsbm43/orjson_b408f39b82fb4c39b27d48f8d51c0bc5
Complete output (6 lines):
💥 maturin failed
Caused by: pyproject.toml is invalid
Caused by: pyproject.toml is not PEP 517 compliant: invalid type: string "on", expected a boolean for key tool.maturin.strip at line 12 column 9
Error running maturin: Command '['maturin', 'pep517', 'write-dist-info', '--metadata-directory', '/tmp/pip-modern-metadata-06_i6st0', '--interpreter', '/home/xuanlong/Projects/Lasuco_GIS/venv/bin/python']' returned non-zero exit status 1.
Checking for Rust toolchain....
Running maturin pep517 write-dist-info --metadata-directory /tmp/pip-modern-metadata-06_i6st0 --interpreter /home/xuanlong/Projects/Lasuco_GIS/venv/bin/python

I've just done a test locally and It works fine with pip 21.3.1.

Closing, feel free to reopen if there are still issues unresolved.

Python: 3.6.9
Pip: 21.3.1
Ubuntu 20.04
Help me pls! Thank so much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants