question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Minor: Undefined behavior leads to confusing error with --index-url arg.

See original GitHub issue

Environment

  • pip version: 19.2.3
  • Python version: 3.8
  • OS: Arch Linux

I do not believe this is limited to arch, but it was discovered as such here: https://github.com/SalomonSmeke/rere/issues/5

note: as pointed out by @uranusjr below this is partially fixed in 19.3

Description

A very minor problem, borderline not a bug but simply less than ideal behavior. When using a --index-url with pip install, passing something other than a url causes a confusing error.

This can manifest like in the issue above: pip install --index-url --user https://test.pypi.org/simple/ reretrieve when trying to:
pip install --user --index-url https://test.pypi.org/simple/ reretrieve

Expected behavior

An error about how the index url is invalid, not found, or otherwise messed up.

How to Reproduce

  1. pip install --index-url --user https://test.pypi.org/simple/ reretrieve

Output

$ pip install --index-url --user https://test.pypi.org/simple/ reretrieve
Looking in indexes: --user
Collecting https://test.pypi.org/simple/
  Using cached https://test.pypi.org/simple/
  ERROR: Cannot unpack file /tmp/pip-unpack-w9t0tixn/simple (downloaded from /tmp/pip-req-build-s5ub6ixa, content-type: text/html; charset=UTF-8); cannot detect archive format
ERROR: Cannot determine archive format of /tmp/pip-req-build-s5ub6ixa.

note: as pointed out by @uranusjr below in 19.3 the output will look a little different.

Edit

I just wanted to clarify that this happens with any bad text input/invalid url, not just --user and such.

$ pip install --index-url foo  https://test.pypi.org/simple/ reretrieve
Looking in indexes: foo
Collecting https://test.pypi.org/simple/
  Using cached https://test.pypi.org/simple/
  ERROR: Cannot unpack file /tmp/pip-unpack-160ive4r/simple (downloaded from /tmp/pip-req-build-8dw7kt5w, content-type: text/html; charset=UTF-8); cannot detect archive format
ERROR: Cannot determine archive format of /tmp/pip-req-build-8dw7kt5w

I dont blame you if you decide to wontfix this one, but wanted to make sure it was an intentional decision. thank you in advance for taking a look!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
chrahuntcommented, Dec 8, 2019

I’m +1 on mentioning --index-url in the warning message, assuming it doesn’t make a mess in the code.

People can have --index-url and --extra-index-url in requirements.txt which may point to directories that don’t always exist, so I would be wary of turning this into a hard failure.

1reaction
deveshkscommented, Apr 2, 2020

Thanks @uranusjr , I have created a PR considering one possible approach. Please take a look 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using pip with two --extra-index-url arguments that both point ...
Apparently this is a bug in pip. The HTTP basic auth information is not stored correctly when specifying multiple --extra-index-url s that ...
Read more >
Vulnerability report for Docker puckel/docker-airflow:1.8.2 | Snyk
Malformed input may lead to crashes (with a buffer overflow or other memory corruption) or other unspecified behaviors. This crosses a privilege boundary...
Read more >
pipenv Documentation - Read the Docs
Pipenv is a tool that aims to bring the best of all packaging worlds (bundler, composer, npm, cargo, yarn, etc.) to the. Python...
Read more >
Changelog - pip documentation v21.1.dev0
Trace a better error message on installation failure due to invalid .data ... Its current behaviour is confusing and breaks in case different...
Read more >
Release 0.19.1 unknown - Pyodide
let pyodide = await loadPyodide({ indexURL ... global variables and functions from Python. ... this data may lead to undefined behavior.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found