Closed acbtones closed 1 year ago
Hi @acbtones
Sorry you're having difficulties.
PyGPSClient uses the pyspartn library, which in turn uses the cryptography library, for decrypting SPARTN messages.
It appears that from cryptography >=38.0 onwards, if you install cryptography via pip from a source file (.tar.gz) rather than a binary wheel (.whl), the installation requires a rust compiler. Most modern 64-bit Linux distros can provide a wheel distribution package, but it appears that some older 32-bit versions of Raspi OS don't.
NB: this is only an issue if pip needs to install cryptography from source - if pip can find a binary wheel installation package for your platform, the problem should not occur.
Sometimes simply updating pip (and purging the cache) can resolve the problem (by making available a wheel distribution package)...
python3 -m pip install --upgrade pip
python3 -m pip cache purge
... though I tried this on my own RPI 3 running Raspi Lite without success.
The following worked for me on an RPI 3 running 32-bit Raspi OS Lite (RPI3 Model B V.2):
Firstly, install the rust compiler dependencies:
sudo apt-get install build-essential libssl-dev libffi-dev python3-dev cargo pkg-config
Then install cryptography (NB: the compilation will take several minutes on an old 32-bit RPi):
python -m pip install cryptography
pi@raspberrypi:~ $ python -m pip install cryptography
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting cryptography
Using cached cryptography-41.0.3.tar.gz (630 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Collecting cffi>=1.12 (from cryptography)
Using cached https://www.piwheels.org/simple/cffi/cffi-1.15.1-cp39-cp39-linux_armv7l.whl (364 kB)
Collecting pycparser (from cffi>=1.12->cryptography)
Using cached https://www.piwheels.org/simple/pycparser/pycparser-2.21-py2.py3-none-any.whl (119 kB)
Building wheels for collected packages: cryptography
Building wheel for cryptography (pyproject.toml) ... |
done
Created wheel for cryptography: filename=cryptography-41.0.3-cp39-cp39-linux_armv7l.whl size=2084218 sha256=6ddc66713c9cd8a74db131edeb1519a34cbb5e34d1d85f0db7c4662efb9a9aa1
Stored in directory: /home/pi/.cache/pip/wheels/83/ef/54/3d54fa97a47ec9b505300e38f091780aadce82b0d74f5bcd1c
Successfully built cryptography
Installing collected packages: pycparser, cffi, cryptography
Successfully installed cffi-1.15.1 cryptography-41.0.3 pycparser-2.21
You should then be able to install pyspartn (and by implication any packages dependent on it):
python3 -m pip install pyspartn
pi@raspberrypi:~ $ python3 -m pip install pyspartn
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting pyspartn
Downloading https://www.piwheels.org/simple/pyspartn/pyspartn-0.1.10-py3-none-any.whl (26 kB)
Requirement already satisfied: cryptography>=39.0.2 in ./.local/lib/python3.9/site-packages (from pyspartn) (41.0.3)
Requirement already satisfied: cffi>=1.12 in ./.local/lib/python3.9/site-packages (from cryptography>=39.0.2->pyspartn) (1.15.1)
Requirement already satisfied: pycparser in ./.local/lib/python3.9/site-packages (from cffi>=1.12->cryptography>=39.0.2->pyspartn) (2.21)
Installing collected packages: pyspartn
Successfully installed pyspartn-0.1.10
Try this and let me know how you get on.
If it works, I'll add these instructions to the README.md for PYGPSClient and pyspartn.
@acbtones
In answer to your second point about automatically starting a given serial connection when PyGPSClient starts, this is not supported, but what you can do is start PyGPSClient with a command line option -U or --userport, e.g.:
pygpsclient --userport /dev/ttyACM1
The designated serial port will then be automatically pre-selected in the serial port selection listbox, but you will still need to press the serial 'connect' button.
Out of interest, do you definitely need to use a GUI application for your purposes? There is a separate pygnssutils library which provides much of the underlying functionality of PyGPSClient as a series of CLI utilties, which may be useful for unattended or 'headless' operation.
@acbtones
As an aside, I suspect relatively few PyGPSClient users are actually interested in decrypting SPARTN messages (and the pyspartn library is still only in Alpha), so I may look to add an environment variable e.g. PYSPARTN_NODECRYPT
which in effect suppresses the dependency on the cryptography library for those users who are happy to live without this functionality.
But, hopefully, the wheel distribution package for cryptography will eventually find its way into older 32-bit distros.
Hi,
Thanks for responding so quickly and thanks for the suggestions, but it still doesn't work. From a standard Raspberry Pi OS Full, 32-bit, I'm only doing updates and then trying your suggestions: sudo apt-get update sudo apt-get upgrade sudo reboot python3 -m pip install --upgrade pip sudo apt-get install build-essential libssl-dev libffi-dev python3-dev cargo pkg-config python3 -m pip install cryptography
Defaulting to user installation because normal site-packages is not writeableLooking in indexes: https://pypi.org/simple https://pypi.org/simple, https://www.piwheels.org/simple https://www.piwheels.org/simpleRequirement already satisfied: cryptography in /usr/lib/python3/dist-packages (3.3.2)
python3 -m pip install pyspartn - failed: log attached.
Regards,
Anthony
On Fri, 4 Aug 2023 at 17:34, SEMU Admin @.***> wrote:
Hi @acbtones https://github.com/acbtones
Sorry you're having difficulties.
PyGPSClient uses the pyspartn library, which in turn uses the cryptography library, for decrypting SPARTN messages.
It appears that from cryptography >=38.0 onwards, if you install cryptography via pip from a source file (.tar.gz) rather than a binary wheel (.whl), the installation requires a rust compiler. Most modern 64-bit Linux distros can provide a wheel distribution package, but it appears that some older 32-bit versions of Raspi OS don't.
NB: this is only an issue if pip needs to install cryptography from source - if pip can find a binary wheel installation package for your platform, the problem should not occur.
Sometimes simply updating pip can resolve the problem (by making available a wheel distribution package)...
python3 -m pip install --upgrade pip
... though I tried this on my own RPI 3 running Raspi Lite without success.
The following worked for me on an RPI 3 running 32-bit Raspi OS Lite:
1.
Firstly, install the rust compiler dependencies:
sudo apt-get install build-essential libssl-dev libffi-dev python3-dev cargo pkg-config 2.
Then install cryptography (NB: the compilation will take several minutes on an old 32-bit RPi):
python -m pip install cryptography
@.***:~ $ python -m pip install cryptography Defaulting to user installation because normal site-packages is not writeable Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Collecting cryptography Using cached cryptography-41.0.3.tar.gz (630 kB) Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... done Collecting cffi>=1.12 (from cryptography) Using cached https://www.piwheels.org/simple/cffi/cffi-1.15.1-cp39-cp39-linux_armv7l.whl (364 kB) Collecting pycparser (from cffi>=1.12->cryptography) Using cached https://www.piwheels.org/simple/pycparser/pycparser-2.21-py2.py3-none-any.whl (119 kB) Building wheels for collected packages: cryptography Building wheel for cryptography (pyproject.toml) ... | done Created wheel for cryptography: filename=cryptography-41.0.3-cp39-cp39-linux_armv7l.whl size=2084218 sha256=6ddc66713c9cd8a74db131edeb1519a34cbb5e34d1d85f0db7c4662efb9a9aa1 Stored in directory: /home/pi/.cache/pip/wheels/83/ef/54/3d54fa97a47ec9b505300e38f091780aadce82b0d74f5bcd1c Successfully built cryptography Installing collected packages: pycparser, cffi, cryptography Successfully installed cffi-1.15.1 cryptography-41.0.3 pycparser-2.21
- You should then be able to install pyspartn (and by implication any packages dependent on it):
python3 -m pip install pyspartn
@.***:~ $ python3 -m pip install pyspartn Defaulting to user installation because normal site-packages is not writeable Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Collecting pyspartn Downloading https://www.piwheels.org/simple/pyspartn/pyspartn-0.1.10-py3-none-any.whl (26 kB) Requirement already satisfied: cryptography>=39.0.2 in ./.local/lib/python3.9/site-packages (from pyspartn) (41.0.3) Requirement already satisfied: cffi>=1.12 in ./.local/lib/python3.9/site-packages (from cryptography>=39.0.2->pyspartn) (1.15.1) Requirement already satisfied: pycparser in ./.local/lib/python3.9/site-packages (from cffi>=1.12->cryptography>=39.0.2->pyspartn) (2.21) Installing collected packages: pyspartn Successfully installed pyspartn-0.1.10
Try this and let me know how you get on.
If it works, I'll add these instructions to the README.md for PYGPSClient and pyspartn.
— Reply to this email directly, view it on GitHub https://github.com/semuconsulting/PyGPSClient/issues/84#issuecomment-1665144175, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANKPBXLKXAY6AL3XEIMKZF3XTSQWTANCNFSM6AAAAAA3DSNJPA . You are receiving this because you were mentioned.Message ID: @.***>
python3 -m pip install pyspartn
Defaulting to user installation because normal site-packages is not writeable Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Collecting pyspartn Downloading https://www.piwheels.org/simple/pyspartn/pyspartn-0.1.10-py3-none-any.whl (26 kB) Collecting cryptography>=39.0.2 (from pyspartn) Downloading cryptography-41.0.3.tar.gz (630 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 630.1/630.1 kB 2.2 MB/s eta 0:00:00 Installing build dependencies: started Installing build dependencies: finished with status 'done' Getting requirements to build wheel: started Getting requirements to build wheel: finished with status 'done' Preparing metadata (pyproject.toml): started Preparing metadata (pyproject.toml): finished with status 'done' Collecting cffi>=1.12 (from cryptography>=39.0.2->pyspartn) Using cached https://www.piwheels.org/simple/cffi/cffi-1.15.1-cp39-cp39-linux_armv7l.whl (364 kB) Collecting pycparser (from cffi>=1.12->cryptography>=39.0.2->pyspartn) Using cached https://www.piwheels.org/simple/pycparser/pycparser-2.21-py2.py3-none-any.whl (119 kB) Building wheels for collected packages: cryptography Building wheel for cryptography (pyproject.toml): started Building wheel for cryptography (pyproject.toml): finished with status 'error' error: subprocess-exited-with-error
× Building wheel for cryptography (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [160 lines of output]
/tmp/pip-build-env-7s_u2bya/overlay/lib/python3.9/site-packages/setuptools/config/pyprojecttoml.py:66: _BetaConfiguration: Support for [tool.setuptools]
in pyproject.toml
is still beta.
config = read_configuration(filepath, True, ignore_option_errors, dist)
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-aarch64-cpython-39
creating build/lib.linux-aarch64-cpython-39/cryptography
copying src/cryptography/about.py -> build/lib.linux-aarch64-cpython-39/cryptography
copying src/cryptography/fernet.py -> build/lib.linux-aarch64-cpython-39/cryptography
copying src/cryptography/utils.py -> build/lib.linux-aarch64-cpython-39/cryptography
copying src/cryptography/init.py -> build/lib.linux-aarch64-cpython-39/cryptography
copying src/cryptography/exceptions.py -> build/lib.linux-aarch64-cpython-39/cryptography
creating build/lib.linux-aarch64-cpython-39/cryptography/hazmat
copying src/cryptography/hazmat/_oid.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat
copying src/cryptography/hazmat/init.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat
creating build/lib.linux-aarch64-cpython-39/cryptography/x509
copying src/cryptography/x509/certificate_transparency.py -> build/lib.linux-aarch64-cpython-39/cryptography/x509
copying src/cryptography/x509/name.py -> build/lib.linux-aarch64-cpython-39/cryptography/x509
copying src/cryptography/x509/init.py -> build/lib.linux-aarch64-cpython-39/cryptography/x509
copying src/cryptography/x509/general_name.py -> build/lib.linux-aarch64-cpython-39/cryptography/x509
copying src/cryptography/x509/base.py -> build/lib.linux-aarch64-cpython-39/cryptography/x509
copying src/cryptography/x509/ocsp.py -> build/lib.linux-aarch64-cpython-39/cryptography/x509
copying src/cryptography/x509/oid.py -> build/lib.linux-aarch64-cpython-39/cryptography/x509
copying src/cryptography/x509/extensions.py -> build/lib.linux-aarch64-cpython-39/cryptography/x509
creating build/lib.linux-aarch64-cpython-39/cryptography/hazmat/primitives
copying src/cryptography/hazmat/primitives/padding.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/primitives
copying src/cryptography/hazmat/primitives/poly1305.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/primitives
copying src/cryptography/hazmat/primitives/hmac.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/primitives
copying src/cryptography/hazmat/primitives/_serialization.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/primitives
copying src/cryptography/hazmat/primitives/init.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/primitives
copying src/cryptography/hazmat/primitives/constant_time.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/primitives
copying src/cryptography/hazmat/primitives/hashes.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/primitives
copying src/cryptography/hazmat/primitives/cmac.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/primitives
copying src/cryptography/hazmat/primitives/_cipheralgorithm.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/primitives
copying src/cryptography/hazmat/primitives/keywrap.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/primitives
copying src/cryptography/hazmat/primitives/_asymmetric.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/primitives
creating build/lib.linux-aarch64-cpython-39/cryptography/hazmat/backends
copying src/cryptography/hazmat/backends/init.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/backends
creating build/lib.linux-aarch64-cpython-39/cryptography/hazmat/bindings
copying src/cryptography/hazmat/bindings/init.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/bindings
creating build/lib.linux-aarch64-cpython-39/cryptography/hazmat/primitives/asymmetric
copying src/cryptography/hazmat/primitives/asymmetric/ed448.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/primitives/asymmetric
copying src/cryptography/hazmat/primitives/asymmetric/padding.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/primitives/asymmetric
copying src/cryptography/hazmat/primitives/asymmetric/ec.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/primitives/asymmetric
copying src/cryptography/hazmat/primitives/asymmetric/types.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/primitives/asymmetric
copying src/cryptography/hazmat/primitives/asymmetric/ed25519.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/primitives/asymmetric
copying src/cryptography/hazmat/primitives/asymmetric/utils.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/primitives/asymmetric
copying src/cryptography/hazmat/primitives/asymmetric/init.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/primitives/asymmetric
copying src/cryptography/hazmat/primitives/asymmetric/x25519.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/primitives/asymmetric
copying src/cryptography/hazmat/primitives/asymmetric/x448.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/primitives/asymmetric
copying src/cryptography/hazmat/primitives/asymmetric/rsa.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/primitives/asymmetric
copying src/cryptography/hazmat/primitives/asymmetric/dsa.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/primitives/asymmetric
copying src/cryptography/hazmat/primitives/asymmetric/dh.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/primitives/asymmetric
creating build/lib.linux-aarch64-cpython-39/cryptography/hazmat/primitives/kdf
copying src/cryptography/hazmat/primitives/kdf/hkdf.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/primitives/kdf
copying src/cryptography/hazmat/primitives/kdf/pbkdf2.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/primitives/kdf
copying src/cryptography/hazmat/primitives/kdf/init.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/primitives/kdf
copying src/cryptography/hazmat/primitives/kdf/concatkdf.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/primitives/kdf
copying src/cryptography/hazmat/primitives/kdf/scrypt.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/primitives/kdf
copying src/cryptography/hazmat/primitives/kdf/x963kdf.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/primitives/kdf
copying src/cryptography/hazmat/primitives/kdf/kbkdf.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/primitives/kdf
creating build/lib.linux-aarch64-cpython-39/cryptography/hazmat/primitives/twofactor
copying src/cryptography/hazmat/primitives/twofactor/hotp.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/primitives/twofactor
copying src/cryptography/hazmat/primitives/twofactor/init.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/primitives/twofactor
copying src/cryptography/hazmat/primitives/twofactor/totp.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/primitives/twofactor
creating build/lib.linux-aarch64-cpython-39/cryptography/hazmat/primitives/ciphers
copying src/cryptography/hazmat/primitives/ciphers/init.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/primitives/ciphers
copying src/cryptography/hazmat/primitives/ciphers/base.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/primitives/ciphers
copying src/cryptography/hazmat/primitives/ciphers/aead.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/primitives/ciphers
copying src/cryptography/hazmat/primitives/ciphers/algorithms.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/primitives/ciphers
copying src/cryptography/hazmat/primitives/ciphers/modes.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/primitives/ciphers
creating build/lib.linux-aarch64-cpython-39/cryptography/hazmat/primitives/serialization
copying src/cryptography/hazmat/primitives/serialization/pkcs12.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/primitives/serialization
copying src/cryptography/hazmat/primitives/serialization/ssh.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/primitives/serialization
copying src/cryptography/hazmat/primitives/serialization/init.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/primitives/serialization
copying src/cryptography/hazmat/primitives/serialization/base.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/primitives/serialization
copying src/cryptography/hazmat/primitives/serialization/pkcs7.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/primitives/serialization
creating build/lib.linux-aarch64-cpython-39/cryptography/hazmat/backends/openssl
copying src/cryptography/hazmat/backends/openssl/ec.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/backends/openssl
copying src/cryptography/hazmat/backends/openssl/ciphers.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/backends/openssl
copying src/cryptography/hazmat/backends/openssl/utils.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/backends/openssl
copying src/cryptography/hazmat/backends/openssl/init.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/backends/openssl
copying src/cryptography/hazmat/backends/openssl/decode_asn1.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/backends/openssl
copying src/cryptography/hazmat/backends/openssl/cmac.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/backends/openssl
copying src/cryptography/hazmat/backends/openssl/aead.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/backends/openssl
copying src/cryptography/hazmat/backends/openssl/backend.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/backends/openssl
copying src/cryptography/hazmat/backends/openssl/rsa.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/backends/openssl
creating build/lib.linux-aarch64-cpython-39/cryptography/hazmat/bindings/openssl
copying src/cryptography/hazmat/bindings/openssl/_conditional.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/bindings/openssl
copying src/cryptography/hazmat/bindings/openssl/init.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/bindings/openssl
copying src/cryptography/hazmat/bindings/openssl/binding.py -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/bindings/openssl
running egg_info
writing src/cryptography.egg-info/PKG-INFO
writing dependency_links to src/cryptography.egg-info/dependency_links.txt
writing requirements to src/cryptography.egg-info/requires.txt
writing top-level names to src/cryptography.egg-info/top_level.txt
reading manifest file 'src/cryptography.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '.c' under directory 'src/_cffi_src'
warning: no files found matching '.h' under directory 'src/_cffi_src'
no previously-included directories found matching 'docs/_build'
warning: no previously-included files found matching 'vectors'
warning: no previously-included files matching '' found under directory 'vectors'
warning: no previously-included files found matching 'src/rust/target'
warning: no previously-included files matching '' found under directory 'src/rust/target'
warning: no previously-included files matching '*' found under directory '.github'
warning: no previously-included files found matching 'release.py'
warning: no previously-included files found matching '.readthedocs.yml'
warning: no previously-included files found matching 'ci-constraints-requirements.txt'
warning: no previously-included files found matching 'mypy.ini'
adding license file 'LICENSE'
adding license file 'LICENSE.APACHE'
adding license file 'LICENSE.BSD'
writing manifest file 'src/cryptography.egg-info/SOURCES.txt'
copying src/cryptography/py.typed -> build/lib.linux-aarch64-cpython-39/cryptography
creating build/lib.linux-aarch64-cpython-39/cryptography/hazmat/bindings/_rust
copying src/cryptography/hazmat/bindings/_rust/init.pyi -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/bindings/_rust
copying src/cryptography/hazmat/bindings/_rust/_openssl.pyi -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/bindings/_rust
copying src/cryptography/hazmat/bindings/_rust/asn1.pyi -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/bindings/_rust
copying src/cryptography/hazmat/bindings/_rust/exceptions.pyi -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/bindings/_rust
copying src/cryptography/hazmat/bindings/_rust/ocsp.pyi -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/bindings/_rust
copying src/cryptography/hazmat/bindings/_rust/pkcs7.pyi -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/bindings/_rust
copying src/cryptography/hazmat/bindings/_rust/x509.pyi -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/bindings/_rust
creating build/lib.linux-aarch64-cpython-39/cryptography/hazmat/bindings/_rust/openssl
copying src/cryptography/hazmat/bindings/_rust/openssl/init.pyi -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/bindings/_rust/openssl
copying src/cryptography/hazmat/bindings/_rust/openssl/dh.pyi -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/bindings/_rust/openssl
copying src/cryptography/hazmat/bindings/_rust/openssl/dsa.pyi -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/bindings/_rust/openssl
copying src/cryptography/hazmat/bindings/_rust/openssl/ed25519.pyi -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/bindings/_rust/openssl
copying src/cryptography/hazmat/bindings/_rust/openssl/ed448.pyi -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/bindings/_rust/openssl
copying src/cryptography/hazmat/bindings/_rust/openssl/hashes.pyi -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/bindings/_rust/openssl
copying src/cryptography/hazmat/bindings/_rust/openssl/hmac.pyi -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/bindings/_rust/openssl
copying src/cryptography/hazmat/bindings/_rust/openssl/kdf.pyi -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/bindings/_rust/openssl
copying src/cryptography/hazmat/bindings/_rust/openssl/poly1305.pyi -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/bindings/_rust/openssl
copying src/cryptography/hazmat/bindings/_rust/openssl/x25519.pyi -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/bindings/_rust/openssl
copying src/cryptography/hazmat/bindings/_rust/openssl/x448.pyi -> build/lib.linux-aarch64-cpython-39/cryptography/hazmat/bindings/_rust/openssl
running build_ext
running build_rust
=============================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/ for specific
instructions for your platform.
3) Check our frequently asked questions for more information:
https://cryptography.io/en/latest/faq/
4) Ensure you have a recent Rust toolchain installed:
https://cryptography.io/en/latest/installation/#rust
Python: 3.9.2
platform: Linux-6.1.21-v8+-aarch64-with-glibc2.31
pip: n/a
setuptools: 68.0.0
setuptools_rust: 1.6.0
rustc: 1.48.0 (471d696c7 2020-12-10)
=============================DEBUG ASSISTANCE=============================
error: Rust 1.48.0 does not match extension requirement >=1.56.0
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for cryptography Failed to build cryptography ERROR: Could not build wheels for cryptography, which is required to install pyproject.toml-based projects
Hi @acbtones
OK so it appears to be objecting to the specific version of the rust compiler installed. Let me install everything from scratch so we're comparing like with like...
sudo apt update
sudo apt upgrade -y
sudo apt autoremove -y
sudo reboot
The platfom details after rebooting were as follows:
cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 11 (bullseye)"
NAME="Raspbian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
uname -a
Linux raspberrypi 6.1.21-v7+ #1642 SMP Mon Apr 3 17:20:52 BST 2023 armv7l GNU/Linux
python3 -V
Python 3.9.2
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustc -V
rustc 1.71.1 (eb26296b5 2023-08-03)
cargo
, which has already been installed in the previous step):sudo apt-get install build-essential libssl-dev libffi-dev python3-dev pkg-config
python3 -m pip install --upgrade pip
cryptography
library from a source .tar.gz
file):python3 -m pip install pyspartn
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting pyspartn
Using cached https://www.piwheels.org/simple/pyspartn/pyspartn-0.1.10-py3-none-any.whl (26 kB)
Collecting cryptography>=39.0.2 (from pyspartn)
Using cached cryptography-41.0.3.tar.gz (630 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Collecting cffi>=1.12 (from cryptography>=39.0.2->pyspartn)
Using cached https://www.piwheels.org/simple/cffi/cffi-1.15.1-cp39-cp39-linux_armv7l.whl (364 kB)
Collecting pycparser (from cffi>=1.12->cryptography>=39.0.2->pyspartn)
Using cached https://www.piwheels.org/simple/pycparser/pycparser-2.21-py2.py3-none-any.whl (119 kB)
Building wheels for collected packages: cryptography
Building wheel for cryptography (pyproject.toml) ... done
Created wheel for cryptography: filename=cryptography-41.0.3-cp39-cp39-linux_armv7l.whl size=2084768 sha256=9aa029edb05e0337f363133d1b58b7be518a4d79e905a4361994323f766ded0b
Stored in directory: /home/steve/.cache/pip/wheels/83/ef/54/3d54fa97a47ec9b505300e38f091780aadce82b0d74f5bcd1c
Successfully built cryptography
Installing collected packages: pycparser, cffi, cryptography, pyspartn
Successfully installed cffi-1.15.1 cryptography-41.0.3 pycparser-2.21 pyspartn-0.1.10
python3-pil.imagetk
dependency first (it's not installed by default on Raspberry Pi OS):sudo apt install python3-pil.imagetk
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Suggested packages:
python-pil-doc python3-pil.imagetk-dbg
The following NEW packages will be installed:
python3-pil.imagetk
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 74.4 kB of archives.
After this operation, 103 kB of additional disk space will be used.
Get:1 http://raspbian.raspberrypi.org/raspbian bullseye/main armhf python3-pil.imagetk armhf 8.1.2+dfsg-0.3+deb11u1 [74.4 kB]
Fetched 74.4 kB in 1s (129 kB/s)
Selecting previously unselected package python3-pil.imagetk:armhf.
(Reading database ... 106702 files and directories currently installed.)
Preparing to unpack .../python3-pil.imagetk_8.1.2+dfsg-0.3+deb11u1_armhf.deb ...
Unpacking python3-pil.imagetk:armhf (8.1.2+dfsg-0.3+deb11u1) ...
Setting up python3-pil.imagetk:armhf (8.1.2+dfsg-0.3+deb11u1) ...
python3 -m pip install pygpsclient
...
Successfully installed Pillow-10.0.0 charset-normalizer-3.2.0 paho-mqtt-1.6.1 pygnssutils-1.0.12 pygpsclient-1.4.0 pynmeagps-1.0.28 pyrtcm-1.0.11 pyserial-3.5 pyubx2-1.2.29 requests-2.31.0
And here is PyGPSClient running quite happily on my RPI3 32-bit Full machine:
Hope this helps.
@acbtones
If all else fails, here's a zipped copy of the actual *.whl
file generated when I installed cryptography
on my RPI3 above.
NB: 1) This will only work on RPI3 Model B platforms. 2) Downloading installation files from untrusted sources is not normally to be recommended, so install at your own risk. Check the hash on the unzipped file to ensure it hasn't been tampered with before installing:
shasum -a 256 cryptography-41.0.3-cp39-cp39-linux_armv7l.whl
9aa029edb05e0337f363133d1b58b7be518a4d79e905a4361994323f766ded0b cryptography-41.0.3-cp39-cp39-linux_armv7l.whl
Once unzipped, you should be able to install this directly using:
python3 -m pip install cryptography-41.0.3-cp39-cp39-linux_armv7l.whl
Hi,
Thanks again for your comprehensive follow up! I can confirm that your updated instructions work on a RPi3, 32-bit. I also tried the installation on a RPi4, 32-bit and there is one catch that users should be aware of: when installing Rust on the RPi4, 32-bit, the default Rust installation is:
Current installation options: default host triple: aarch64-unknown-linux-gnu default toolchain: stable (default) profile: default modify PATH variable: yes
However, the default host triple: aarch64-unknown-linux-gnu is for a 64-bit OS. The Rust installer is not detecting that the RPi is running the 32-bit OS. The installation appears to succeed, but Rust is not installed:
info: default toolchain set to 'stable-aarch64-unknown-linux-gnu'
stable-aarch64-unknown-linux-gnu installed - (error reading rustc version)
Rust is installed now. Great!
To get started you may need to restart your current shell. This would reload your PATH environment variable to include Cargo's bin directory ($HOME/.cargo/bin).
To configure your current shell, run: source "$HOME/.cargo/env" $ source "$HOME/.cargo/env" $ rustc -V error: command failed: 'rustc': No such file or directory (os error 2)
So you have to customise the Rust installation (Option 2) and use the armv7-unknown-linux-gnueabihf host triple:
Current installation options:
default host triple: aarch64-unknown-linux-gnu default toolchain: stable (default) profile: default modify PATH variable: yes
1) Proceed with installation (default) 2) Customize installation 3) Cancel installation
2
I'm going to ask you the value of each of these installation options. You may simply press the Enter key to leave unchanged.
Default host triple? [aarch64-unknown-linux-gnu] armv7-unknown-linux-gnueabihf
Default toolchain? (stable/beta/nightly/none) [stable]
Profile (which tools and data to install)? (minimal/default/complete) [default]
Modify PATH variable? (Y/n) y
Current installation options:
default host triple: armv7-unknown-linux-gnueabihf default toolchain: stable profile: default modify PATH variable: yes
1) Proceed with installation (default) 2) Customize installation 3) Cancel installation
1
Rust installs successfully. $ source "$HOME/.cargo/env" $ rustc -V rustc 1.71.1 (eb26296b5 2023-08-03)
RPi3:
[image: RPi3_32bit.png]
RPi4:
[image: RPi4_32bit.png]
Regards,
Anthony
On Sat, 5 Aug 2023 at 18:47, SEMU Admin @.***> wrote:
Hi @acbtones https://github.com/acbtones
OK so it appears to be objecting to the specific version of the rust compiler installed. Let me install everything from scratch so we're comparing like with like...
- I installed a fresh Raspberry Pi OS 32-bit Full on my RPI3 Model B.2 using the official Raspberry Pi Imager, so it should exactly match your machine. I did an initial update:
sudo apt update sudo apt upgrade -y sudo apt autoremove -y sudo reboot
The platfom details after rebooting were as follows:
cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 11 (bullseye)" NAME="Raspbian GNU/Linux" VERSION_ID="11" VERSION="11 (bullseye)" VERSION_CODENAME=bullseye ID=raspbian ID_LIKE=debian HOME_URL="http://www.raspbian.org/" SUPPORT_URL="http://www.raspbian.org/RaspbianForums" BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
uname -a
Linux raspberrypi 6.1.21-v7+ #1642 SMP Mon Apr 3 17:20:52 BST 2023 armv7l GNU/Linux
python3 -V
Python 3.9.2
- Install Rust using the official instructions here https://www.rust-lang.org/tools/install. This takes about 3 minutes to run:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
- Check the version of the rust compiler installed (it needs to be >= 1.56 apparently):
rustc -V
rustc 1.71.1 (eb26296b5 2023-08-03)
- Install the cryptography library build dependencies (omitting cargo, which has already been installed in the previous step):
sudo apt-get install build-essential libssl-dev libffi-dev python3-dev pkg-config
- Update pip:
python3 -m pip install --upgrade pip
- Install pyspartn using pip (this will take about 2 minutes as it has to compile the cryptography library from a source .tar.gz file):
python3 -m pip install pyspartn
Defaulting to user installation because normal site-packages is not writeable Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Collecting pyspartn Using cached https://www.piwheels.org/simple/pyspartn/pyspartn-0.1.10-py3-none-any.whl (26 kB) Collecting cryptography>=39.0.2 (from pyspartn) Using cached cryptography-41.0.3.tar.gz (630 kB) Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... done Collecting cffi>=1.12 (from cryptography>=39.0.2->pyspartn) Using cached https://www.piwheels.org/simple/cffi/cffi-1.15.1-cp39-cp39-linux_armv7l.whl (364 kB) Collecting pycparser (from cffi>=1.12->cryptography>=39.0.2->pyspartn) Using cached https://www.piwheels.org/simple/pycparser/pycparser-2.21-py2.py3-none-any.whl (119 kB) Building wheels for collected packages: cryptography Building wheel for cryptography (pyproject.toml) ... done Created wheel for cryptography: filename=cryptography-41.0.3-cp39-cp39-linux_armv7l.whl size=2084768 sha256=9aa029edb05e0337f363133d1b58b7be518a4d79e905a4361994323f766ded0b Stored in directory: /home/steve/.cache/pip/wheels/83/ef/54/3d54fa97a47ec9b505300e38f091780aadce82b0d74f5bcd1c Successfully built cryptography Installing collected packages: pycparser, cffi, cryptography, pyspartn Successfully installed cffi-1.15.1 cryptography-41.0.3 pycparser-2.21 pyspartn-0.1.10
- If this is successful, you should then be able to install PyGPSClient as per the standard installation instructions, remembering to install the python3-pil.imagetk dependency first (it's not installed by default on Raspberry Pi OS):
sudo apt install python3-pil.imagetk
Reading package lists... Done Building dependency tree... Done Reading state information... Done Suggested packages: python-pil-doc python3-pil.imagetk-dbg The following NEW packages will be installed: python3-pil.imagetk 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 74.4 kB of archives. After this operation, 103 kB of additional disk space will be used. Get:1 http://raspbian.raspberrypi.org/raspbian bullseye/main armhf python3-pil.imagetk armhf 8.1.2+dfsg-0.3+deb11u1 [74.4 kB] Fetched 74.4 kB in 1s (129 kB/s) Selecting previously unselected package python3-pil.imagetk:armhf. (Reading database ... 106702 files and directories currently installed.) Preparing to unpack .../python3-pil.imagetk_8.1.2+dfsg-0.3+deb11u1_armhf.deb ... Unpacking python3-pil.imagetk:armhf (8.1.2+dfsg-0.3+deb11u1) ... Setting up python3-pil.imagetk:armhf (8.1.2+dfsg-0.3+deb11u1) ...
python3 -m pip install pygpsclient
... Successfully installed Pillow-10.0.0 charset-normalizer-3.2.0 paho-mqtt-1.6.1 pygnssutils-1.0.12 pygpsclient-1.4.0 pynmeagps-1.0.28 pyrtcm-1.0.11 pyserial-3.5 pyubx2-1.2.29 requests-2.31.0
And here is PyGPSClient running quite happily on my RPI3 32-bit Full machine: [image: pygpsclient] https://user-images.githubusercontent.com/28569967/258573488-71615ce0-5a8c-42eb-9ff7-91abe6171395.png
Hope this helps.
— Reply to this email directly, view it on GitHub https://github.com/semuconsulting/PyGPSClient/issues/84#issuecomment-1666443832, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANKPBXN7CA252YCDQB7Q5ZDXTYCCPANCNFSM6AAAAAA3DSNJPA . You are receiving this because you were mentioned.Message ID: @.***>
Hi, Thanks again for your comprehensive follow up! I can confirm that your updated instructions work on a RPi3, 32-bit. I also tried the installation on a RPi4, 32-bit and there is one catch that users should be aware of: when installing Rust on the RPi4, 32-bit...
Thanks for the tip - just confirmed this on my own RPI 4 Model B 4MB. I've come across this issue before - the platform architecture of the RPI4 is indeed aarch64
, but when running 32-bit OS on this platform, pip and other package managers do not recognise this as a compatible 'tag' for installation files, so you have to substitute armv7l
:
uname -a
Linux raspberrypi 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr 3 17:24:16 BST 2023 aarch64 GNU/Linux
python3 -m pip debug --verbose
...
Compatible tags: 369
...
cp39-cp39-linux_armv7l
cp39-abi3-manylinux_2_31_armv7l
cp39-abi3-manylinux_2_30_armv7l
...
Again, for those who would prefer to avoid the palaver of installing Rust and all its dependencies, here's a zipped .whl
file for cryptography 41.0.3
for the RPI4 platform, to use at your own risk (once again, check the hash matches once you've unzipped and copied this to your RPI):
cryptography-41.0.3-cp39-cp39-linux_armv7l.whl.zip
shasum -a 256 cryptography-41.0.3-cp39-cp39-linux_armv7l.whl
98fa0f713078d2036a7bb83c9f37bb7c3446ab7f2367d4b2881b259b6baca9fd cryptography-41.0.3-cp39-cp39-linux_armv7l.whl
python3 -m pip install cryptography-41.0.3-cp39-cp39-linux_armv7l.whl
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Processing ./cryptography-41.0.3-cp39-cp39-linux_armv7l.whl
Requirement already satisfied: cffi>=1.12 in /home/steve/.local/lib/python3.9/site-packages (from cryptography==41.0.3) (1.15.1)
Requirement already satisfied: pycparser in /home/steve/.local/lib/python3.9/site-packages (from cffi>=1.12->cryptography==41.0.3) (2.21)
Installing collected packages: cryptography
Successfully installed cryptography-41.0.3
Oh, and thanks for the donation - very much appreciated 👍
@acbtones
I've updated the installation documentation in PyGPSClient and pyspartn.
Are you happy to close this issue as resolved now?
Yes, all good and once again thanks for your help.
On Mon, 7 Aug 2023, 19:21 SEMU Admin, @.***> wrote:
@acbtones https://github.com/acbtones
I've updated the installation documentation in PyGPSClient and pyspartn.
Are you happy to close this issue as resolved now?
— Reply to this email directly, view it on GitHub https://github.com/semuconsulting/PyGPSClient/issues/84#issuecomment-1667504887, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANKPBXN7Y4VAZ7OTRBQSZQLXUCXRPANCNFSM6AAAAAA3DSNJPA . You are receiving this because you were mentioned.Message ID: @.***>
Discussed in https://github.com/semuconsulting/PyGPSClient/discussions/83