Search code examples
pythonpippackagepypitermux

Installing pypi packages on termux using pip is not working


while installing pyrogram or telethon on termux using pip I facing error. I'll provide error below.

~ $ pip install telethon
Collecting telethon                                       Downloading Telethon-1.28.5-py3-none-any.whl (600 kB)
     ━━━━━━━━━━━━━━ 600.9/600.9   284.4 kB/s eta 0:00:00
                    kB
Collecting pyaes (from telethon)
  Downloading pyaes-1.6.1.tar.gz (28 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done            Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [1 lines of output]
      error: [('/data/data/com.termux/files/usr/tmp/pip-modern-metadata-slc24ohr/pyaes.egg-info/PKG-INFO', '/data/data/com.termux/files/usr/tmp/pip-modern-metadata-slc24ohr/pyaes.egg-info.__bkp__/PKG-INFO', "[Errno 13] Permission denied: '/data/data/com.termux/files/usr/tmp/pip-modern-metadata-slc24ohr/pyaes.egg-info.__bkp__/PKG-INFO'"), ('/data/data/com.termux/files/usr/tmp/pip-modern-metadata-slc24ohr/pyaes.egg-info/dependency_links.txt', '/data/data/com.termux/files/usr/tmp/pip-modern-metadata-slc24ohr/pyaes.egg-info.__bkp__/dependency_links.txt', "[Errno 13] Permission denied: '/data/data/com.termux/files/usr/tmp/pip-modern-metadata-slc24ohr/pyaes.egg-info.__bkp__/dependency_links.txt'"), ('/data/data/com.termux/files/usr/tmp/pip-modern-metadata-slc24ohr/pyaes.egg-info/top_level.txt', '/data/data/com.termux/files/usr/tmp/pip-modern-metadata-slc24ohr/pyaes.egg-info.__bkp__/top_level.txt', "[Errno 13] Permission denied: '/data/data/com.termux/files/usr/tmp/pip-modern-metadata-slc24ohr/pyaes.egg-info.__bkp__/top_level.txt'"), ('/data/data/com.termux/files/usr/tmp/pip-modern-metadata-slc24ohr/pyaes.egg-info/SOURCES.txt', '/data/data/com.termux/files/usr/tmp/pip-modern-metadata-slc24ohr/pyaes.egg-info.__bkp__/SOURCES.txt', "[Errno 13] Permission denied: '/data/data/com.termux/files/usr/tmp/pip-modern-metadata-slc24ohr/pyaes.egg-info.__bkp__/SOURCES.txt'"), ('/data/data/com.termux/files/usr/tmp/pip-modern-metadata-slc24ohr/pyaes.egg-info', '/data/data/com.termux/files/usr/tmp/pip-modern-metadata-slc24ohr/pyaes.egg-info.__bkp__', "[Errno 13] Permission denied: '/data/data/com.termux/files/usr/tmp/pip-modern-metadata-slc24ohr/pyaes.egg-info.__bkp__'")]
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

how can we solve this problem and install packages correctly on termux

I have tried

pkg install python-pip
pip install pyrogram
pip3 install pyrogram
MATHLIB="m" pip install pyrogram

but all of them useless


Solution

  • I encountered this issue today and the first thing I got was your question!!

    By trying to install it in Venv I could get it to work just fine...!

    mkdir newDir; cd newDir;
    python3 -m venv venv
    . venv/bin/activate
    pip install -U pyrogram
    pip install -U telethon
    

    bingo

    To get outta venv just type deactivate hope this works for you.