Debian Codegraph @

guide/src/installation.md

raw
1 # Installation
2
3 ## Install from package managers
4
5 [![Packaging status](https://repology.org/badge/vertical-allrepos/maturin.svg?columns=4)](https://repology.org/project/maturin/versions)
6
7 ### PyPI
8
9 maturin is published as Python binary wheel to PyPI, you can install it using [pipx](https://pypa.github.io/pipx/):
10
11 ```bash
12 pipx install maturin
13 ```
14
15 There are some extra dependencies for certain scenarios:
16
17 * `zig`: use zig as linker for easier cross compiling and manylinux compliance.
18 * `patchelf`: repair wheels that links other shared libraries.
19
20 For example, to install patchelf dependencies: `pipx install maturin[patchelf]`.
21
22 > **Note**
23 >
24 > `pip install maturin` should also work if you don't want to use pipx.
25
26 ### Homebrew
27
28 On macOS [maturin is in Homebrew](https://formulae.brew.sh/formula/maturin#default) and you can install maturin from Homebrew:
29
30 ```bash
31 brew install maturin
32 ```
33
34 **Note**: Installing maturin with Homebrew will also install Rust as a dependency, even if you already have Rust installed via [rustup](https://www.rust-lang.org/tools/install). This results in two separate Rust installations, which can cause conflicts. If you've already installed Rust with `rustup`, consider installing maturin with a method other than Homebrew (such as from source with cargo).
35
36 ### conda
37
38 Installing from the `conda-forge` channel can be achieved by adding `conda-forge` to your conda channels with:
39
40 ```
41 conda config --add channels conda-forge
42 conda config --set channel_priority strict
43 ```
44
45 Once the `conda-forge` channel has been enabled, `maturin` can be installed with:
46
47 ```
48 conda install maturin
49 ```
50
51 ### Alpine Linux
52
53 On Alpine Linux, [maturin is in community repository](https://pkgs.alpinelinux.org/packages?name=maturin&branch=edge&repo=community)
54 and can be installed with `apk` after [enabling the community repository](https://wiki.alpinelinux.org/wiki/Enable_Community_Repository):
55
56 ```bash
57 apk add maturin
58 ```
59
60 ## Download from GitHub Releases
61
62 You can download precompiled maturin binaries from the latest [GitHub Releases](https://github.com/PyO3/maturin/releases/latest).
63
64 You can also use [cargo-binstall](https://github.com/cargo-bins/cargo-binstall) to install maturin from GitHub Releases:
65
66 ```bash
67 # Run `cargo install cargo-binstall` first if you don't have cargo-binstall installed.
68 cargo binstall maturin
69 ```
70
71 ## Build from source
72
73 ### crates.io
74
75 You can install maturin from [crates.io](https://crates.io/crates/maturin) using cargo:
76
77 ```bash
78 cargo install --locked maturin
79 ```
80
81 ### Git repository
82
83 ```bash
84 cargo install --locked --git https://github.com/PyO3/maturin.git maturin
85 ```