Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while installing on Raspberry Pi Zero 2W #394

Closed
rpatapa opened this issue Sep 10, 2024 · 16 comments
Closed

Error while installing on Raspberry Pi Zero 2W #394

rpatapa opened this issue Sep 10, 2024 · 16 comments

Comments

@rpatapa
Copy link

rpatapa commented Sep 10, 2024

pizero2w:~ $ pip3 install pocketsphinx

Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting pocketsphinx
Using cached pocketsphinx-5.0.3.tar.gz (34.1 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing wheel metadata ... done
Collecting sounddevice
Using cached https://www.piwheels.org/simple/sounddevice/sounddevice-0.5.0-py3-none-any.whl (32 kB)
Collecting CFFI>=1.0
Using cached cffi-1.17.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (447 kB)
Collecting pycparser
Using cached https://www.piwheels.org/simple/pycparser/pycparser-2.22-py3-none-any.whl (117 kB)
Building wheels for collected packages: pocketsphinx
Building wheel for pocketsphinx (PEP 517) ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 /tmp/tmpnx0ody_o_in_process.py build_wheel /tmp/tmpq_ftjmkg
cwd: /tmp/pip-install-62_fbod8/pocketsphinx_d172b17683d240a7ab69c093c14cba55
Complete output (27 lines):
WARNING: Minimum CMake version set as 'CMakeLists.txt' is less than 3.15. This is not supported by scikit-build-core; set manually or increase to avoid this warning.
WARNING: Use build.verbose instead of cmake.verbose for scikit-build-core >= 0.10
2024-09-10 11:33:15,458 - scikit_build_core - INFO - RUN: /tmp/pip-build-env-t1iqgoh3/normal/lib/python3.9/site-packages/cmake/data/bin/cmake -E capabilities
2024-09-10 11:33:15,487 - scikit_build_core - INFO - CMake version: 3.30.3
*** scikit-build-core 0.10.5 using CMake 3.30.3 (wheel)
2024-09-10 11:33:15,526 - scikit_build_core - INFO - Build directory: /tmp/tmpe44f9fot/build
*** Configuring CMake...
2024-09-10 11:33:15,669 - scikit_build_core - INFO - RUN: /tmp/pip-build-env-t1iqgoh3/normal/lib/python3.9/site-packages/ninja/data/bin/ninja --version
2024-09-10 11:33:15,707 - scikit_build_core - INFO - Ninja version: 1.11.1
Traceback (most recent call last):
File "/tmp/tmpnx0ody_o_in_process.py", line 280, in
main()
File "/tmp/tmpnx0ody_o_in_process.py", line 263, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/tmp/tmpnx0ody_o_in_process.py", line 204, in build_wheel
return _build_backend().build_wheel(wheel_directory, config_settings,
File "/tmp/pip-build-env-t1iqgoh3/overlay/lib/python3.9/site-packages/scikit_build_core/build/init.py", line 31, in build_wheel
return _build_wheel_impl(
File "/tmp/pip-build-env-t1iqgoh3/overlay/lib/python3.9/site-packages/scikit_build_core/build/wheel.py", line 175, in _build_wheel_impl
return _build_wheel_impl_impl(
File "/tmp/pip-build-env-t1iqgoh3/overlay/lib/python3.9/site-packages/scikit_build_core/build/wheel.py", line 402, in _build_wheel_impl_impl
builder.configure(
File "/tmp/pip-build-env-t1iqgoh3/overlay/lib/python3.9/site-packages/scikit_build_core/builder/builder.py", line 189, in configure
numpy_include_dir = get_numpy_include_dir()
File "/tmp/pip-build-env-t1iqgoh3/overlay/lib/python3.9/site-packages/scikit_build_core/builder/sysconfig.py", line 197, in get_numpy_include_dir
return Path(np.get_include())
AttributeError: module 'numpy' has no attribute 'get_include'


ERROR: Failed building wheel for pocketsphinx
Failed to build pocketsphinx
ERROR: Could not build wheels for pocketsphinx which use PEP 517 and cannot be installed directly

@dhdaines
Copy link
Contributor

Hi, thanks for the report - do you think I would be able to reproduce this problem on a Pi 5?

It seems like it could be a bug in scikit-build-core, or possibly a version of numpy that is out of date.

@rpatapa
Copy link
Author

rpatapa commented Sep 10, 2024

Hi,

Sorry I did not explicitly mention that I was using Pi Zero 2W. I don't have a Pi 5.
I upgraded numpy with pip3 install --upgrade --force-reinstall numpy
But the error while installing pocketsphinx is same.
Can we install pocketsphinx on Pi Zero 2W?

pizero:~ $ pip3 install --upgrade --force-reinstall numpy
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting numpy
Using cached numpy-2.0.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (13.9 MB)
Installing collected packages: numpy
Attempting uninstall: numpy
Found existing installation: numpy 1.22.0
Uninstalling numpy-1.22.0:
Successfully uninstalled numpy-1.22.0
WARNING: The scripts f2py and numpy-config are installed in '/home/aneka/.local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
efficientword-net 1.0.2 requires numpy==1.22.0, but you have numpy 2.0.2 which is incompatible.
Successfully installed numpy-2.0.2
pizero:~ $ pip3 install --upgrade pocketsphinx
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: pocketsphinx in /usr/lib/python3/dist-packages (0.1.15)
Collecting pocketsphinx
Using cached pocketsphinx-5.0.3.tar.gz (34.1 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing wheel metadata ... done
Requirement already satisfied: sounddevice in ./.local/lib/python3.9/site-packages (from pocketsphinx) (0.5.0)
Requirement already satisfied: CFFI>=1.0 in ./.local/lib/python3.9/site-packages (from sounddevice->pocketsphinx) (1.17.1)
Requirement already satisfied: pycparser in ./.local/lib/python3.9/site-packages (from CFFI>=1.0->sounddevice->pocketsphinx) (2.22)
Building wheels for collected packages: pocketsphinx
Building wheel for pocketsphinx (PEP 517) ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 /tmp/tmp0u3bkb1q_in_process.py build_wheel /tmp/tmpvbe51qey
cwd: /tmp/pip-install-z_cornju/pocketsphinx_cfc13a925ca4445185c02544f8103313
Complete output (27 lines):
WARNING: Minimum CMake version set as 'CMakeLists.txt' is less than 3.15. This is not supported by scikit-build-core; set manually or increase to avoid this warning.
WARNING: Use build.verbose instead of cmake.verbose for scikit-build-core >= 0.10
2024-09-10 18:47:46,880 - scikit_build_core - INFO - RUN: /tmp/pip-build-env-yfaid953/normal/lib/python3.9/site-packages/cmake/data/bin/cmake -E capabilities
2024-09-10 18:47:46,909 - scikit_build_core - INFO - CMake version: 3.30.3
*** scikit-build-core 0.10.5 using CMake 3.30.3 (wheel)
2024-09-10 18:47:46,948 - scikit_build_core - INFO - Build directory: /tmp/tmp8tpfkh3u/build
*** Configuring CMake...
2024-09-10 18:47:47,741 - scikit_build_core - INFO - RUN: /tmp/pip-build-env-yfaid953/normal/lib/python3.9/site-packages/ninja/data/bin/ninja --version
2024-09-10 18:47:47,762 - scikit_build_core - INFO - Ninja version: 1.11.1
Traceback (most recent call last):
File "/tmp/tmp0u3bkb1q_in_process.py", line 280, in
main()
File "/tmp/tmp0u3bkb1q_in_process.py", line 263, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/tmp/tmp0u3bkb1q_in_process.py", line 204, in build_wheel
return _build_backend().build_wheel(wheel_directory, config_settings,
File "/tmp/pip-build-env-yfaid953/overlay/lib/python3.9/site-packages/scikit_build_core/build/init.py", line 31, in build_wheel
return _build_wheel_impl(
File "/tmp/pip-build-env-yfaid953/overlay/lib/python3.9/site-packages/scikit_build_core/build/wheel.py", line 175, in _build_wheel_impl
return _build_wheel_impl_impl(
File "/tmp/pip-build-env-yfaid953/overlay/lib/python3.9/site-packages/scikit_build_core/build/wheel.py", line 402, in _build_wheel_impl_impl
builder.configure(
File "/tmp/pip-build-env-yfaid953/overlay/lib/python3.9/site-packages/scikit_build_core/builder/builder.py", line 189, in configure
numpy_include_dir = get_numpy_include_dir()
File "/tmp/pip-build-env-yfaid953/overlay/lib/python3.9/site-packages/scikit_build_core/builder/sysconfig.py", line 197, in get_numpy_include_dir
return Path(np.get_include())
AttributeError: module 'numpy' has no attribute 'get_include'


ERROR: Failed building wheel for pocketsphinx
Failed to build pocketsphinx
ERROR: Could not build wheels for pocketsphinx which use PEP 517 and cannot be installed directly

@dhdaines
Copy link
Contributor

Right, I have a Pi 5, that's why I'm asking :) if it's the same OS then it should be the same problem. It looks like it is: https://www.raspberrypi.com/software/operating-systems/

Do you know what version of Raspberry Pi OS you are using?

@dhdaines
Copy link
Contributor

I'll try testing this when I get a moment (possibly later today).

@rpatapa
Copy link
Author

rpatapa commented Sep 10, 2024

Thanks for looking into this..

I was using Legacy 64bit Lite Debian Bullseye

@rpatapa
Copy link
Author

rpatapa commented Sep 11, 2024

Further to force upgrading numpy, I updated CMake also to 3.30.0.

The error remains:

pizero:~ $ pip3 install pocketsphinx

_Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting pocketsphinx
Using cached pocketsphinx-5.0.3.tar.gz (34.1 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing wheel metadata ... done
Requirement already satisfied: sounddevice in ./.local/lib/python3.9/site-packages (from pocketsphinx) (0.5.0)
Requirement already satisfied: CFFI>=1.0 in ./.local/lib/python3.9/site-packages (from sounddevice->pocketsphinx) (1.17.1)
Requirement already satisfied: pycparser in ./.local/lib/python3.9/site-packages (from CFFI>=1.0->sounddevice->pocketsphinx) (2.22)
Building wheels for collected packages: pocketsphinx
Building wheel for pocketsphinx (PEP 517) ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 /tmp/tmpusg8x6_r_in_process.py build_wheel /tmp/tmp53ghoc8o
cwd: /tmp/pip-install-n80lblhc/pocketsphinx_46a11b337e4f42868dee4562b9a1be9e
Complete output (27 lines):
WARNING: Minimum CMake version set as 'CMakeLists.txt' is less than 3.15. This is not supported by scikit-build-core; set manually or increase to avoid this warning.
WARNING: Use build.verbose instead of cmake.verbose for scikit-build-core >= 0.10
2024-09-11 22:59:51,409 - scikit_build_core - INFO - RUN: /usr/local/bin/cmake -E capabilities
2024-09-11 22:59:51,446 - scikit_build_core - INFO - CMake version: 3.30.0
*** scikit-build-core 0.10.6 using CMake 3.30.0 (wheel)
2024-09-11 22:59:51,481 - scikit_build_core - INFO - Build directory: /tmp/tmp0d3i4tvi/build
*** Configuring CMake...
2024-09-11 22:59:51,605 - scikit_build_core - INFO - RUN: /tmp/pip-build-env-zlca410t/normal/lib/python3.9/site-packages/ninja/data/bin/ninja --version
2024-09-11 22:59:51,625 - scikit_build_core - INFO - Ninja version: 1.11.1
Traceback (most recent call last):
File "/tmp/tmpusg8x6_r_in_process.py", line 280, in
main()
File "/tmp/tmpusg8x6_r_in_process.py", line 263, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/tmp/tmpusg8x6_r_in_process.py", line 204, in build_wheel
return _build_backend().build_wheel(wheel_directory, config_settings,
File "/tmp/pip-build-env-zlca410t/overlay/lib/python3.9/site-packages/scikit_build_core/build/init.py", line 31, in build_wheel
return _build_wheel_impl(
File "/tmp/pip-build-env-zlca410t/overlay/lib/python3.9/site-packages/scikit_build_core/build/wheel.py", line 175, in _build_wheel_impl
return _build_wheel_impl_impl(
File "/tmp/pip-build-env-zlca410t/overlay/lib/python3.9/site-packages/scikit_build_core/build/wheel.py", line 402, in build_wheel_impl_impl
builder.configure(
File "/tmp/pip-build-env-zlca410t/overlay/lib/python3.9/site-packages/scikit_build_core/builder/builder.py", line 207, in configure
numpy_include_dir = get_numpy_include_dir()
File "/tmp/pip-build-env-zlca410t/overlay/lib/python3.9/site-packages/scikit_build_core/builder/sysconfig.py", line 197, in get_numpy_include_dir
return Path(np.get_include())
AttributeError: module 'numpy' has no attribute 'get_include'
----------------------------------------

ERROR: Failed building wheel for pocketsphinx
Failed to build pocketsphinx
ERROR: Could not build wheels for pocketsphinx which use PEP 517 and cannot be installed directly

@dhdaines
Copy link
Contributor

Hm. okay. If you run pip freeze | grep numpy what version does it tell you?

@rpatapa
Copy link
Author

rpatapa commented Sep 12, 2024

pizero:~ $ pip freeze | grep numpy
numpy==2.0.2
pizero:~ $

@dhdaines
Copy link
Contributor

Hm, unfortunately I can't reproduce this on my Pi5. This is certainly due to having a more recent version of, well, everything (I have the latest OS, bookworm-based). Here are what I think are the relevant versions:

  • Python 3.11.2
  • scikit-build-core 0.10.6

Two things:

  1. Can you install in a virtualenv? That way we know what the dependencies are...
  2. Are you able to update to the most recent Raspberry Pi OS?

Alternately I can try flashing the legacy OS to see if I can reproduce the problem that way.

@dhdaines
Copy link
Contributor

Nope, legacy OS is not compatible with Raspberry Pi 5. Sorry...

@rpatapa
Copy link
Author

rpatapa commented Sep 13, 2024

BTW, is pocketsphinx 5.0.3 compatible with Python 3.9.x?

@dhdaines
Copy link
Contributor

dhdaines commented Sep 13, 2024

Yes, at least on x86-64 it builds and works fine. As a last thing to try, you could perhaps try building, in a virtualenv, without build isolation:

python -m venv .venv
source .venv/bin/activate
pip install numpy cython scikit-build-core cmake ninja
pip install -v --no-build-isolation pocketsphinx

What happens when you do that?

@rpatapa
Copy link
Author

rpatapa commented Sep 13, 2024

In an environment, I was able to install.
Simple pip install pocketsphix also could install successfully!

@dhdaines
Copy link
Contributor

Great! Something is just not quite right with the system install of Python on the legacy PiOS I guess ... it's nearly always a better idea to install in a virtualenv, and now I have another reason why :) Thanks for your patience!

@rpatapa
Copy link
Author

rpatapa commented Sep 16, 2024

Much appreciate your support! Thank you!

@dhdaines
Copy link
Contributor

I'll close the issue but it will remain visible/searchable if anyone else has the same issue, glad there's a workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants