impossible to install cryptography-dependent esptool module

Help for Current Versions of MX
When asking for help, use Quick System Info from MX Tools. It will be properly formatted using the following steps.
1. Click on Quick System Info in MX Tools
2. Right click in your post and paste.
Message
Author
User avatar
koko
Posts: 2
Joined: Fri Nov 17, 2023 7:49 pm

impossible to install cryptography-dependent esptool module

#1 Post by koko »

I am following the MicroPython "Getting started" installation guide under
https://docs.micropython.org/en/latest/ ... intro.html
and reached the line
pip install esptool
under paragraph
1.4. Deploying the firmware
which I don't manage to cope with for several hours now :-(
Trying to install the
esptool
module directly, generates the warning:
error: externally-managed-environment
× This environment is externally managed
I created a virtual environment in my project folder via
python3 -m venv .venv
, and then tried
pip install esptool
, but the module installation fails with the error:
...
Building wheel for cryptography (pyproject.toml) ... error
error: subprocess-exited-with-error

× Building wheel for cryptography (pyproject.toml) did not run successfully.
│ exit code: 1
...
error: can't find Rust compiler
...

To update pip, run:

pip install --upgrade pip

and then retry package installation.
...
I tried without success the following suggestions from Internet:
python -m pip install --upgrade pip
python -m pip install esptool
--> SAME PROBLEM

sudo apt-get install build-essential libssl-dev libffi-dev python3-dev
https://stackoverflow.com/questions/220 ... d-setup-py
--> SAME PROBLEM

https://stackoverflow.com/questions/661 ... uild-error

pip3 install setuptools_rust
--> SAME PROBLEM

export CRYPTOGRAPHY_DONT_BUILD_RUST=1
--> SAME PROBLEM

export RUSTFLAGS="-C lto=n"
--> SAME PROBLEM

pip install pyopenssl ndg-httpsclient pyasn1
--> SAME PROBLEM

sudo apt-get install libssl1.0
--> SAME PROBLEM

sudo apt install python3-cryptography
--> SAME PROBLEM

Editing pyvenv.cfg by adding in my .env:
CRYPTOGRAPHY_DONT_BUILD_RUST=1
--> SAME PROBLEM

pipx install esptool
--> SAME PROBLEM

pip install esptool==4.5.dev2
--> SAME PROBLEM

