[Python] Running pythonpy installed via pipx gives: ImportError

Discussão em 'Python' iniciado por Stack, Maio 30, 2025.

  1. Stack

    Stack Membro Participativo

    The problem


    I recently tried installing pythonpy using pipx, but whenever I run any command using py, I see the following traceback:

    $ py '2-3'
    Traceback (most recent call last):
    File "/home/m/.local/bin/py", line 5, in <module>
    from pythonpy.__main__ import main
    File "/home/m/.local/share/pipx/venvs/pythonpy/lib/python3.12/site-packages/pythonpy/__main__.py", line 16, in <module>
    from collections import Iterable
    ImportError: cannot import name 'Iterable' from 'collections' (/usr/lib/python3.12/collections/__init__.py)

    Installation


    How I installed py

    $ sudo apt install pipx
    $ pipx install pythonpy
    $ pipx ensurepath

    Additional information


    pipx list output:

    venvs are in /home/m/.local/share/pipx/venvs
    apps are exposed on your $PATH at /home/m/.local/bin
    manual pages are exposed at /home/m/.local/share/man
    package pythonpy 0.4.11, installed using Python 3.12.3
    - find_pycompletion.sh
    - py
    - py3
    - py3.1
    - pycompleter
    - pycompleter3
    - pycompleter3.1


    Versions:

    • Python version: Python 3.12.3
    • pipx version: pipx 1.4.3
    • OS: Ubuntu 24.04.02 LTS kernel 5.15)

    Note: That sudo apt install python3-py also gives an unsatisfying result by causing py to throw Syntaxerrors. The answer provided in this stackoflow question link is not intended to work on the newer versions of Ubuntu, since the new pip will give error: externally-managed-environment when installing packages.

    Question


    How can make sure that this pipx installed py command works without error?

    Continue reading...

Compartilhe esta Página