Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Issue installing python-torch #20158

Closed
dzuberi opened this issue May 15, 2024 · 9 comments
Closed

[Bug]: Issue installing python-torch #20158

dzuberi opened this issue May 15, 2024 · 9 comments
Labels
bug report Something is not working properly.

Comments

@dzuberi
Copy link

dzuberi commented May 15, 2024

Problem description

I'm trying to install python-torch to use pytorch as a dependency for some other python modules. When I try installing it, the output looks something like this

$ pkg install python-torch
No mirror or mirror group selected. You might want to select one by running 'termux-change-repo'
Checking availability of current mirror:
[*] https://mirror.fcix.net/termux/termux-main: ok
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
  python-torch
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/35.2 MB of archives.
After this operation, 254 MB of additional disk space will be used.
Selecting previously unselected package python-torch.
(Reading database ... 38765 files and directories currently installed.)
Preparing to unpack .../python-torch_2.1.2-1_aarch64.deb ...
Unpacking python-torch (2.1.2-1) ...
Setting up python-torch (2.1.2-1) ...
Installing dependencies for python-torch...
ERROR: Exception:
Traceback (most recent call last):
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/pip/_internal/cli/base_command.py", line 180, in exc_logging_wrapper
    status = run_func(*args)
             ^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/pip/_internal/cli/req_command.py", line 245, in wrapper
    return func(self, options, args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/pip/_internal/commands/install.py", line 324, in run
    session = self.get_default_session(options)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/pip/_internal/cli/req_command.py", line 95, in get_default_session
    self._session = self.enter_context(self._build_session(options))
                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/pip/_internal/cli/req_command.py", line 122, in _build_session
    session = PipSession(
              ^^^^^^^^^^^
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/pip/_internal/network/session.py", line 342, in __init__
    self.headers["User-Agent"] = user_agent()
                                 ^^^^^^^^^^^^
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/pip/_internal/network/session.py", line 175, in user_agent
    setuptools_dist = get_default_environment().get_distribution("setuptools")
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/pip/_internal/metadata/importlib/_envs.py", line 189, in get_distribu
tion
    return next(matches, None)
           ^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/pip/_internal/metadata/importlib/_envs.py", line 184, in <genexpr>
    matches = (
              ^
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/pip/_internal/metadata/base.py", line 626, in iter_all_distributions
    for dist in self._iter_distributions():
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/pip/_internal/metadata/importlib/_envs.py", line 177, in _iter_distri
butions
    for dist in finder.find_eggs(location):
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/pip/_internal/metadata/importlib/_envs.py", line 144, in find_eggs
    yield from self._find_eggs_in_dir(location)
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/pip/_internal/metadata/importlib/_envs.py", line 115, in _find_eggs_i
n_dir
    with os.scandir(location) as it:
         ^^^^^^^^^^^^^^^^^^^^
PermissionError: [Errno 13] Permission denied: '/'
dpkg: error processing package python-torch (--configure):
 installed python-torch package post-installation script subprocess returned error exit status 2
Errors were encountered while processing:
 python-torch
E: Sub-process /data/data/com.termux/files/usr/bin/dpkg returned an error code (1)

It appears to be running some post-installation script but trying to access the root directory. I haven't seen anyone else with this issue, but posting here in case I am first by some miracle, or if not to get some advice on getting past this issue

What steps will reproduce the bug?

pkg install python-torch

What is the expected behavior?

Expected to be installed

System information

Termux Variables:
TERMUX_APK_RELEASE=GITHUB
TERMUX_APP_PACKAGE_MANAGER=apt
TERMUX_APP_PID=5951
TERMUX_IS_DEBUGGABLE_BUILD=1
TERMUX_MAIN_PACKAGE_FORMAT=debian
TERMUX_VERSION=0.118.0
TERMUX__USER_ID=0
Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://mirror.fcix.net/termux/termux-main stable main
# tur-repo (sources.list.d/tur.list)
deb https://tur.kcubeterm.com tur-packages tur tur-on-device tur-continuous
Updatable packages:
All packages up to date
termux-tools version:
1.42.1
Android version:
14
Kernel build information:
Linux localhost 5.10.189-android13-4-00012-g1217bb583cc5-ab11174560 #1 SMP PREEMPT Mon Dec 4 18:59:42 UTC 2023 aarch64 Android
Device manufacturer:
Google
Device model:
Pixel Fold
LD Variables:
LD_LIBRARY_PATH=/system/vendor/lib64:/vendor/lib64/egl:
LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so
@dzuberi dzuberi added bug report Something is not working properly. untriaged labels May 15, 2024
@Duuckjing
Copy link

Maybe you can try to update apt or install dpkg again? I didn't encounter error installing python-torch

@licy183 licy183 removed the untriaged label May 15, 2024
@licy183
Copy link
Member

licy183 commented May 15, 2024

I can't reproduce this error too... Are are using pip distributed by Termux's apt?

Besides, starting from #19748 (python-torch 2.1.2-2 ), python-torch has been moved to the x11 repository. However, it seems that the package still exists in the main repository.

Ping @Grimler91 Could you please remove python-torch from the main repository?

@dzuberi
Copy link
Author

dzuberi commented May 15, 2024

@licy183 I'm using python-pip installed from pkg install python-pip, so I think so.

@Duuckjing I've run pkg update && pkg upgrade and apt update && apt upgrade (which I think do the same thing). How do I reinstall dpkg?

@dzuberi
Copy link
Author

dzuberi commented May 15, 2024

I tried pkg reinstall dpkg but the issue persists

@dzuberi
Copy link
Author

dzuberi commented May 15, 2024

So I also tried

pkg install x11-repo
pkg update && pkg upgrade
pkg install python-torch

after @licy183's comment but the same error occurs

edit: actually python-torch is still being sourced from the main repo in this instance

@dzuberi
Copy link
Author

dzuberi commented May 15, 2024

Update: I also tried manually downloading and installing the dpkg from the x11 repo and I get the same error

@licy183
Copy link
Member

licy183 commented May 16, 2024

I still don't think that you're using the python-pip shipped by Termux. Try rm $PREFIX/lib/python3.11/site-packages/pip && apt install --reinstall python-pip.

@dzuberi
Copy link
Author

dzuberi commented May 24, 2024

@licy183 unfortunately that didn't help, sorry for the late response

@dzuberi
Copy link
Author

dzuberi commented May 24, 2024

I ended up just reinstalling termux, curious what went wrong but I decided to just start over

@dzuberi dzuberi closed this as completed May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report Something is not working properly.
Projects
None yet
Development

No branches or pull requests

3 participants