python -m pip install --upgrade setuptools
--> SAME PROBLEM
And I have no idea what else I should do. Hence, I wanted to ask if possibly I could get some help with regard to installing the cryptography module.
Thanks in advance
----------------------------------------------------------------------------------------------------------------------------------
System:
Kernel: 6.1.0-13-686-pae [6.1.55-1] arch: i686 bits: 32 compiler: gcc v: 12.2.0
parameters: BOOT_IMAGE=/boot/vmlinuz-6.1.0-13-686-pae root=UUID=<filter> ro quiet
initrd=/antiX/initrd.gz splash
Desktop: Fluxbox v: 1.3.7 info: tint2 vt: 7 dm: LightDM v: 1.26.0 Distro: MX-23.1_fluxbox_386
Libretto October 15 2023 base: Debian GNU/Linux 12 (bookworm)
Machine:
Type: Kvm System: Acer product: Aspire 5920G v: N/A serial: <superuser required>
Chassis: Acer, Inc. type: 1 serial: <superuser required>
Mobo: Acer model: Chapala serial: <superuser required> BIOS: Acer v: 1.3804 date: 11/21/2007
Battery:
ID-1: BAT1 charge: 13.3 Wh (100.0%) condition: 13.3/44.4 Wh (29.9%) volts: 12.1 min: 11.1
model: SANYO Chapala type: Li-ion serial: <filter> status: full
CPU:
Info: model: Intel Core2 Duo T7300 bits: 64 type: MCP arch: Core2 Merom built: 2006-09
process: Intel 65nm family: 6 model-id: 0xF (15) stepping: 0xA (10) microcode: 0x95
Topology: cpus: 1x cores: 2 smt: <unsupported> cache: L1: 128 KiB desc: d-2x32 KiB; i-2x32 KiB
L2: 4 MiB desc: 1x4 MiB
Speed (MHz): avg: 1187 high: 1396 min/max: 800/2001 boost: enabled scaling:
driver: acpi-cpufreq governor: ondemand cores: 1: 979 2: 1396 bogomips: 8000
Flags: ht lm nx pae sse sse2 sse3 ssse3 vmx
Vulnerabilities:
Type: gather_data_sampling status: Not affected
Type: itlb_multihit status: KVM: VMX disabled
Type: l1tf mitigation: PTE Inversion; VMX: conditional cache flushes, SMT disabled
Type: mds status: Vulnerable: Clear CPU buffers attempted, no microcode; SMT disabled
Type: meltdown mitigation: PTI
Type: mmio_stale_data status: Unknown: No mitigations
Type: retbleed status: Not affected
Type: spec_rstack_overflow status: Not affected
Type: spec_store_bypass status: Vulnerable
Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer sanitization
Type: spectre_v2 mitigation: Retpolines, STIBP: disabled, RSB filling, PBRSB-eIBRS: Not
affected
Type: srbds status: Not affected
Type: tsx_async_abort status: Not affected
Graphics:
Device-1: NVIDIA G86M [GeForce 8600M GS] vendor: Acer Incorporated ALI Aspire 5920G
driver: nouveau v: kernel non-free: series: 340.xx status: legacy (EOL) last: release: 340.108
kernel: 5.4 xorg: 1.20 arch: Tesla process: 40-80nm built: 2006-13 pcie: gen: 1 speed: 2.5 GT/s
lanes: 16 ports: active: HDMI-A-1,LVDS-1 empty: VGA-1 bus-ID: 01:00.0 chip-ID: 10de:0425
class-ID: 0300 temp: 71.0 C
Device-2: Suyin Acer CrystalEye Webcam type: USB driver: uvcvideo bus-ID: 3-2:2
chip-ID: 064e:a101 class-ID: 0e02 serial: <filter>
Display: x11 server: X.Org v: 1.21.1.7 driver: X: loaded: modesetting unloaded: fbdev,vesa
dri: nouveau gpu: nouveau display-ID: :0 screens: 1
Screen-1: 0 s-res: 1920x1880 s-dpi: 97 s-size: 501x491mm (19.72x19.33") s-diag: 701mm (27.62")
Monitor-1: HDMI-A-1 mapped: HDMI-1 pos: top model: Samsung S27D390 serial: <filter> built: 2014
res: 1920x1080 hz: 60 dpi: 82 gamma: 1.2 size: 598x336mm (23.54x13.23") diag: 686mm (27")
ratio: 16:9 modes: max: 1920x1080 min: 720x400
Monitor-2: LVDS-1 pos: primary,bottom model: Seiko Epson 0x3945 built: 2007 res: 1280x800
hz: 60 dpi: 98 gamma: 1.2 size: 331x207mm (13.03x8.15") diag: 390mm (15.4") ratio: 16:10 modes:
max: 1280x800 min: 640x350
API: OpenGL v: 3.3 Mesa 22.3.6 renderer: NV86 direct-render: Yes
Audio:
Device-1: Intel 82801H HD Audio vendor: Acer Incorporated ALI Aspire 5920G driver: snd_hda_intel
v: kernel bus-ID: 00:1b.0 chip-ID: 8086:284b class-ID: 0403
API: ALSA v: k6.1.0-13-686-pae status: kernel-api tools: alsamixer,amixer
Server-1: PipeWire v: 0.3.65 status: active with: 1: pipewire-pulse status: active
2: wireplumber status: active 3: pipewire-alsa type: plugin 4: pw-jack type: plugin
tools: pactl,pw-cat,pw-cli,wpctl
Network:
Device-1: Intel PRO/Wireless 3945ABG [Golan] Network driver: iwl3945 v: in-tree:s modules: wl
pcie: gen: 1 speed: 2.5 GT/s lanes: 1 bus-ID: 06:00.0 chip-ID: 8086:4222 class-ID: 0280
IF: wlan0 state: up mac: <filter>
Device-2: Broadcom NetLink BCM5787M Gigabit Ethernet PCI Express vendor: Acer Incorporated ALI
Aspire 5920G driver: tg3 v: kernel pcie: gen: 1 speed: 2.5 GT/s lanes: 1 port: N/A
bus-ID: 08:00.0 chip-ID: 14e4:1693 class-ID: 0200
IF: eth0 state: down mac: <filter>
Bluetooth:
Device-1: Cambridge Silicon Radio Bluetooth Dongle (HCI mode) type: USB driver: btusb v: 0.8
bus-ID: 6-1.1:3 chip-ID: 0a12:0001 class-ID: e001
Report: hciconfig ID: hci0 rfk-id: 2 state: up address: <filter> bt-v: 2.1 lmp-v: 4.0
sub-v: 22bb hci-v: 4.0 rev: 22bb
Info: acl-mtu: 310:10 sco-mtu: 64:8 link-policy: rswitch hold sniff park
link-mode: peripheral accept service-classes: rendering, capturing, object transfer, audio,
telephony
Drives:
Local Storage: total: 232.89 GiB used: 6.18 GiB (2.7%)
SMART Message: Unable to run smartctl. Root privileges required.
ID-1: /dev/sda maj-min: 8:0 vendor: Western Digital model: WD2500BEVS-22UST0 size: 232.89 GiB
block-size: physical: 512 B logical: 512 B speed: 1.5 Gb/s type: N/A serial: <filter> rev: 1A01
scheme: MBR
Partition:
ID-1: / raw-size: 58.59 GiB size: 57.37 GiB (97.92%) used: 5.96 GiB (10.4%) fs: ext4
dev: /dev/sda9 maj-min: 8:9
Swap:
Kernel: swappiness: 15 (default 60) cache-pressure: 100 (default)
ID-1: swap-1 type: partition size: 4.88 GiB used: 224.2 MiB (4.5%) priority: -2 dev: /dev/sda8
maj-min: 8:8
Sensors:
System Temperatures: cpu: 67.0 C mobo: N/A gpu: nouveau temp: 71.0 C
Fan Speeds (RPM): N/A
Repos:
Packages: pm: dpkg pkgs: 1813 libs: 882 tools: apt,apt-get,aptitude,nala,synaptic pm: rpm pkgs: 0
No active apt repos in: /etc/apt/sources.list
Active apt repos in: /etc/apt/sources.list.d/debian-stable-updates.list
1: deb http://deb.debian.org/debian bookworm-updates main contrib non-free non-free-firmware
Active apt repos in: /etc/apt/sources.list.d/debian.list
1: deb http://deb.debian.org/debian bookworm main contrib non-free non-free-firmware
2: deb http://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
Active apt repos in: /etc/apt/sources.list.d/mx.list
1: deb http://mirrors.rit.edu/mxlinux/mx-packages/mx/repo/ bookworm main non-free
Info:
Processes: 220 Uptime: 8h 59m wakeups: 3 Memory: 2.95 GiB used: 1.53 GiB (51.6%) Init: SysVinit
v: 3.06 runlevel: 5 default: graphical tool: systemctl Compilers: gcc: 12.2.0 alt: 12
Client: shell wrapper v: 5.2.15-release inxi: 3.3.26
Boot Mode: BIOS (legacy, CSM, MBR)

