pipupgrade icon indicating copy to clipboard operation
pipupgrade copied to clipboard

Error run in termux

Open AhmadNaruto opened this issue 4 years ago • 1 comments

What's the bug all about?

pipupgrade cant run in termux.. its raising error

What command led to this issue?

Please type the exact command that led to this issue.

$ pipupgrade -i

Logs

logs using pipupgrade --verbose

$ pipupgrade --verbose
2020-06-02 23:32:56,978 | INFO | Executing command: /data/data/com.termux/files/usr/bin/pip --version
2020-06-02 23:32:58,378 | INFO | Executing command: /data/data/com.termux/files/usr/bin/pip3 --version
2020-06-02 23:32:59,770 | INFO | Environment: {'version': '1.7.1', 'python_version': '3.8.3', 'os': 'Linux-3.18.120-perf-g9642d489-aarch64-with-libc', 'config': {'path': {'BASE': '/data/data/com.termux/files/usr/lib/python3.8/site-packages/pipupgrade', 'DATA': '/data/data/com.termux/files/usr/lib/python3.8/site-packages/pipupgrade/data', 'CACHE': '/data/data/com.termux/files/home/.pipupgrade'}}, 'pip_executables': [{'executable': '/data/data/com.termux/files/usr/bin/pip', 'version': 'pip 20.1.1 from /data/data/com.termux/files/usr/lib/python3.8/site-packages/pip (python 3.8)'}, {'executable': '/data/data/com.termux/files/usr/bin/pip3', 'version': 'pip 20.1.1 from /data/data/com.termux/files/usr/lib/python3.8/site-packages/pip (python 3.8)'}], 'settings': {'settings': {'version': '1.7.1', 'cache_timeout': '86400', 'jobs': '8'}}}
2020-06-02 23:32:59,771 | INFO | Arguments Passed: {'packages': [], 'pip_path': None, 'requirements': None, 'pipfile': None, 'project': None, 'pull_request': False, 'git_username': None, 'git_email': None, 'github_access_token': None, 'github_reponame': None, 'github_username': None, 'target_branch': 'master', 'upgrade_type': ['minor', 'patch'], 'latest': 0, 'format': 'table', 'all': 0, 'pip': 0, 'self': False, 'jobs': 8, 'user': 0, 'check': 0, 'interactive': 0, 'yes': 0, 'no_included_requirements': 0, 'no_cache': 0, 'no_color': 0, 'output': None, 'ignore_error': 0, 'force': 0, 'verbose': True}
Checking...
2020-06-02 23:32:59,785 | INFO | `pip` executables found: ['/data/data/com.termux/files/usr/bin/pip', '/data/data/com.termux/files/usr/bin/pip3']
2020-06-02 23:32:59,785 | INFO | Using 8 jobs...
Traceback (most recent call last):
  File "/data/data/com.termux/files/usr/lib/python3.8/multiprocessing/synchronize.py", line 28, in <module>
    from _multiprocessing import SemLock, sem_unlink
ImportError: cannot import name 'SemLock' from '_multiprocessing' (/data/data/com.termux/files/usr/lib/python3.8/lib-dynload/_multiprocessing.cpython-38.so)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/data/data/com.termux/files/usr/bin/pipupgrade", line 8, in <module>
    sys.exit(main())
  File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/pipupgrade/cli/__init__.py", line 15, in wrapper
    return fn(**params)
  File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/pipupgrade/commands/__init__.py", line 161, in command
    with parallel.no_daemon_pool(processes = jobs) as pool:
  File "/data/data/com.termux/files/usr/lib/python3.8/contextlib.py", line 113, in __enter__
    return next(self.gen)
  File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/pipupgrade/parallel.py", line 34, in no_daemon_pool
    with pool(class_ = NoDaemonPool, *args, **kwargs) as p:
  File "/data/data/com.termux/files/usr/lib/python3.8/contextlib.py", line 113, in __enter__
    return next(self.gen)
  File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/pipupgrade/parallel.py", line 28, in pool
    pool = class_(*args, **kwargs)
  File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/pipupgrade/parallel.py", line 19, in __init__
    self.super.__init__(*args, **kwargs)
  File "/data/data/com.termux/files/usr/lib/python3.8/multiprocessing/pool.py", line 191, in __init__
    self._setup_queues()
  File "/data/data/com.termux/files/usr/lib/python3.8/multiprocessing/pool.py", line 343, in _setup_queues
    self._inqueue = self._ctx.SimpleQueue()
  File "/data/data/com.termux/files/usr/lib/python3.8/multiprocessing/context.py", line 113, in SimpleQueue
    return SimpleQueue(ctx=self.get_context())
  File "/data/data/com.termux/files/usr/lib/python3.8/multiprocessing/queues.py", line 336, 

AhmadNaruto avatar Jun 02 '20 16:06 AhmadNaruto

Android's libc (Bionic) doesn't support Semaphores and thus doesn't support SemLock ...

I just tried running pipupgrade with -j 1 in the hopes that a single job would disable trying to use multiprocessing but it didn't work.

Specifically, it's not possible to instantiate a multiprocessing.pool.Pool object on Termux on Android. (It might work in Arch Linux on Termux on Android...)

I had a quick look through the code and because a Pool is created even for just 1 job, that's why it's still giving the error. On one hand, having every operation go through Pool and just setting the number of CPUs/Threads makes it simple enough to emulate a single thread... But it's still not really a single thread.

I'll have a look -- @achillesrasquinha any suggestions? Perhaps using a different object in parallel.py when jobs==1?

danieldjewell avatar Sep 01 '20 21:09 danieldjewell