jbang icon indicating copy to clipboard operation
jbang copied to clipboard

pipx run issue on Windows

Open quintesse opened this issue 6 months ago • 1 comments

Discussed in https://github.com/orgs/jbangdev/discussions/2027

Originally posted by koppor May 20, 2025 I try to run jbang on Windows using pipx. Errors with FileNotFoundError: [WinError 2] The system cannot find the file specified. What can I do?

> pipx run jbang jabkit@jabref
⚠️  jbang is already on your PATH and installed at C:\ProgramData\chocolatey\bin\jbang.EXE. Downloading and running anyway.
NOTE: running app 'jbang-python.exe' from 'jbang'
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\koppor\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\Scripts\pipx.exe\__main__.py", line 7, in <module>
  File "C:\Users\koppor\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\pipx\main.py", line 1176, in cli
    return run_pipx_command(parsed_pipx_args, subparsers)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\koppor\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\pipx\main.py", line 267, in run_pipx_command
    commands.run(
  File "C:\Users\koppor\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\pipx\commands\run.py", line 206, in run
    run_package(
  File "C:\Users\koppor\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\pipx\commands\run.py", line 163, in run_package
    _download_and_run(
  File "C:\Users\koppor\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\pipx\commands\run.py", line 278, in _download_and_run
    venv.run_app(app, app_filename, app_args)
  File "C:\Users\koppor\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\pipx\venv.py", line 421, in run_app
    exec_app([str(self.bin_path / filename)] + app_args)
  File "C:\Users\koppor\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\pipx\util.py", line 379, in exec_app
    subprocess.run(
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.2800.0_x64__qbz5n2kfra8p0\Lib\subprocess.py", line 548, in run
    with Popen(*popenargs, **kwargs) as process:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.2800.0_x64__qbz5n2kfra8p0\Lib\subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.2800.0_x64__qbz5n2kfra8p0\Lib\subprocess.py", line 1538, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [WinError 2] The system cannot find the file specified
```</div>

quintesse avatar May 20 '25 10:05 quintesse

Hmm...interesting. Not sure how to fix that to be honest. It's pipx itself doing this because there is another jbang command in env...

maxandersen avatar May 25 '25 06:05 maxandersen

The output just says "Downloading and running anyway."

However, instead of running, there is a

FileNotFoundError: [WinError 2] The system cannot find the file specified

The output does not state from where pipx is downloading etc.

koppor avatar Jul 04 '25 08:07 koppor