Skip to content

[Python] Can't install on Raspberry Pi (Failed building wheel for pyarrow) #33814

Closed

Description

@vmalisz

Describe the bug, including details regarding any error messages, version, and platform.

I tried to install pyarrow via pip and from the source following those instructions here https://arrow.apache.org/docs/developers/python.html#python-development

both methods showed the same errors. The output of the pip command is attached.
pipout.txt

Same results on Buster and Bullseye, Python 3.7

I also found a very similar issue here and tried to follow the steps with no success #14920

any suggestions for me to try?
thank you!

Component(s)

Python

Activity

  1. changed the title [-]Can't install on Raspberry Pi (Failed building wheel for pyarrow)[/-] [+][Python] Can't install on Raspberry Pi (Failed building wheel for pyarrow)[/+] on Jan 21, 2023
  2. kou commented on Jan 21, 2023

    @kou
    Member

    It seems that you didn't define CMAKE_PREFIX_PATH:

    https://arrow.apache.org/docs/dev/developers/python.html#using-system-and-bundled-dependencies

    export ARROW_HOME=$(pwd)/dist
    export LD_LIBRARY_PATH=$(pwd)/dist/lib:$LD_LIBRARY_PATH
    export CMAKE_PREFIX_PATH=$ARROW_HOME:$CMAKE_PREFIX_PATH
  3. vmalisz commented on Jan 21, 2023

    @vmalisz
    Author

    thank you for your quick answer. I have another error now: No module named 'cmake' (output:
    pyarrow-installout.txt

    It is installed already and I double-checked 'import cmake' in a Python terminal it worked.

    edit: it was the wrong output file

  4. vmalisz commented on Jan 21, 2023

    @vmalisz
    Author

    I realized I didn't have the last version for pip, I just upgraded to pip 22.3.1 but it didn't change the result

  5. westonpace commented on Jan 21, 2023

    @westonpace
    Member

    When you tried import cmake in the terminal were you using this python executable? /home/pi/pyarrow-dev/bin/python3

  6. vmalisz commented on Jan 21, 2023

    @vmalisz
    Author

    'which python3' gives me that path yes
    /home/pi/pyarrow-dev/bin/python3

  7. kou commented on Jan 21, 2023

    @kou
    Member

    What is /home/pi/.local/bin/cmake?

    Could you show file /home/pi/.local/bin/cmake and head /home/pi/.local/bin/cmake?

    How did you install CMake? pip install cmake? ( https://pypi.org/project/cmake/ ?)

  8. vmalisz commented on Jan 21, 2023

    @vmalisz
    Author

    I did install cmake via pip (also tried to uninstall and install again)

    .local/bin because I didn't run the install from the virtualenv this time, not sure why it's .local though, I'd have expected usr/bin but that's probably another story!

    The error is the same anyways; that's why I didn't notice, sorry bout the confusion.
    Here's the output from the same virtual env from before:
    out.txt

    the information requested: (same for /home/pi/pyarrow-dev/bin/cmake)
    $ file /home/pi/.local/bin/cmake
    /home/pi/.local/bin/cmake: Python script, ASCII text executable

    $ head /home/pi/.local/bin/cmake

    #!/usr/bin/python3
    # -*- coding: utf-8 -*-
    import re
    import sys
    from cmake import cmake
    if __name__ == '__main__':
        sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
        sys.exit(cmake())
    
  9. kou commented on Jan 22, 2023

    @kou
    Member

    OK. Could you show head /home/pi/pyarrow-dev/bin/cmake?
    I think the shebang of the file is wrong. It must be #!/home/pi/pyarrow-dev/bin/python3.

  10. vmalisz commented on Jan 22, 2023

    @vmalisz
    Author

    it looks good

    $ head /home/pi/pyarrow-dev/bin/cmake

    #!/home/pi/pyarrow-dev/bin/python3
    # -*- coding: utf-8 -*-
    import re
    import sys
    from cmake import cmake
    if __name__ == '__main__':
        sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
        sys.exit(cmake())
    
  11. kou commented on Jan 22, 2023

    @kou
    Member

    Does /home/pi/pyarrow-dev/bin/cmake --help work?

  12. vmalisz commented on Jan 22, 2023

    @vmalisz
    Author

    it does

  13. kou commented on Jan 22, 2023

    @kou
    Member

    Could you use CMake installed by apt not pip or try pip install --no-build-isolation pyarrow?

  14. 4 remaining items

  15. vmalisz commented on Jan 22, 2023

    @vmalisz
    Author

    I followed exactly the instructions here: https://arrow.apache.org/docs/dev/developers/python.html#using-system-and-bundled-dependencies

    git clone https://github.com/apache/arrow.git
    pushd arrow
    git submodule update --init
    export PARQUET_TEST_DATA="${PWD}/cpp/submodules/parquet-testing/data"
    export ARROW_TEST_DATA="${PWD}/testing/data"
    popd
    sudo apt-get install build-essential cmake python3-dev
    
    python3 -m venv pyarrow-dev
    source ./pyarrow-dev/bin/activate
    pip install -r arrow/python/requirements-build.txt
    
    # This is the folder where we will install the Arrow libraries during
    # development
    mkdir dist
    

    (forgot that part below initially)

    export LD_LIBRARY_PATH=$(pwd)/dist/lib:$LD_LIBRARY_PATH
    export CMAKE_PREFIX_PATH=$ARROW_HOME:$CMAKE_PREFIX_PATH
    

    the error happened here at 'make install'

    pushd arrow/cpp/build
    cmake -DCMAKE_INSTALL_PREFIX=$ARROW_HOME \
            -DCMAKE_INSTALL_LIBDIR=lib \
            -DCMAKE_BUILD_TYPE=Debug \
            -DARROW_BUILD_TESTS=ON \
            -DARROW_COMPUTE=ON \
            -DARROW_CSV=ON \
            -DARROW_DATASET=ON \
            -DARROW_FILESYSTEM=ON \
            -DARROW_HDFS=ON \
            -DARROW_JSON=ON \
            -DARROW_PARQUET=ON \
            -DARROW_WITH_BROTLI=ON \
            -DARROW_WITH_BZ2=ON \
            -DARROW_WITH_LZ4=ON \
            -DARROW_WITH_SNAPPY=ON \
            -DARROW_WITH_ZLIB=ON \
            -DARROW_WITH_ZSTD=ON \
            -DPARQUET_REQUIRE_ENCRYPTION=ON \
            ..
    make -j4
    make install
    popd
    

    trying again with https://arrow.apache.org/docs/dev/developers/cpp/building.html#cpp-building-building

    $ cmake .. --preset ninja-debug-minimal worked

    $ tree debug
    debug/
    ├── libarrow_dataset.so -> libarrow_dataset.so.1100
    ├── libarrow_dataset.so.1100 -> libarrow_dataset.so.1100.0.0
    ├── libarrow_dataset.so.1100.0.0
    ├── libarrow.so -> libarrow.so.1100
    ├── libarrow.so.1100 -> libarrow.so.1100.0.0
    ├── libarrow.so.1100.0.0
    ├── libparquet.so -> libparquet.so.1100
    ├── libparquet.so.1100 -> libparquet.so.1100.0.0
    └── libparquet.so.1100.0.0
    
    0 directories, 9 files
    

    that part is a bit over my head, and I'm not sure where to go from there. Thanks again for your help!

  16. kou commented on Jan 22, 2023

    @kou
    Member

    It seems that export ARROW_HOME=... is missing.
    Could you show echo $CMAKE_PREFIX_PATH?
    Could you also show make install output?

  17. vmalisz commented on Jan 22, 2023

    @vmalisz
    Author

    just ran

    cmake --preset=ninja-release-python-minimal .
    cmake --build .
    sudo cmake --build . --target install
    

    without errors.

    Then tried to install pyarrow again and it worked!

    I have no idea what I did honestly... it looks like pip can't work for a Pi installation. it requires the latest cmake from apt and for arrow to be compiled from the source. I have a limited understanding of that part, and still not sure why I still had to do a pip install on top of the build.

    $ echo $CMAKE_PREFIX_PATH
    /home/pi/dist:/home/pi/dist:
    

    I don't know if I can run again make install now it works? (really afraid to break something...)

  18. vmalisz commented on Jan 22, 2023

    @vmalisz
    Author

    Let me know if I can help to resolve the vanilla pip install process for Raspberry, looks like a niche but it didn't work for me on 2 different setup so I guess it is really something that can be fixed. or I'm very unlucky

    thank you again for your help, I can get back to my project! (and sleeping)

  19. kou commented on Jan 24, 2023

    @kou
    Member

    DESTDIR=/tmp/test/ make install is safer but it's not needed because your problem was solved. :-)

    I think that documented command lines work well but there are many command lines. So some human errors can be injected like CMAKE_PREFIX_PATH.
    If we provide pyarrow wheels for Raspberry Pi, you just need to run pip install pyarrow.
    We provide pyarrow wheels for aarch64: https://pypi.org/project/pyarrow/#files
    I don't know what architecture is required for Raspberry Pi.

    BTW, can we close this issue?

  20. vmalisz commented on Jan 24, 2023

    @vmalisz
    Author

    yes, I just did. Thank you again for your help!

  21. vmalisz commented on Jan 25, 2023

    @vmalisz
    Author

    hi @kou! I'm experiencing a new issue but note sure how related to the install it is so I dont want to create a new thread unless you tell me so.

    I initially needed to install pyarrow because I couldn't install db-dtypes without it. Now I have both and it's confirmed if I try pip install db-dtypes

    It looks like the issue is still with pyarrow though:
    import pyarrow.lib as _lib ImportError: libarrow_dataset.so.1100: cannot open shared object file: No such file or directory

    the full error (worth mentioning the script works well on my laptop... maybe I should just consider not using a Pi for that project):

    Traceback (most recent call last):
      File "/home/pi/pyarrow-dev/lib/python3.7/site-packages/google/cloud/bigquery/_pandas_helpers.py", line 41, in <module>
        import db_dtypes  # type: ignore
      File "/home/pi/pyarrow-dev/lib/python3.7/site-packages/db_dtypes/__init__.py", line 26, in <module>
        import pyarrow
      File "/home/pi/pyarrow-dev/lib/python3.7/site-packages/pyarrow/__init__.py", line 65, in <module>
        import pyarrow.lib as _lib
    ImportError: libarrow_dataset.so.1100: cannot open shared object file: No such file or directory
    
    The above exception was the direct cause of the following exception:
    
    Traceback (most recent call last):
      File "run_gscpull.py", line 5, in <module>
        gscdatapull(backfill=5)#, end_date='2022-11-10')
      File "/home/pi/gsc-bigquery/class_gscdailypull.py", line 22, in __init__
        self.do_allthethings(all_users_settings,self.backfill)
      File "/home/pi/gsc-bigquery/class_gscdailypull.py", line 58, in do_allthethings
        mydata = GSC(domain=domain,wp_user_id=user_data['user_id'],backfill=backfill, refresh=user_data['refresh_token'], end_date=self.end_date)
      File "/home/pi/gsc-bigquery/class_gsc.py", line 47, in __init__
        self.db_dates_data = bigquery.checkdata(self.start_date, self.end_date).to_dataframe()
      File "/home/pi/pyarrow-dev/lib/python3.7/site-packages/google/cloud/bigquery/table.py", line 1993, in to_dataframe
        _pandas_helpers.verify_pandas_imports()
      File "/home/pi/pyarrow-dev/lib/python3.7/site-packages/google/cloud/bigquery/_pandas_helpers.py", line 1006, in verify_pandas_imports
        raise ValueError(_NO_DB_TYPES_ERROR) from db_dtypes_import_exception
    ValueError: Please install the 'db-dtypes' package to use this function.
    
  22. kou commented on Jan 26, 2023

    @kou
    Member

    You need to use ninja-release-python or ninja-release-python-maximum preset to use pyarrow.dataset:

    cmake --preset=ninja-release-python .
    cmake --build .
    sudo cmake --build . --target install
    pip install pyarrow
  23. vmalisz commented on Jan 26, 2023

    @vmalisz
    Author

    cmake --preset=ninja-release-python . stopped somewhere in the middle of sudo cmake --build . --target install

    so I just tried to add dataset=on to the ninja-release-python-minimal preset (see below), the install works but I have the same error when running my script.
    cmake -DARROW_BUILD_STATIC=OFF -DARROW_COMPUTE=ON -DARROW_CSV=ON -DARROW_FILESYSTEM=ON -DARROW_JSON=ON -DARROW_DATASET=ON -DCMAKE_BUILD_TYPE=Release

    trying cmake --preset=ninja-release-python . again, will report the error

  24. vmalisz commented on Jan 26, 2023

    @vmalisz
    Author

    it worked this time. no error but the script still fails

    here's the output for sudo cmake --build . --target install
    install.txt

    looks like the library is installed

    -- Installing: /usr/local/lib/libarrow_dataset.so.1100.0.0
    -- Up-to-date: /usr/local/lib/libarrow_dataset.so.1100
    -- Set runtime path of "/usr/local/lib/libarrow_dataset.so.1100.0.0" to ""
    -- Up-to-date: /usr/local/lib/libarrow_dataset.so
    -- Up-to-date: /usr/local/lib/cmake/ArrowDataset/ArrowDatasetConfig.cmake
    -- Up-to-date: /usr/local/lib/cmake/ArrowDataset/ArrowDatasetConfigVersion.cmake
    

    I tried adding /usr/local/lib to the $LD_LIBRARY_PATH but didn't work either.

  25. vmalisz commented on Jan 26, 2023

    @vmalisz
    Author

    ok that was most likely the LD_LIBRARY_PATH, I ran a sudo ldconfig and now it works. THANK YOU for your help and patience (I learned a lot!)

  26. kou commented on Jan 26, 2023

    @kou
    Member

    No problem. :-)

  27. bdod92 commented on Apr 27, 2023

    @bdod92

    Hi @vmalisz and @kou, I am running into the same errors that you described above. Would you be able to summarize the list of commands that you entered to get pyarrow to run? I'm having trouble discerning which steps were necessary and which ones caused more issues. Thank you in advance!

  28. kou commented on May 1, 2023

    @kou
    Member

    What is your platform?

    In general, https://arrow.apache.org/docs/dev/developers/python.html#building-on-linux-and-macos should work.
    If it doesn't work, we should update our documentations.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions