python-wheel-build / fromager

Build your own wheels
https://pypi.org/project/fromager/
Apache License 2.0
3 stars 9 forks source link

No such file or directory: pypi-mirror #200

Open jaraco opened 1 month ago

jaraco commented 1 month ago

After installing fromager to a virtualenv and invoking it via Python launcher, it fails with "No such file or directory: pypi-mirror". It seems that fromager expects pypi-mirror to be on the executable search path:

 fromager 🐚 py -3.12 -m venv .venv
 fromager 🐚 py -m pip install -q fromager
 fromager 🐚 py -m fromager bootstrap requests
bootstrapping 'cpu' variant of [('toplevel', 'requests')]
[Errno 2] No such file or directory: 'pypi-mirror'
Traceback (most recent call last):
  File "/Users/jaraco/fromager/.venv/lib/python3.12/site-packages/fromager/__main__.py", line 156, in invoke_main
    main(auto_envvar_prefix="FROMAGER")
  File "/Users/jaraco/fromager/.venv/lib/python3.12/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jaraco/fromager/.venv/lib/python3.12/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/Users/jaraco/fromager/.venv/lib/python3.12/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jaraco/fromager/.venv/lib/python3.12/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jaraco/fromager/.venv/lib/python3.12/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jaraco/fromager/.venv/lib/python3.12/site-packages/click/decorators.py", line 45, in new_func
    return f(get_current_context().obj, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jaraco/fromager/.venv/lib/python3.12/site-packages/fromager/commands/bootstrap.py", line 60, in bootstrap
    server.start_wheel_server(wkctx)
  File "/Users/jaraco/fromager/.venv/lib/python3.12/site-packages/fromager/server.py", line 19, in start_wheel_server
    update_wheel_mirror(ctx)
  File "/Users/jaraco/fromager/.venv/lib/python3.12/site-packages/fromager/server.py", line 62, in update_wheel_mirror
    external_commands.run(
  File "/Users/jaraco/fromager/.venv/lib/python3.12/site-packages/fromager/external_commands.py", line 40, in run
    completed = subprocess.run(
                ^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.12/3.12.4/Frameworks/Python.framework/Versions/3.12/lib/python3.12/subprocess.py", line 548, in run
    with Popen(*popenargs, **kwargs) as process:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.12/3.12.4/Frameworks/Python.framework/Versions/3.12/lib/python3.12/subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/opt/homebrew/Cellar/python@3.12/3.12.4/Frameworks/Python.framework/Versions/3.12/lib/python3.12/subprocess.py", line 1955, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'pypi-mirror'
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/Users/jaraco/fromager/.venv/lib/python3.12/site-packages/fromager/__main__.py", line 163, in <module>
    invoke_main()
  File "/Users/jaraco/fromager/.venv/lib/python3.12/site-packages/fromager/__main__.py", line 156, in invoke_main
    main(auto_envvar_prefix="FROMAGER")
  File "/Users/jaraco/fromager/.venv/lib/python3.12/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jaraco/fromager/.venv/lib/python3.12/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/Users/jaraco/fromager/.venv/lib/python3.12/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jaraco/fromager/.venv/lib/python3.12/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jaraco/fromager/.venv/lib/python3.12/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jaraco/fromager/.venv/lib/python3.12/site-packages/click/decorators.py", line 45, in new_func
    return f(get_current_context().obj, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jaraco/fromager/.venv/lib/python3.12/site-packages/fromager/commands/bootstrap.py", line 60, in bootstrap
    server.start_wheel_server(wkctx)
  File "/Users/jaraco/fromager/.venv/lib/python3.12/site-packages/fromager/server.py", line 19, in start_wheel_server
    update_wheel_mirror(ctx)
  File "/Users/jaraco/fromager/.venv/lib/python3.12/site-packages/fromager/server.py", line 62, in update_wheel_mirror
    external_commands.run(
  File "/Users/jaraco/fromager/.venv/lib/python3.12/site-packages/fromager/external_commands.py", line 40, in run
    completed = subprocess.run(
                ^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.12/3.12.4/Frameworks/Python.framework/Versions/3.12/lib/python3.12/subprocess.py", line 548, in run
    with Popen(*popenargs, **kwargs) as process:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.12/3.12.4/Frameworks/Python.framework/Versions/3.12/lib/python3.12/subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/opt/homebrew/Cellar/python@3.12/3.12.4/Frameworks/Python.framework/Versions/3.12/lib/python3.12/subprocess.py", line 1955, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'pypi-mirror'

Activating the virtualenv works around the issue.

It would be more reliable if the mirror were invoked as {sys.executable} -m pypi_mirror.