Skip to content

Installing on raspberry pi #830

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

Closed
LovanDog opened this issue Jul 27, 2023 · 23 comments
Closed

Installing on raspberry pi #830

LovanDog opened this issue Jul 27, 2023 · 23 comments
Assignees
Labels
question Further information is requested

Comments

@LovanDog
Copy link

LovanDog commented Jul 27, 2023

 Using cached pydantic_core-2.3.1.tar.gz (313 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... error
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 /tmp/tmpr0ycbswq_in_process.py prepare_metadata_for_build_wheel /tmp/tmphd5imzdu
         cwd: /tmp/pip-install-vxe0hffl/pydantic-core_b3e35453dfe54f86ba9d6c943aad8c6a
    Complete output (6 lines):

    Cargo, the Rust package manager, is not installed or is not on PATH.
    This package requires Rust and Cargo to compile extensions. Install it through
    the system's package manager or via https://rustup.rs/

    Checking for Rust toolchain....
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/0e/a8/2398262d9e54a8d266770433dfd881372083cb31ace3897f304e34e5d476/pydantic_core-2.3.1.tar.gz#sha256=6a72455f9b360f41d5b343efe666a68e2f313a1f1f7c454d96485038afc3fd30 (from https://pypi.org/simple/pydantic-core/) (requires-python:>=3.7). Command errored out with exit status 1: /usr/bin/python3 /tmp/tmpr0ycbswq_in_process.py prepare_metadata_for_build_wheel /tmp/tmphd5imzdu Check the logs for full command output.

im using rpi zero w. what could be the problem? i've downloaded rust and cargo and added them to path

Selected Assignee: @samuelcolvin

@davidhewitt
Copy link
Contributor

What do you get from running rustc --version and cargo --version?

What pip version are you running?

What does running the following Python command on your device give you?

$ python -c 'import sysconfig; print(sysconfig.get_config_var("EXT_SUFFIX"))'
.cpython-311-x86_64-linux-gnu.so

@LovanDog
Copy link
Author

versions:

rustc 1.71.0 (8ede3aae2 2023-07-12)
cargo 1.71.0 (cfd3bbd8f 2023-06-08)
pip 20.3.4 from /usr/lib/python3/dist-packages/pip (python 3.9)

command:

.cpython-311-x86_64-linux-gnu.so
.cpython-39-arm-linux-gnueabihf.so
-bash: .cpython-311-x86_64-linux-gnu.so: command not found

@davidhewitt
Copy link
Contributor

Thanks. Can you also share the output of python -c 'import sysconfig; print(sysconfig.get_platform())' please?

@LovanDog
Copy link
Author

it's linux-armv6l

@davidhewitt
Copy link
Contributor

I can't speak for why your build environment is not set up correctly, given that rustc and cargo run fine. What might be nicer is to upload prebuilt wheels for raspberry pi.

I believe we don't currently build for 32-bit arm. @messense do you know if it's reasonable for maturin-action to support this?

@LovanDog
Copy link
Author

where can i find those prebuilded wheels?

@messense
Copy link
Contributor

do you know if it's reasonable for maturin-action to support this?

armv7l yes and pydantic-core already publishes them to PyPI, but there is no support for armv6l since armv6l doesn't have a manylinux policy.

That said, PyPI actually allows uploading linux_armv6l packages, so it's possible to distribute wheels for armv6l, for example https://github.com/eclipse-zenoh/zenoh-python/pull/68/files.

@dmontagu
Copy link
Collaborator

I'm assuming the path is not set properly for cargo/rustc while pip is trying to build the wheel, might be worth trying to get some insight into why it's not detecting those, since that would presumably resolve the inability to build the wheel.

@messense
Copy link
Contributor

messense commented Aug 1, 2023

It's very unlikely that a raspberry pi zero w (1GHz BCM2835 single-core processor with 512MB RAM) can successfully build pydantic-core.

@davidhewitt
Copy link
Contributor

https://www.piwheels.org/project/pydantic-core/ - maybe we can work with piwheels to get pydantic-core (and ideally other Rust / PyO3 packages building. From a quick scan of the logs it looks like they don't have rust / cargo available as part of their builder.

@davidhewitt
Copy link
Contributor

It looks like piwheels/piwheels#328 may fix this. Perhaps the most productive route is to offer help on that issue.

@lig lig added question Further information is requested and removed unconfirmed labels Aug 7, 2023
@dmontagu dmontagu removed their assignment Aug 14, 2023
@davidhewitt davidhewitt changed the title ERROR: Command errored out with exit status 1: Cannot build from source on raspberry pi Aug 16, 2023
@davidhewitt davidhewitt changed the title Cannot build from source on raspberry pi Installing on raspberry pi Aug 16, 2023
@samuelcolvin
Copy link
Member

Does samuelcolvin/watchfiles#149 help at all?

In particular, what happens if you run the following?

ip install -i https://pypi.org/simple/ 'pydantic>=2'

@messense
Copy link
Contributor

messense commented Sep 5, 2023

That won't help because rpi zero w is linux armv6l, pydantic-core only has pre-built wheels for linux armv7l.

@ctomkow
Copy link

ctomkow commented Nov 12, 2023

Im installing fastAPI on a raspberry pi B+ right now on debian 12. I had to apt install rustc first. It's currently building pydantic_core now. Not sure if it will finish on this 700Mhz cpu. I'll update when I check on it later.

@samuelcolvin
Copy link
Member

Have you tried

pip install -i https://pypi.org/simple/ 'pydantic>=2'

???

@ctomkow
Copy link

ctomkow commented Nov 12, 2023

As @messense said, it has to be built as there is no pre-built wheels for linux armv7l. I gave up on fastAPI because because I couldn't get pydantic-core to build locally. My pi hung on getting the cargo index (a separate but related issue I couldn't get around). Since my home project is simple, I just switched to flask. ¯\(ツ)

