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

Fix Android/Termux compatibility error #3221

Open
1 task done
brunodavi opened this issue Oct 18, 2024 · 4 comments
Open
1 task done

Fix Android/Termux compatibility error #3221

brunodavi opened this issue Oct 18, 2024 · 4 comments
Labels
🐛 bug Something isn't working

Comments

@brunodavi
Copy link

  • I have searched the issue tracker and believe that this is not a duplicate.

Make sure you run commands with -v flag before pasting the output.

WARNING: Lockfile does not exist
Updating the lock file...
Traceback (most recent call last):
  File "/data/data/com.termux/files/home/.local/share/pipx/venvs/pdm/lib/python3.11/site-packages/pdm/models/in_process/env_spec.py", line 25, in <module>
    print(json.dumps(get_current_env_spec(), indent=2))
                     ^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/share/pipx/venvs/pdm/lib/python3.11/site-packages/pdm/models/in_process/env_spec.py", line 16, in get_current_env_spec
    "platform": str(Platform.current()),
                    ^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/share/pipx/venvs/pdm/lib/python3.11/site-packages/dep_logic/tags/platform.py", line 136, in current
    raise PlatformError("Unsupported platform: libc not found")
dep_logic.tags.platform.PlatformError: Unsupported platform: libc not found
Traceback (most recent call last):
  File "/data/data/com.termux/files/home/.local/bin/pdm", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/data/data/com.termux/files/home/.local/share/pipx/venvs/pdm/lib/python3.11/site-packages/pdm/core.py", line 378, in main
    return core.main(args or sys.argv[1:])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/share/pipx/venvs/pdm/lib/python3.11/site-packages/pdm/core.py", line 267, in main
    raise cast(Exception, err).with_traceback(traceback) from None
  File "/data/data/com.termux/files/home/.local/share/pipx/venvs/pdm/lib/python3.11/site-packages/pdm/core.py", line 262, in main
    self.handle(project, options)
  File "/data/data/com.termux/files/home/.local/share/pipx/venvs/pdm/lib/python3.11/site-packages/pdm/core.py", line 194, in handle
    command.handle(project, options)
  File "/data/data/com.termux/files/home/.local/share/pipx/venvs/pdm/lib/python3.11/site-packages/pdm/cli/commands/install.py", line 95, in handle
    actions.do_lock(
  File "/data/data/com.termux/files/home/.local/share/pipx/venvs/pdm/lib/python3.11/site-packages/pdm/cli/actions.py", line 64, in do_lock
    locked_repo = project.get_locked_repository()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/share/pipx/venvs/pdm/lib/python3.11/site-packages/pdm/project/core.py", line 444, in get_locked_repository
    return LockedRepository(lockfile, self.sources, self.environment, env_spec=env_spec)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/share/pipx/venvs/pdm/lib/python3.11/site-packages/pdm/models/repositories/lock.py", line 40, in __init__
    super().__init__(sources, environment, env_spec=env_spec or environment.spec)
                                                                ^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/usr/lib/python3.11/functools.py", line 1001, in __get__
    val = self.func(instance)
          ^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/share/pipx/venvs/pdm/lib/python3.11/site-packages/pdm/environments/base.py", line 186, in spec
    return get_env_spec(self.interpreter.executable.as_posix())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/share/pipx/venvs/pdm/lib/python3.11/site-packages/pdm/models/in_process/__init__.py", line 56, in get_env_spec
    return EnvSpec.from_spec(**json.loads(subprocess.check_output([executable, "-EsS", script, *shared_libs])))
                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/usr/lib/python3.11/subprocess.py", line 466, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/usr/lib/python3.11/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/data/data/com.termux/files/home/projects/my/py/prj/.venv/bin/python', '-EsS', '/data/data/com.termux/files/home/.local/share/pipx/venvs/pdm/lib/python3.11/site-packages/pdm/models/in_process/env_spec.py', '/data/data/com.termux/files/home/.local/share/pipx/venvs/pdm/lib/python3.11/site-packages']' returned non-zero exit status 1.

Steps to reproduce

pdm init -n
pdm install

Actual behavior

Error getting environment in termux with android

Expected behavior

Install project dependencies

Environment Information

# Paste the output of `pdm info && pdm info --env` below:

PDM version:
  2.19.2
Python Interpreter:
  /data/data/com.termux/files/home/projects/my/py/prj/.venv/bin/python (3.11)
Project Root:
  /data/data/com.termux/files/home/projects/my/py/prj
Local Packages:
  
Traceback (most recent call last):
  File "/data/data/com.termux/files/home/.local/share/pipx/venvs/pdm/lib/python3.11/site-packages/pdm/models/in_process/env_spec.py", line 25, in <module>
    print(json.dumps(get_current_env_spec(), indent=2))
                     ^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/share/pipx/venvs/pdm/lib/python3.11/site-packages/pdm/models/in_process/env_spec.py", line 16, in get_current_env_spec
    "platform": str(Platform.current()),
                    ^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/share/pipx/venvs/pdm/lib/python3.11/site-packages/dep_logic/tags/platform.py", line 136, in current
    raise PlatformError("Unsupported platform: libc not found")
dep_logic.tags.platform.PlatformError: Unsupported platform: libc not found
WARNING: Failed to get latest version: Command '['/data/data/com.termux/files/home/.local/share/pipx/venvs/pdm/bin/python', '-EsS', '/data/data/com.termux/files/home/.local/share/pipx/venvs/pdm/lib/python3.11/site-packages/pdm/models/in_process/env_spec.py', '/data/data/com.termux/files/home/.local/share/pipx/venvs/pdm/lib/python3.11/site-packages']' returned non-zero exit status 1.
Traceback (most recent call last):
  File "/data/data/com.termux/files/home/.local/share/pipx/venvs/pdm/lib/python3.11/site-packages/pdm/models/in_process/env_spec.py", line 25, in <module>
    print(json.dumps(get_current_env_spec(), indent=2))
                     ^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/share/pipx/venvs/pdm/lib/python3.11/site-packages/pdm/models/in_process/env_spec.py", line 16, in get_current_env_spec
    "platform": str(Platform.current()),
                    ^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/.local/share/pipx/venvs/pdm/lib/python3.11/site-packages/dep_logic/tags/platform.py", line 136, in current
    raise PlatformError("Unsupported platform: libc not found")
dep_logic.tags.platform.PlatformError: Unsupported platform: libc not found
[CalledProcessError]: Command '['/data/data/com.termux/files/home/projects/my/py/prj/.venv/bin/python', '-EsS', '/data/data/com.termux/files/home/.local/share/pipx/venvs/pdm/lib/python3.11/site-packages/pdm/models/in_process/env_spec.py', '/data/data/com.termux/files/home/.local/share/pipx/venvs/pdm/lib/python3.11/site-packages']' returned non-zero exit status 1.
WARNING: Add '-v' to see the detailed traceback
@brunodavi brunodavi added the 🐛 bug Something isn't working label Oct 18, 2024
@brunodavi
Copy link
Author

brunodavi commented Oct 18, 2024

If it is not within your scope, could you tell me how to install the version of this commit?

Edit: I found the version that is working is v2.16.1

@Buried-In-Code
Copy link

I also installed pipx into my Termux setup, so I got pdm to work by running:
pipx install "pdm==2.16.1"

@ixenion
Copy link

ixenion commented Dec 13, 2024

Hope this will be fixed soon...
Dont like the idea to use an old version on Android

@frostming
Copy link
Collaborator

It should be fixed by the new release of dep-logic, can you upgrade it and try? @ixenion

ixenion added a commit to ixenion/aircrack-tui that referenced this issue Dec 13, 2024
Due to Android/Termux compatibility error
(check pdm-project/pdm#3221)
have to downgrade pdm version to 2.16.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants