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

Improve error for failure to download package from pypi #125

Open
analog-cbarber opened this issue Jan 17, 2024 · 0 comments
Open

Improve error for failure to download package from pypi #125

analog-cbarber opened this issue Jan 17, 2024 · 0 comments
Assignees
Labels
component: convert enhancement New feature or request

Comments

@analog-cbarber
Copy link
Collaborator

If you use whl2conda convert with --from-pypi or --from-index, failures just give you an uninformative stack dump, e.g.

$ whl2conda convert --from-pypi numpy
Traceback (most recent call last):
  File "/Users/Christopher.Barber/miniconda3/bin/whl2conda", line 10, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/Christopher.Barber/miniconda3/lib/python3.11/site-packages/whl2conda/cli/main.py", line 91, in main
    subcmds.run(parsed)
  File "/Users/Christopher.Barber/miniconda3/lib/python3.11/site-packages/whl2conda/cli/common.py", line 233, in run
    parsed.main(parsed.args, prog=f'{self._parser.prog} {parsed.subcmd}')
  File "/Users/Christopher.Barber/miniconda3/lib/python3.11/site-packages/whl2conda/cli/common.py", line 221, in _main
    real_main(args, prog)
  File "/Users/Christopher.Barber/miniconda3/lib/python3.11/site-packages/whl2conda/cli/convert.py", line 475, in convert_main
    wheel_file = download_wheel(
                 ^^^^^^^^^^^^^^^
  File "/Users/Christopher.Barber/miniconda3/lib/python3.11/site-packages/whl2conda/impl/download.py", line 69, in download_wheel
    p = subprocess.run(cmd, check=True, stderr=subprocess.PIPE)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/Christopher.Barber/miniconda3/lib/python3.11/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['pip', 'download', '--only-binary', ':all:', '--no-deps', '--ignore-requires-python', '--implementation', 'py', '-d', '/Users/Christopher.Barber/tmp/whl2conda-download-hpfqnpms', 'numpy']' returned non-zero exit status 1.

In this case, the download fails because there is no pure python package for numpy, but you get the same error if there is not package with that name.

Instead we should report the download command along with stderr, e.g.:

Could not download `numpy` from pypi:

  ERROR: Could not find a version that satisfies the requirement implementation (from versions: none)
  ERROR: No matching distribution found for implementation

This could be because there is no pure python implementation
@analog-cbarber analog-cbarber self-assigned this Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: convert enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant