Skip to content

Instantly share code, notes, and snippets.

@scrool
Created November 26, 2023 13:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scrool/5117c4e096782cd541720b82ea75d65f to your computer and use it in GitHub Desktop.
Save scrool/5117c4e096782cd541720b82ea75d65f to your computer and use it in GitHub Desktop.
pipx not able to install packages after upgrade from Fedora 38 to Fedora 39
$ pipx install git+https://github.com/Softcatala/whisper-ctranslate2
  File "/usr/lib/python3.12/site-packages/pipx/main.py", line 863, in cli
    return run_pipx_command(parsed_pipx_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/pipx/main.py", line 214, in run_pipx_command
    return commands.install(
           ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/pipx/commands/install.py", line 30, in install
    package_name = package_name_from_spec(
                   ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/pipx/commands/common.py", line 332, in package_name_from_spec
    package_name = venv.install_package_no_deps(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/pipx/venv.py", line 281, in install_package_no_deps
    old_package_set = self.list_installed_packages()
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/pipx/venv.py", line 362, in list_installed_packages
    pip_list = json.loads(cmd_run.stdout.strip())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.12/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.12/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.12/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Why is this happening?

$ python -m pdb $(which pipx) install git+https://github.com/Softcatala/whisper-ctranslate2
> /usr/bin/pipx(3)<module>()
-> import re
(Pdb) /usr/lib/python3.12/site-packages/pipx/venv.py:358
*** SyntaxError: invalid syntax
(Pdb) break /usr/lib/python3.12/site-packages/pipx/venv.py:358
Breakpoint 1 at /usr/lib/python3.12/site-packages/pipx/venv.py:358
(Pdb) cont
> /usr/lib/python3.12/site-packages/pipx/venv.py(358)list_installed_packages()
-> cmd_run = run_subprocess(
⣻ determining package name from 'git+https://github.com/Softcatala/whisper-ctranslate2'
['/tmp/tmpfco18p9c/bin/python', '-m', 'pip', 'list', '--format=json']
$ source /tmp/tmpfco18p9c/bin/activate
(tmpfco18p9c) yumba:~ $ /tmp/tmpfco18p9c/bin/python -m pip list --format=json
/tmp/tmpfco18p9c/bin/python: No module named pip

Comment in pypa/pipx#1111 gives a hint that there might be a wrong version of python installed in the environment.

Since I don't have any virtualenvs right now I didn't mind running:

$ rm -rf ~/.local/pipx/

and then pipx install progressed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment