Git Product home page Git Product logo

Comments (15)

thedrow avatar thedrow commented on May 25, 2024 1

Could we document the installation process on alpine?

from maturin.

konstin avatar konstin commented on May 25, 2024 1

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.

from maturin.

davidhewitt avatar davidhewitt commented on May 25, 2024 1

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

from maturin.

bsergean avatar bsergean commented on May 25, 2024

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

from maturin.

robertodr avatar robertodr commented on May 25, 2024

I am getting the same error on NixOS.

from maturin.

konstin avatar konstin commented on May 25, 2024

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)

from maturin.

woutor avatar woutor commented on May 25, 2024

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

from maturin.

konstin avatar konstin commented on May 25, 2024

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.

from maturin.

konstin avatar konstin commented on May 25, 2024

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.

from maturin.

thedrow avatar thedrow commented on May 25, 2024

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.

from maturin.

konstin avatar konstin commented on May 25, 2024

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?

from maturin.

programmerjake avatar programmerjake commented on May 25, 2024

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

assuming you meant musl instead of mus.

from maturin.

davidhewitt avatar davidhewitt commented on May 25, 2024

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)

from maturin.

thedrow avatar thedrow commented on May 25, 2024

Can we please do the same here?

from maturin.

thedrow avatar thedrow commented on May 25, 2024

@davidhewitt Ping?

from maturin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.