Solution
https://cryptography.io/en/latest/installation/
$ apk add gcc musl-dev python3-dev libffi-dev openssl-dev cargo
$ pip install --upgrade pip
$ export CRYPTOGRAPHY_DONT_BUILD_RUST=1
$ pip install cryptography
Solution process
=============================DEBUG ASSISTANCE=============================
If you are seeing a compilation error please try the following steps to
successfully install cryptography:
1) Upgrade to the latest pip and try again. This will fix errors for most
users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip
2) Read https://cryptography.io/en/latest/installation.html for specific
instructions for your platform.
3) Check our frequently asked questions for more information:
https://cryptography.io/en/latest/faq.html
4) Ensure you have a recent Rust toolchain installed:
https://cryptography.io/en/latest/installation.html#rust
5) If you are experiencing issues with Rust for *this release only* you may
set the environment variable `CRYPTOGRAPHY_DONT_BUILD_RUST=1`.
=============================DEBUG ASSISTANCE=============================
error: can't find Rust compiler
If you are using an outdated pip version, it is possible a prebuilt wheel is available for this package but pip is not able to install from it. Installing from the wheel would avoid the need for a Rust compiler.
To update pip, run:
pip install --upgrade pip
and then retry package installation.
If you did intend to build this package from source, try installing a Rust compiler from your system package manager and ensure it is on the PATH during installation. Alternatively, rustup (available at https://rustup.rs) is the recommended way to download and update the Rust compiler toolchain.
This package requires Rust >=1.41.0.
----------------------------------------
ERROR: Failed building wheel for cryptography
Failed to build cryptography
ERROR: Could not build wheels for cryptography which use PEP 517 and cannot be installed directly
It is found that the solution is given above
=============================DEBUG ASSISTANCE=============================
If you are seeing a compilation error please try the following steps to
successfully install cryptography:
1) Upgrade to the latest pip and try again. This will fix errors for most
users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip
2) Read https://cryptography.io/en/latest/installation.html for specific
instructions for your platform.
3) Check our frequently asked questions for more information:
https://cryptography.io/en/latest/faq.html
4) Ensure you have a recent Rust toolchain installed:
https://cryptography.io/en/latest/installation.html#rust
5) If you are experiencing issues with Rust for *this release only* you may
set the environment variable `CRYPTOGRAPHY_DONT_BUILD_RUST=1`.
=============================DEBUG ASSISTANCE=============================
============================= Debugging assistance =============================
If you see a compilation error, try the following steps
Install encryption successfully:
1) Upgrade to the latest pip and try again. This will fix most errors
users. See:https://pip.pypa.io/en/stable/installing/ upgrading-pip
2) Read specifically https://cryptography.io/en/latest/installation.html
for your platform instructions.
3) Check out our FAQ for more information:
https://cryptography.io/en/latest/faq.html
4) Make sure you have recently installed the Rust toolchain:
https://cryptography.io/en/latest/installation.html#rust
5)If you are experiencing problems with Rust in *this version*, you can
set the environment variable ' CRYPTOGRAPHY_DONT_BUILD_RUST=1 '.
============================= Debugging assistance =============================
First, upgrade pip
pip install --upgrade pip
After I upgrade, I will install again or report an error (some people on the Internet have solved it, if you have solved it, ignore the following contents)
Continue to look at the above content and say that my rust version is too low
to view the official website, you need to install the relevant dependencies
https://cryptography.io/en/latest/installation/
sudo apk add gcc musl-dev python3-dev libffi-dev openssl-dev cargo
Re install or report an error, continue to follow the instructions to continue processing
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-km3x31je/matplotlib_fcb1836ff32b459797e98afb66f6211e/setup.py'"'"'; __file__='"'"'/tmp/pip-install-km3x31je/matplotlib_fcb1836ff32b459797e98afb66f6211e/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-7833r8p7
cwd: /tmp/pip-install-km3x31je/matplotlib_fcb1836ff32b459797e98afb66f6211e/
Complete output (44 lines):
WARNING: The repository located at mirrors.aliyun.com is not a trusted or secure host and is being ignored. If this repository is available via HTTPS we recommend you use HTTPS instead, otherwise you may silence this warning and allow it anyway with '--trusted-host mirrors.aliyun.com'.
ERROR: Could not find a version that satisfies the requirement numpy>=1.16 (from versions: none)
ERROR: No matching distribution found for numpy>=1.16
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/setuptools/installer.py", line 75, in fetch_build_egg
subprocess.check_call(cmd)
File "/usr/local/lib/python3.7/subprocess.py", line 363, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/usr/local/bin/python', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmpd6d05k3_', '--quiet', 'numpy>=1.16']' returned non-zero exit status 1.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-km3x31je/matplotlib_fcb1836ff32b459797e98afb66f6211e/setup.py", line 314, in <module>
cmdclass=cmdclass,
File "/usr/local/lib/python3.7/site-packages/setuptools/__init__.py", line 152, in setup
_install_setup_requires(attrs)
File "/usr/local/lib/python3.7/site-packages/setuptools/__init__.py", line 147, in _install_setup_requires
dist.fetch_build_eggs(dist.setup_requires)
File "/usr/local/lib/python3.7/site-packages/setuptools/dist.py", line 782, in fetch_build_eggs
replace_conflicting=True,
File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 768, in resolve
replace_conflicting=replace_conflicting
File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1051, in best_match
return self.obtain(req, installer)
File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1063, in obtain
return installer(requirement)
File "/usr/local/lib/python3.7/site-packages/setuptools/dist.py", line 838, in fetch_build_egg
return fetch_build_egg(self, req)
File "/usr/local/lib/python3.7/site-packages/setuptools/installer.py", line 77, in fetch_build_egg
raise DistutilsError(str(e)) from e
distutils.errors.DistutilsError: Command '['/usr/local/bin/python', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmpd6d05k3_', '--quiet', 'numpy>=1.16']' returned non-zero exit status 1.
Edit setup.cfg to change the build options; suppress output with --quiet.
BUILDING MATPLOTLIB
matplotlib: yes [3.4.2]
python: yes [3.7.10 (default, Jun 29 2021, 01:54:47) [GCC 10.3.1
20210424]]
platform: yes [linux]
tests: no [skipping due to configuration]
macosx: no [Mac OS-X only]
Setting environment variables
export CRYPTOGRAPHY_DONT_BUILD_RUST=1
pip install cryptography
It was a success this time.