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

Unable to install pyo3-pack on Alpine Linux #154

Closed
thedrow opened this issue Jun 27, 2019 · 15 comments · Fixed by #423
Closed

Unable to install pyo3-pack on Alpine Linux #154

thedrow opened this issue Jun 27, 2019 · 15 comments · Fixed by #423

Comments

@thedrow
Copy link

thedrow commented Jun 27, 2019

This is due to the lack of support for PEP 517 (See #2).

We should release a source distribution of pyo3-pack.

@bsergean
Copy link

I tried to pip install in Docker and got that error.

Step 10/11 : RUN pip install --upgrade pyo3-pack
 ---> Running in 0ff18cb8d404
Collecting pyo3-pack
  Downloading https://files.pythonhosted.org/packages/bb/4c/3e276f48e39f7c86dba37796d4580a7b229dcc7b2ceeb5f0edc544879446/pyo3_pack-0.7.0_beta.10.tar.gz (57kB)
  Installing build dependencies: started
  Installing build dependencies: finished with status 'error'
  ERROR: Command errored out with exit status 2:
   command: /usr/local/bin/python /usr/local/lib/python3.7/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-mijhtirv/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- pyo3-pack
       cwd: None
  Complete output (23 lines):
  Collecting pyo3-pack
    Using cached https://files.pythonhosted.org/packages/bb/4c/3e276f48e39f7c86dba37796d4580a7b229dcc7b2ceeb5f0edc544879446/pyo3_pack-0.7.0_beta.10.tar.gz
  ERROR: Exception:
  Traceback (most recent call last):
    File "/usr/local/lib/python3.7/site-packages/pip/_internal/cli/base_command.py", line 188, in main
      status = self.run(options, args)
    File "/usr/local/lib/python3.7/site-packages/pip/_internal/commands/install.py", line 345, in run
      resolver.resolve(requirement_set)
    File "/usr/local/lib/python3.7/site-packages/pip/_internal/legacy_resolve.py", line 196, in resolve
      self._resolve_one(requirement_set, req)
    File "/usr/local/lib/python3.7/site-packages/pip/_internal/legacy_resolve.py", line 359, in _resolve_one
      abstract_dist = self._get_abstract_dist_for(req_to_install)
    File "/usr/local/lib/python3.7/site-packages/pip/_internal/legacy_resolve.py", line 307, in _get_abstract_dist_for
      self.require_hashes
    File "/usr/local/lib/python3.7/site-packages/pip/_internal/operations/prepare.py", line 213, in prepare_linked_requirement
      with self.req_tracker.track(req):
    File "/usr/local/lib/python3.7/contextlib.py", line 112, in __enter__
      return next(self.gen)
    File "/usr/local/lib/python3.7/site-packages/pip/_internal/req/req_tracker.py", line 94, in track
      self.add(req)
    File "/usr/local/lib/python3.7/site-packages/pip/_internal/req/req_tracker.py", line 63, in add
      % (link, fp.read()))
  LookupError: https://files.pythonhosted.org/packages/bb/4c/3e276f48e39f7c86dba37796d4580a7b229dcc7b2ceeb5f0edc544879446/pyo3_pack-0.7.0_beta.10.tar.gz#sha256=221895634587ba97c4d8f7a264d0f4d520ef0ad640a2af976590430f5a2d9dd1 (from https://pypi.org/simple/pyo3-pack/) is already being built: pyo3-pack from https://files.pythonhosted.org/packages/bb/4c/3e276f48e39f7c86dba37796d4580a7b229dcc7b2ceeb5f0edc544879446/pyo3_pack-0.7.0_beta.10.tar.gz#sha256=221895634587ba97c4d8f7a264d0f4d520ef0ad640a2af976590430f5a2d9dd1
  ----------------------------------------
ERROR: Command errored out with exit status 2: /usr/local/bin/python /usr/local/lib/python3.7/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-mijhtirv/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- pyo3-pack Check the logs for full command output.
The command '/bin/sh -c pip install --upgrade pyo3-pack' returned a non-zero code: 1

@robertodr
Copy link
Contributor

I am getting the same error on NixOS.

@konstin
Copy link
Member

konstin commented Aug 26, 2019

This looks like this pip bug: pypa/pip#5739. The only workaround I can think of would be writing a custom setup.py that builds pyo3-pack, which would kinda defeat the purpose of pyo3-pack and PEP 517.

If you don't need PEP 517 support, you can also just download the binary (https://github.com/PyO3/pyo3-pack/releases/download/v0.7.0-beta.11/pyo3-pack-v0.7.0-beta.11-x86_64-unknown-linux-musl.tar.gz - if there's a problem with a linked library on alpine I can change those releases to fully static binaries)

@thedrow
Copy link
Author

thedrow commented Aug 26, 2019

Could we document the installation process on alpine?

@woutor
Copy link

woutor commented Aug 29, 2019

@konstin I get a not found error using that binary on Alpine. Could you offer fully static binaries?

@konstin
Copy link
Member

konstin commented Aug 29, 2019

I've created #191 with an attempt to fix pip install pyo3-pack on alpine. I already got python setup.py install working in an alpine container, let's see if it also works with pip and pypi.

@konstin
Copy link
Member

konstin commented Aug 30, 2019

There are two solutions:

  • Use the sdist publish with 0.7.0. I haven't tested it completely (it's surprisingly hard to install rustup on alpine, and the rust version apk delivers is too old), but it should work.
  • Fake manylinux compliance and use the wheel like on any other platform.

@konstin
Copy link
Member

konstin commented Sep 18, 2019

It turns out that using musl as a host toolchain isn't really supported by rust and cargo yet (rust-lang/rust#59302). However I've realized that there's an unexpectedly easy solution with cross compiling and multi stage builds:

  • Start with some glibc based image (like rust:strech)
  • Compile with RUSTFLAGS="-C target-feature=-crt-static" and --target x86_64-unknown-linux-musl --manylinux off
  • Switch to alpine
  • apk add libgcc gcompat
  • Pull the wheel from the earlier stage and install it

edit: That solution is for installing some package using maturin, not for maturin itself.

@thedrow
Copy link
Author

thedrow commented Sep 19, 2019

It is supported. What isn't supported is using musl c as a dynamic library as far as I understand.
But I'll try that.

@konstin
Copy link
Member

konstin commented Aug 17, 2020

Since this came up in the pyo3 issue tracker (PyO3/pyo3#1109) and was proposed for setuptools-rust (PyO3/setuptools-rust#80): Should we automatically set -C target-feature=-crt-staticfor --target x86_64-unknown-linux-mus?

@programmerjake
Copy link
Contributor

... for --target x86_64-unknown-linux-mus?

assuming you meant musl instead of mus.

@davidhewitt
Copy link
Member

davidhewitt commented Aug 17, 2020

I think it's ok to automatically set it, ideally with this behaviour documented somewhere. (e.g. in case in the future this flag should no longer be set, users might want to know about it so that they can report it as a bug for us to fix.)

(I think it's ok to automatically set because we already set target-specific flags for macos)

@davidhewitt
Copy link
Member

FYI we've just merged a similar patch to automatically set the flag for musl in setuptools-rust: PyO3/setuptools-rust#80

@thedrow
Copy link
Author

thedrow commented Aug 25, 2020

Can we please do the same here?

@thedrow
Copy link
Author

thedrow commented Sep 21, 2020

@davidhewitt Ping?

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

Successfully merging a pull request may close this issue.

7 participants