1

I wanted to use the bitarray module. I typed the command $ pip3 install bitarray. It was successfully installed, but it reported an error when I tried to import it.

Code:

import bitarray

Error message:

Traceback (most recent call last):
  File "/var/mobile/Containers/Data/Application/70D7D19F-D760-465F-9349-B9B457DDB1E0/Documents/TestCode.py", line 1, in <module>
    import bitarray
  File "/private/var/mobile/Containers/Shared/AppGroup/CA6D7B01-BD6D-4954-A540-18C24905E5B4/home/lib/python3.11/site-packages/bitarray/__init__.py", line 14, in <module>
    from bitarray._bitarray import (bitarray, decodetree, _sysinfo,
ImportError: dlopen(/private/var/mobile/Containers/Shared/AppGroup/CA6D7B01-BD6D-4954-A540-18C24905E5B4/home/lib/python3.11/site-packages/bitarray/_bitarray.cpython-311-darwin.so, 0x0002): tried: '/private/var/mobile/Containers/Shared/AppGroup/CA6D7B01-BD6D-4954-A540-18C24905E5B4/home/lib/python3.11/site-packages/bitarray/_bitarray.cpython-311-darwin.so' (mach-o file (/private/var/mobile/Containers/Shared/AppGroup/CA6D7B01-BD6D-4954-A540-18C24905E5B4/home/lib/python3.11/site-packages/bitarray/_bitarray.cpython-311-darwin.so), but incompatible platform (have 'macOS', need 'iOS')), '/private/preboot/Cryptexes/OS/private/var/mobile/Containers/Shared/AppGroup/CA6D7B01-BD6D-4954-A540-18C24905E5B4/home/lib/python3.11/site-packages/bitarray/_bitarray.cpython-311-darwin.so' (no such file), '/private/var/mobile/Containers/Shared/AppGroup/CA6D7B01-BD6D-4954-A540-18C24905E5B4/home/lib/python3.11/site-packages/bitarray/_bitarray.cpython-311-darwin.so' (mach-o file (/private/var/mobile/Containers/Shared/AppGroup/CA6D7B01-BD6D-4954-A540-18C24905E5B4/home/lib/python3.11/site-packages/bitarray/_bitarray.cpython-311-darwin.so), but incompatible platform (have 'macOS', need 'iOS'))

I thought the problem is that I installed the bitarray 3.0.0 version, which does not support my iPadOS 17.6 operating system. I tried to install the 2.7.3 version like this:$ pip3 install bitarray==2.7.3. Bitarray 2.7.3 was successfully installed (it also said the 3.0.0 version was successfully uninstalled), but the same error message appeared when I tried to import bitarray.

I’m using Python 3.11, what should I do?

2
  • 1
    you need to do pip3 install bitarray==2.7.3 to install a specific version of a library. If you use space pip will interpret 2.7.3 as a second library to install, use == instead Commented Dec 20, 2024 at 10:48
  • That works! But I still can’t use bitarray, maybe it is not about which version. Commented Dec 20, 2024 at 10:57

1 Answer 1

0

PyPI packages generally cannot directly run on mobile devices because mobile operating systems (iOS and Android) do not natively support Python execution.

However you can use Juno or Pythonista which provides a Python development environment for iPad and iPhone.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.