File: installation.md

package info (click to toggle)
python-argon2 25.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 360 kB
  • sloc: python: 1,251; makefile: 156
file content (78 lines) | stat: -rw-r--r-- 2,797 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# Installation

## Using a Vendored Argon2

```console
$ python -Im pip install argon2-cffi
```

should be all it takes.

But since *argon2-cffi* depends on [argon2-cffi-bindings] that vendors Argon2's C code by default, it can lead to complications depending on the platform.

The C code is known to compile and work on all common platforms (including x86, ARM, and PPC).
On x86, an [SSE2]-optimized version is used.

If something goes wrong, please try to update your *pip* package first:

```console
$ python -Im pip install -U pip
```

Overall this should be the safest bet because *argon2-cffi* has been specifically tested against the vendored version.


### Wheels

Binary [wheels](https://pythonwheels.com) for macOS, Windows, and Linux are provided on [PyPI] by [argon2-cffi-bindings].
With a recent-enough *pip* they should be used automatically.


### Source Distribution

A working C compiler and [CFFI environment] are required to build the [argon2-cffi-bindings] dependency.
If you've been able to compile Python CFFI extensions before, *argon2-cffi* should install without any problems.


## Using a System-wide Installation of Argon2

If you set `ARGON2_CFFI_USE_SYSTEM` to `1` (and *only* `1`), *argon2-cffi-bindings* will not build its bindings.
However binary wheels are preferred by *pip* and Argon2 gets installed along with *argon2-cffi* anyway.

Therefore you also have to instruct *pip* to use a source distribution of [argon2-cffi-bindings]:

```console
$ env ARGON2_CFFI_USE_SYSTEM=1 \
    python -m pip install --no-binary=argon2-cffi-bindings argon2-cffi
```

This approach can lead to problems around your build chain and you can run into incompatibilities between Argon2 and *argon2-cffi* if the latter has been tested against a different version.

**It is your own responsibility to deal with these risks if you choose this path.**

:::{versionadded} 18.1.0
:::

:::{versionchanged} 21.2.0
The `--no-binary` option value changed due to the outsourcing of the binary bindings.
:::


## Override Automatic SSE2 Detection

Usually the build process tries to guess whether or not it should use [SSE2]-optimized code.
Despite our best efforts, this can go wrong.

Therefore you can use the `ARGON2_CFFI_USE_SSE2` environment variable to control the process:

- If you set it to `1`, *argon2-cffi* will build **with** SSE2 support.
- If you set it to `0`, *argon2-cffi* will build **without** SSE2 support.
- If you set it to anything else, it will be ignored and *argon2-cffi* will try to guess.

:::{versionadded} 20.1.0
:::

[argon2-cffi-bindings]: https://github.com/hynek/argon2-cffi-bindings
[cffi environment]: https://cffi.readthedocs.io/en/latest/installation.html
[pypi]: https://pypi.org/project/argon2-cffi-bindings/
[sse2]: https://en.wikipedia.org/wiki/SSE2