User avatar
timkb4cq
Developer
Posts: 3626
Joined: Wed Jul 12, 2006 4:05 pm

Re: impossible to install cryptography-dependent esptool module

#2 Post by timkb4cq »

esptool is in the debian buster, bullseye & trixie repos but not in bookworm.
So I rebuilt the bullseye version for MX-23 and have uploaded it to the repository.
Mirrors will take a while to update so you can download the deb here and install it from the file manager.
https://mxrepo.com/mx/repo/pool/main/e/ ... 23_all.deb
HP Pavillion TP01, AMD Ryzen 3 5300G (quad core), Crucial 500GB SSD, Toshiba 6TB 7200rpm
Dell Inspiron 15, AMD Ryzen 7 2700u (quad core). Sabrent 500GB nvme, Seagate 1TB

User avatar
Stevo
Developer
Posts: 14873
Joined: Fri Dec 15, 2006 7:07 pm

Re: impossible to install cryptography-dependent esptool module

#3 Post by Stevo »

I don't use pip, but I remember threads about Debian disabling it for Bookworm, for security.
MXPI = MX Package Installer
QSI = Quick System Info from menu
The MX Test repository is mostly backports; not the same as Debian testing

User avatar
koko
Posts: 2
Joined: Fri Nov 17, 2023 7:49 pm

Re: impossible to install cryptography-dependent esptool module

#4 Post by koko »

Hi, thanks for your feedback and quick replies :-)
I downloaded the .deb package and installed it.
which esptool
/usr/bin/esptool
However, when running the next command from the MicroPython tutorial, i.e.
esptool --port /dev/ttyUSB0 erase_flash
, it fails with
A fatal error occurred: ESP8266 ROM does not support function erase_flash
I assume (not sure as I am not that advanced) that it is because of the older version: when starting the script, it prints
esptool.py v2.8
I managed to get it running by following the instructions how to install a package w/o pip @ this link:
, downloading the archive from
, extracting it, commenting out the line for cryptography in setup.py, i.e.
... # "cryptography>=2.1.4" ...
, and finally install the module via
python setup.py install
Now I have 2 esptools:
which esptool
/usr/bin/esptool
vs.
which esptool.py (run from my virtual environment)
/home/koko/Desktop/ESP8266/Pargavelnik/.venv/bin/esptool.py
The one from the .deb package (esptool.py v2.8 ) is NOT able to flash the chip; the other (esptool.py v4.6.2) copes with the flashing.
However, esptool.py v4.6.2 script starts with some warning, i.e.
/home/koko/Desktop/ESP8266/Pargavelnik/.venv/bin/esptool.py:4: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
__import__('pkg_resources').run_script('esptool==4.6.2', 'esptool.py')
esptool.py v4.6.2
Thus, I did manage to flash the ESP, but I do not know 1) what the lack of the cryptography module, and 2) the deprecation warning could cause in the future :-)

Thanks though for your quick response and useful info (I did not even know what buster, bullseye & trixie stand for) 9_9

Post Reply

Return to “MX Help”