Following prerequisites Step #9.4: "Building wheel for hidapi (pyproject.toml) did not run successfu

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Following prerequisites Step #9.4: "Building wheel for hidapi (pyproject.toml) did not run successfu

Jump to solution
7,965 Views
Nic_Roozeboom
NXP Employee
NXP Employee

Hi, step 9.4 of the prerequisites, "Install SPSDK from Github into your Python virtual environment" did not complete entirely successfully. Error report below (the rest completed successfully).

Subsequently visiting the indicated resource, "", does not lead to an installer/updater that resolves the problem.

Is this error relevant, or can be ignored?

If relevant, can you recommend the proper steps / resources to resolve?

Kind regards,

Nic

======

Building wheel for hidapi (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for hidapi (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [5 lines of output]
      running bdist_wheel
      running build
      running build_ext
      building 'hid' extension
      error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for hidapi
  Building wheel for intervaltree (pyproject.toml) ... done
  Created wheel for intervaltree: filename=intervaltree-3.1.0-py2.py3-none-any.whl size=26129 sha256=03e2d1cf4516f09c68b965fd26a76bfa0ca8450cce467b67759ac55efb1e4a20
  Stored in directory: c:\users\usb01768\appdata\local\pip\cache\wheels\a7\d2\99\50f53015b573c9b65ff643d7f213fc7784dad87976e79cf02c
  Building wheel for libusb-package (pyproject.toml) ... done
  Created wheel for libusb-package: filename=libusb_package-1.0.26.1-cp313-cp313-win_amd64.whl size=11243 sha256=b76bb6e378419ff5acb04eef4a12b9bc989c952160682598940c70cdd84c1e96
  Stored in directory: c:\users\usb01768\appdata\local\pip\cache\wheels\c3\30\76\064835ee8612440a48aa95ca11bf15b48732eb094455d9753b
Successfully built crcmod hexdump intervaltree libusb-package
Failed to build hidapi
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (hidapi)

 

Labels (1)
0 Kudos
1 Solution
7,913 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Nic,

I had the same error during SPSDK installation and I also installed Microsoft Visual C++ manually, then it was solved.

Did you install the C++ x64/x86 build tools and Windows SDK as indicated in this link?

Below is a screenshot from the options I selected in the Visual Studio Build tools installer (Windows 10 SDK in my case):

Jorge_Gonzalez_0-1729114167754.png

Regards!
Jorge Gonzalez

View solution in original post

0 Kudos
11 Replies
5,481 Views
akshatha12
Contributor I

HI,

i am trying to install spsdk using termux in android device.

I need to do following , but i am getting error in pip install spsdk. 

python3 -m venv venv
source venv/bin/activate
python -m pip install --upgrade pip
pip install spsdk
spsdk --help

Python 3.11/3.12 i have used 

Below is the error logs 

creating build/lib.linux-aarch64-cpython-312 aarch64-linux-android-clang -shared -L/data/data/com.termux/files/usr/lib -Wl,-rpath=/data/data/com.termux/files/usr/lib -Wl,--enable-new-dtags -Wl,--as-needed -Wl,-z,relro,-z,now -L/home/builder/.termux-build/_cache/android-r27c-api-29-v1/sysroot/usr/lib -landroid-posix-semaphore -L/data/data/com.termux/files/usr/lib -Wl,-rpath=/data/data/com.termux/files/usr/lib -Wl,--enable-new-dtags -Wl,--as-needed -Wl,-z,relro,-z,now -L/home/builder/.termux-build/_cache/android-r27c-api-29-v1/sysroot/usr/lib -landroid-posix-semaphore -L/data/data/com.termux/files/usr/lib -I/data/data/com.termux/files/usr/include build/temp.linux-aarch64-cpython-312/data/data/com.termux/files/usr/tmp/pip-install-3hxa6dzn/hidapi_d4d62c469c714bb59c7a3a480390d50d/hidapi/libusb/hid.o build/temp.linux-aarch64-cpython-312/hid.o -L/data/data/com.termux/files/usr/lib -lpython3.12 -o build/lib.linux-aarch64-cpython-312/hid.cpython-312.so -L/data/data/com.termux/files/usr/lib -lusb-1.0 building 'hidraw' extension creating build/temp.linux-aarch64-cpython-312/data/data/com.termux/files/usr/tmp/pip-install-3hxa6dzn/hidapi_d4d62c469c714bb59c7a3a480390d50d/hidapi/linux aarch64-linux-android-clang -I/data/data/com.termux/files/usr/include -fPIC -I/data/data/com.termux/files/usr/tmp/pip-install-3hxa6dzn/hidapi_d4d62c469c714bb59c7a3a480390d50d/hidapi/hidapi -I/data/data/com.termux/files/home/gitclone/spsdk/venv/include -I/data/data/com.termux/files/usr/include/python3.12 -c /data/data/com.termux/files/usr/tmp/pip-install-3hxa6dzn/hidapi_d4d62c469c714bb59c7a3a480390d50d/hidapi/linux/hid.c -o build/temp.linux-aarch64-cpython-312/data/data/com.termux/files/usr/tmp/pip-install-3hxa6dzn/hidapi_d4d62c469c714bb59c7a3a480390d50d/hidapi/linux/hid.o /data/data/com.termux/files/usr/tmp/pip-install-3hxa6dzn/hidapi_d4d62c469c714bb59c7a3a480390d50d/hidapi/linux/hid.c:43:10: fatal error: 'libudev.h' file not found 43 | #include | ^~~~~~~~~~~ 1 error generated. error: command '/data/data/com.termux/files/usr/bin/aarch64-linux-android-clang' failed with exit code 1 [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for hidapi Building wheel for capstone (pyproject.toml) ... done Created wheel for capstone: filename=capstone-4.0.2-py3-none-manylinux1_aarch64.whl size=1947339 sha256=52c4141d7bf6709974e63d0e1ca2ecff326ff11d88c4f5f9a61673ccaa636195 Stored in directory: /data/data/com.termux/files/home/.cache/pip/wheels/2c/47/7d/26ac37a0891d4419d695bfef1373ce2d68050b5cfdcc108dc1 Building wheel for cmsis-pack-manager (pyproject.toml) ... error error: subprocess-exited-with-error × Building wheel for cmsis-pack-manager (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [140 lines of output] Running `maturin pep517 build-wheel -i /data/data/com.termux/files/home/gitclone/spsdk/venv/bin/python --compatibility off` Building a mixed python/rust project Found cffi bindings Using CPython 3.12 at /data/data/com.termux/files/home/gitclone/spsdk/venv/bin/python to generate the cffi bindings Using build options bindings from pyproject.toml Compiling libc v0.2.147 Compiling proc-macro2 v1.0.66 Compiling unicode-ident v1.0.11 Compiling autocfg v1.1.0 Compiling cfg-if v1.0.0 Compiling memchr v2.5.0 Compiling pin-project-lite v0.2.10 Compiling once_cell v1.18.0 Compiling futures-core v0.3.28 Compiling futures-task v0.3.28 Compiling bytes v1.4.0 Compiling futures-channel v0.3.28 Compiling futures-sink v0.3.28 Compiling itoa v1.0.9 Compiling futures-util v0.3.28 Compiling slab v0.4.8 Compiling tokio v1.29.1 Compiling quote v1.0.32 Compiling num_cpus v1.16.0 Compiling syn v2.0.28 Compiling mio v0.8.8 Compiling cc v1.0.81 Compiling socket2 v0.4.9 Compiling futures-io v0.3.28 Compiling pin-utils v0.1.0 Compiling tracing-core v0.1.31 Compiling tinyvec_macros v0.1.1 Compiling untrusted v0.7.1 Compiling tinyvec v1.6.0 Compiling spin v0.5.2 Compiling getrandom v0.2.10 Compiling indexmap v1.9.3 Compiling percent-encoding v2.3.0 Compiling unicode-bidi v0.3.13 Compiling syn v1.0.109 Compiling unicode-normalization v0.1.22 Compiling fnv v1.0.7 Compiling http v0.2.9 Compiling form_urlencoded v1.2.0 Compiling rand_core v0.6.4 Compiling ring v0.16.20 Compiling lock_api v0.4.10 Compiling parking_lot_core v0.9.8 Compiling rustls v0.21.6 Compiling ppv-lite86 v0.2.17 Compiling hashbrown v0.12.3 Compiling httparse v1.8.0 Compiling async-trait v0.1.72 Compiling thiserror v1.0.44 Compiling smallvec v1.11.0 Compiling serde v1.0.180 Compiling log v0.4.19 Compiling rand_chacha v0.3.1 Compiling idna v0.4.0 Compiling heck v0.4.1 Compiling match_cfg v0.1.0 Compiling matches v0.1.10 Compiling try-lock v0.2.4 Compiling scopeguard v1.2.0 Compiling want v0.3.1 Compiling idna v0.2.3 Compiling hostname v0.3.1 Compiling url v2.4.0 Compiling rand v0.8.5 Compiling http-body v0.4.5 Compiling futures-macro v0.3.28 Compiling tokio-macros v2.1.0 Compiling tracing-attributes v0.1.26 Compiling thiserror-impl v1.0.44 Compiling serde_derive v1.0.180 Compiling enum-as-inner v0.5.1 Compiling sct v0.7.0 Compiling rustls-webpki v0.101.4 Compiling backtrace v0.3.68 Compiling tracing v0.1.37 Compiling httpdate v1.0.2 Compiling base64 v0.21.2 Compiling data-encoding v2.4.0 Compiling quick-error v1.2.3 Compiling ryu v1.0.15 Compiling tower-service v0.3.2 Compiling lazy_static v1.4.0 Compiling linked-hash-map v0.5.6 Compiling adler v1.0.2 Compiling gimli v0.27.3 Compiling ipnet v2.8.0 Compiling tokio-util v0.7.8 Compiling trust-dns-proto v0.22.0 Compiling h2 v0.3.20 Compiling addr2line v0.20.0 Compiling tokio-rustls v0.24.1 Compiling lru-cache v0.1.2 Compiling miniz_oxide v0.7.1 Compiling resolv-conf v0.7.0 Compiling rustls-pemfile v1.0.3 Compiling parking_lot v0.12.1 Compiling object v0.31.1 Compiling anyhow v1.0.72 Compiling hyper v0.14.27 Compiling rustc-demangle v0.1.23 Compiling serde_json v1.0.104 Compiling time-core v0.1.0 Compiling openssl-probe v0.1.5 Compiling time-macros v0.2.8 Compiling rustls-native-certs v0.6.3 Compiling hyper-rustls v0.24.1 Compiling trust-dns-resolver v0.22.0 Compiling serde_urlencoded v0.7.1 Compiling futures-executor v0.3.28 Compiling quick-xml v0.17.2 Compiling encoding_rs v0.8.32 Compiling mime v0.3.17 Compiling reqwest v0.11.18 Compiling time v0.3.20 Compiling minidom v0.12.0 error: could not compile `time` (lib) due to 1 previous error warning: build failed, waiting for other jobs to finish... maturin failed Caused by: Failed to build a native library through cargo Caused by: Cargo build finished with "exit status: 101": `"cargo" "rustc" "--release" "--manifest-path" "/data/data/com.termux/files/usr/tmp/pip-install-3hxa6dzn/cmsis-pack-manager_40538cbbd5e3469d9fb375b4b0483f78/Cargo.toml" "--message-format" "json" "--lib"` error[E0282]: type annotations needed for `Box<_>` --> /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/time-0.3.20/src/format_description/parse/mod.rs:83:9                                       |                                                        83 |     let items = format_items                              |         ^^^^^                                          ...                                                         86 |     Ok(items.into())                                      |              ---- type must be known at this point                                                                    |                                                           = note: this is an inference error on crate `time` caused by an API change in Rust 1.80.0; update `time` to version `>=0.3.35` by calling `cargo update`                                                                                                                                                 For more information about this error, try `rustc --explain E0282`.                                                                                                                 Error: command ['maturin', 'pep517', 'build-wheel', '-i', '/data/data/com.termux/files/home/gitclone/spsdk/venv/bin/python', '--compatibility', 'off'] returned non-zero exit status 1                                                          [end of output]                                                                                                     note: This error originates from a subprocess, and is likely not a problem with pip.                                    ERROR: Failed building wheel for cmsis-pack-manager       Successfully built capstone                                 Failed to build hidapi cmsis-pack-manager                   ERROR: Failed to build installable wheels for some pyproject.toml based projects (hidapi, cmsis-pack-manager)           ((venv) ) ~/gitclone/spsdk $

0 Kudos
5,460 Views
Daniel_Martinez
NXP Employee
NXP Employee

Hi, 

I am not really familiar with Termux, I know that SPSDK is supported on Ubuntu 22.04.1 LTS, I am not sure if this is compatible with the linux running on Termux.

Do you know the OS version running on Termux?

Regards

Daniel Martinez

0 Kudos
5,435 Views
akshatha12
Contributor I

(venv3.8) ~/gitclone/spsdk $ (venv3.8) ~/gitclone/spsdk $ (venv3.8) ~/gitclone/spsdk $ termux-info Termux Variables: TERMUX_EXEC__PROC_SELF_EXE=/data/data/com.termux/files/usr/bin/termux-info TERMUX_VERSION=googleplay.2025.01.18 TERMUX__USER_ID=0 Packages CPU architecture: aarch64 Subscribed repositories: URIs: https://root-packages.termux.net/ URIs: https://termux.net URIs: https://tur.kcubeterm.com URIs: https://x11-packages.termux.net/ Updatable packages: clang/stable 20.1.6 aarch64 [upgradable from: 20.1.3-1] command-not-found/stable 2.4.0-78 aarch64 [upgradable from: 2.4.0-74] curl/stable 8.14.1 aarch64 [upgradable from: 8.13.0] glib/stable 2.84.2 aarch64 [upgradable from: 2.84.1-3] libarchive/stable 3.8.1 aarch64 [upgradable from: 3.7.9-1] libcompiler-rt/stable 20.1.6 aarch64 [upgradable from: 20.1.3-1] libcurl/stable 8.14.1 aarch64 [upgradable from: 8.13.0] libdevmapper/root 2.03.32 aarch64 [upgradable from: 2.03.31]libgcrypt/stable 1.11.1 aarch64 [upgradable from: 1.11.0] libidn2/stable 2.3.8 aarch64 [upgradable from: 2.3.7] libllvm/stable 20.1.6 aarch64 [upgradable from: 20.1.3-1] libnghttp3/stable 1.10.1 aarch64 [upgradable from: 1.9.0] libsqlite/stable 3.49.2 aarch64 [upgradable from: 3.49.1-2] libunbound/stable 1.23.0-1 aarch64 [upgradable from: 1.23.0]libusb/stable 1.0.29 aarch64 [upgradable from: 1.0.28] libxml2/stable 2.14.3 aarch64 [upgradable from: 2.14.2-1] lld/stable 20.1.6 aarch64 [upgradable from: 20.1.3-1] llvm/stable 20.1.6 aarch64 [upgradable from: 20.1.3-1] mesa-vulkan-icd-swrast/stable 25.1.2 aarch64 [upgradable from: 25.0.5] mesa/stable 25.1.2 aarch64 [upgradable from: 25.0.5] openssh-sftp-server/stable 10.0p2-7 aarch64 [upgradable from: 10.0p2-5] openssh/stable 10.0p2-7 aarch64 [upgradable from: 10.0p2-5] rhash/stable 1.4.6 aarch64 [upgradable from: 1.4.5] runc/root 1.3.0 aarch64 [upgradable from: 1.2.6] rust-std-aarch64-linux-android/stable 1.87.0-1 all [upgradable from: 1.86.0] rust/stable 1.87.0-1 aarch64 [upgradable from: 1.86.0] vulkan-loader-generic/stable 1.4.317 aarch64 [upgradable from: 1.4.313] termux-tools version: 3.0.8 Android version:
15 Kernel build information: Linux localhost 5.4.274-qgki-g4670d6bdb795 #1 SMP PREEMPT Wed Apr 9 21:52:48 CST 2025 aarch64 Android Device manufacturer: Nothing Device model: A063 LD Variables: LD_LIBRARY_PATH= LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so (venv3.8) ~/gitclone/spsdk $ (venv3.8) ~/gitclone/spsdk $ (venv3.8) ~/gitclone/spsdk $ getprop ro.build.version.release 15 (venv3.8) ~/gitclone/spsdk $ (venv3.8) ~/gitclone/spsdk $ (venv3.8) ~/gitclone/spsdk $ getprop ro.build.version.release 15 (venv3.8) ~/gitclone/spsdk $ (venv3.8) ~/gitclone/spsdk $ (venv3.8) ~/gitclone/spsdk $ uname -a Linux localhost 5.4.274-qgki-g4670d6bdb795 #1 SMP PREEMPT Wed Apr 9 21:52:48 CST 2025 aarch64 Android (venv3.8) ~/gitclone/spsdk $

0 Kudos
5,407 Views
akshatha12
Contributor I

Termux environment is Android 15, with linux kernal version 5.4.274-qgki for aarch64 architecture.

 

(venv3.8) ~/gitclone/spsdk $ termux-info

Termux Variables: TERMUX_EXEC__PROC_SELF_EXE=/data/data/com.termux/files/usr/bin/termux-info

TERMUX_VERSION=googleplay.2025.01.18

TERMUX__USER_ID=0

Packages CPU architecture: aarch64

Subscribed repositories: URIs: https://root-packages.termux.net/ URIs: https://termux.net URIs: https://tur.kcubeterm.com URIs: https://x11-packages.termux.net/

Updatable packages:

clang/stable 20.1.6 aarch64 [upgradable from: 20.1.3-1] command-not-found/stable 2.4.0-78 aarch64 [upgradable from: 2.4.0-74]

curl/stable 8.14.1 aarch64 [upgradable from: 8.13.0]

glib/stable 2.84.2 aarch64 [upgradable from: 2.84.1-3]

libarchive/stable 3.8.1 aarch64 [upgradable from: 3.7.9-1]

libcompiler-rt/stable 20.1.6 aarch64 [upgradable from: 20.1.3-1]

libcurl/stable 8.14.1 aarch64 [upgradable from: 8.13.0]

libdevmapper/root 2.03.32 aarch64 [upgradable from: 2.03.31]

libgcrypt/stable 1.11.1 aarch64 [upgradable from: 1.11.0]

libidn2/stable 2.3.8 aarch64 [upgradable from: 2.3.7]

libllvm/stable 20.1.6 aarch64 [upgradable from: 20.1.3-1]

libnghttp3/stable 1.10.1 aarch64 [upgradable from: 1.9.0]

libsqlite/stable 3.49.2 aarch64 [upgradable from: 3.49.1-2]

libunbound/stable 1.23.0-1 aarch64 [upgradable from: 1.23.0]

libusb/stable 1.0.29 aarch64 [upgradable from: 1.0.28]

libxml2/stable 2.14.3 aarch64 [upgradable from: 2.14.2-1]

lld/stable 20.1.6 aarch64 [upgradable from: 20.1.3-1]

llvm/stable 20.1.6 aarch64 [upgradable from: 20.1.3-1]

mesa-vulkan-icd-swrast/stable 25.1.2 aarch64 [upgradable from: 25.0.5]

mesa/stable 25.1.2 aarch64 [upgradable from: 25.0.5]

openssh-sftp-server/stable 10.0p2-7 aarch64 [upgradable from: 10.0p2-5]

openssh/stable 10.0p2-7 aarch64 [upgradable from: 10.0p2-5]

rhash/stable 1.4.6 aarch64 [upgradable from: 1.4.5]

runc/root 1.3.0 aarch64 [upgradable from: 1.2.6]

rust-std-aarch64-linux-android/stable 1.87.0-1 all [upgradable from: 1.86.0]

rust/stable 1.87.0-1 aarch64 [upgradable from: 1.86.0]

vulkan-loader-generic/stable 1.4.317 aarch64 [upgradable from: 1.4.313]

termux-tools version: 3.0.8 Android version:
15 Kernel build information: Linux localhost 5.4.274-qgki-g4670d6bdb795 #1 SMP PREEMPT Wed Apr 9 21:52:48 CST 2025 aarch64 Android Device manufacturer: Nothing Device model: A063 LD Variables: LD_LIBRARY_PATH= LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so

(venv3.8) ~/gitclone/spsdk $ getprop ro.build.version.release

15

(venv3.8) ~/gitclone/spsdk $ getprop ro.build.version.release

15

(venv3.8) ~/gitclone/spsdk $ uname -a

Linux localhost 5.4.274-qgki-g4670d6bdb795 #1 SMP PREEMPT Wed Apr 9 21:52:48 CST 2025 aarch64 Android

(venv3.8) ~/gitclone/spsdk $

 

 

0 Kudos
7,934 Views
Daniel_Martinez
NXP Employee
NXP Employee
Seems like the problem is because the system did not find Microsoft Visual C++ 14.0, could you please try to use the next command:
pip install --upgrade setuptools
Then try again, let's see if this solves the problem, before to install Microsoft Visual C++ 14.0 manually
7,893 Views
Nic_Roozeboom
NXP Employee
NXP Employee

I manually installed Microsoft Visual C++, rebooted my machine, re-ran the script "pip install -U spsdk" but it still terminates in the same error.

Then, re-ran "pip install --upgrade setuptools" and did the install again, same result.

(GetSpsdk) C:\Users\usb01768\GetSpsdk\Scripts>pip install --upgrade setuptools
Requirement already satisfied: setuptools in c:\users\usb01768\getspsdk\lib\site-packages (75.2.0)

I verified that I have Microsoft Visual C++ >v14.0 installed:

Nic_Roozeboom_0-1729112102066.png

This is getting very frustrating.

Do you have any other ideas as to what might be the cause, and solution?

I also feel like there should be a check / update step in the Prerequisites document to prevent users from running into this.

Thanks very much!

Kind regards,

Nic

0 Kudos
7,914 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Nic,

I had the same error during SPSDK installation and I also installed Microsoft Visual C++ manually, then it was solved.

Did you install the C++ x64/x86 build tools and Windows SDK as indicated in this link?

Below is a screenshot from the options I selected in the Visual Studio Build tools installer (Windows 10 SDK in my case):

Jorge_Gonzalez_0-1729114167754.png

Regards!
Jorge Gonzalez

0 Kudos
7,869 Views
Nic_Roozeboom
NXP Employee
NXP Employee

Hi Jorge and team,

Just re-installed Visual C++ with the modified attributes, and now pip install -U spsdk completes without error. Thanks for helping resolve this!

I would recommend to add a check early on in the Prerequisites document, to prevent this corner case for some users, as it is time-consuming to correct late in the process (including requiring reboots, which doesn't help efficiency either).

Thanks again!

Kind regards,

Nic

0 Kudos
7,860 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

I am glad it worked Nic!

I agree about your recommendation of the Prerequisites document.

 

Regards!

Jorge Gonzalez

7,882 Views
Nic_Roozeboom
NXP Employee
NXP Employee

Hi Jorge, thanks for your reply! It's encouraging that you found and fixed the issue.

I will modify my Build Tools install as below. This will take some time, so likely will revisit tomorrow.

Kind regards,

Nic

Nic_Roozeboom_0-1729115421041.png

 

7,929 Views
Nic_Roozeboom
NXP Employee
NXP Employee
"pip install --upgrade setuptools" ran successfully but it did not resolve the issue - "pip install --upgrade setuptools" ran with same error. Will proceed to manual-install Microsoft Visual C++ 14.0
0 Kudos