Skip to content

[Bug]: pip does not work on Android 14 #3649

Description

@rampadmin

Problem description

I get the following error while running pip install <any-package> on my Android 14/Pixel 7A device

~/downloads $ python3 -m pip install matplotlib
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/pip/__main__.py", line 24, in <module>
    sys.exit(_main())
             ^^^^^^^
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/pip/_internal/cli/main.py", line 77, in main
    command = create_command(cmd_name, isolated=("--isolated" in cmd_args))
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/pip/_internal/commands/__init__.py", line 114, in create_command
    module = importlib.import_module(module_path)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/pip/_internal/commands/install.py", line 15, in <module>
    from pip._internal.cli.req_command import (
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/pip/_internal/cli/req_command.py", line 21, in <module>
    from pip._internal.index.package_finder import PackageFinder
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/pip/_internal/index/package_finder.py", line 30, in <module>
    from pip._internal.req import InstallRequirement
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/pip/_internal/req/__init__.py", line 8, in <module>
    from .req_install import InstallRequirement
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/pip/_internal/req/req_install.py", line 42, in <module>
    from pip._internal.operations.install.wheel import install_wheel
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/pip/_internal/operations/install/wheel.py", line 39, in <module>
    from pip._vendor.distlib.scripts import ScriptMaker
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/pip/_vendor/distlib/scripts.py", line 16, in <module>
    from .compat import sysconfig, detect_encoding, ZipFile
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/pip/_vendor/distlib/compat.py", line 83, in <module>
    import xmlrpc.client as xmlrpclib
  File "/data/data/com.termux/files/usr/lib/python3.11/xmlrpc/client.py", line 138, in <module>
    from xml.parsers import expat
  File "/data/data/com.termux/files/usr/lib/python3.11/xml/parsers/expat.py", line 4, in <module>
    from pyexpat import *
ImportError: dlopen failed: library "libexpat.so.1" not found: needed by /data/data/com.termux/files/usr/lib/python3.11/lib-dynload/pyexpat.cpython-311.so in namespace (default)

Could someone please help out with this issue?

Steps to reproduce the behavior.

Run pip install matplotlib (or any other package) after installing python using pkg or your preferred package manager.

What is the expected behavior?

The package should get installed successfully via pip.

System information

  • Termux application version: v0.118.0
  • Android OS version: 14
  • Device model: Pixel 7a

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