@samuelcolvin
Copy link
Member

@ctomkow sorry, you've had a frustrating time.

What I think @messense said was that we don't have pre-build binaries for armv6l, only for armv7l. Search https://pypi.org/project/pydantic-core/#files for armv7l and you'll see multiple files.

What do you get when running uname -a?

@davidhewitt
Copy link
Contributor

@ctomkow it should now be possible to install pydantic-core from piwheels, which does show support for debian bookworm.

https://www.piwheels.org/project/pydantic-core/

@ctomkow
Copy link

ctomkow commented Nov 14, 2023

@samuelcolvin uname -a
Linux pi 6.1.0-11-rpi #1 Debian 6.1.38-4 (2023-08-08) armv6l GNU/Linux

@davidhewitt I ran pip3 install --no-cache-dir -vvv pydantic-core==2.14.1 it spits out

Skipping link: none of the wheel's tags (blahblahblah) are compatible (run pip debug --verbose to show compatible tags)

pip3 debug --verbose

Compatible tags: 39
  cp311-cp311-linux_armv6l
  cp311-abi3-linux_armv6l
  cp311-none-linux_armv6l
  cp310-abi3-linux_armv6l
  cp39-abi3-linux_armv6l
  cp38-abi3-linux_armv6l
  cp37-abi3-linux_armv6l
  cp36-abi3-linux_armv6l
  cp35-abi3-linux_armv6l
  cp34-abi3-linux_armv6l
  cp33-abi3-linux_armv6l
  cp32-abi3-linux_armv6l
  py311-none-linux_armv6l
  py3-none-linux_armv6l
  py310-none-linux_armv6l
  py39-none-linux_armv6l
  py38-none-linux_armv6l
  py37-none-linux_armv6l
  py36-none-linux_armv6l
  py35-none-linux_armv6l
  py34-none-linux_armv6l
  py33-none-linux_armv6l
  py32-none-linux_armv6l
  py31-none-linux_armv6l
  py30-none-linux_armv6l
  cp311-none-any
  py311-none-any
  py3-none-any
  py310-none-any
  py39-none-any
  py38-none-any
  py37-none-any
  py36-none-any
  py35-none-any
  py34-none-any
  py33-none-any
  py32-none-any
  py31-none-any
  py30-none-any

None of these tags match any wheel from https://www.piwheels.org/project/pydantic-core/ for 2.14.1, for example.

@davidhewitt
Copy link
Contributor

Isn't the top tag compatible with https://www.piwheels.org/simple/pydantic-core/pydantic_core-2.14.1-cp311-cp311-linux_armv6l.whl#sha256=3fb9eb0cc519f949c27c6ec49c552bc14e439867038304256a9bf139d76b8659 ?

What happens if you download and try to install that file manually? Can you check if you have the piwheels index configured as per their faq?

@ctomkow
Copy link

ctomkow commented Nov 14, 2023

Ah, you are right. I now have put 2 and 2 together regarding your piwheels comment (I actually didn't know piwheels was an index, I guess I just assumed it was a mirror/explorer of PyPI or something :/ even though your comment was very clear).

I pip3 install --no-cache-dir fastapi and it pulled the necessary wheels from piwheels index.

For future people, just add piwheels index to pip.conf. https://www.piwheels.org/faq.html

[global]
extra-index-url=https://www.piwheels.org/simple

Thanks @davidhewitt and @samuelcolvin for the help!
\(^-^)/

@davidhewitt
Copy link
Contributor

Great! I think I will close this as resolved 👍

@vaibhavpandeyvpz
Copy link

For anyone using Poetry, can add below to your pyproject.toml for installing armv6l wheels:

[[tool.poetry.source]]
name = "piwheels"
url = "https://www.piwheels.org/simple/"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

8 participants