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.

Make pip gracefully detect git servers that don't support `--filter=blob:none`

See original GitHub issue

Description

This behaviour is observed since pip version 21.3 which has the changes for (#9086)

The change introduces the addition of the --filter=blob:none option for git clone when installing a pip package from a git repo. As a result of the change, the repo package that I’m trying to install errors out with the following signature

(fast2) ➜  ~ pip install zcsdgapi@git+https://bitbucket.corp.zscaler.com/scm/eio/zcsdgapi.git
Collecting zcsdgapi@ git+https://bitbucket.corp.zscaler.com/scm/eio/zcsdgapi.git
  Cloning https://bitbucket.corp.zscaler.com/scm/eio/zcsdgapi.git to /private/var/folders/z5/f81ktg8d5ng_pskb9wg2q4qr0000gn/T/pip-install-_jsv_zuz/zcsdgapi_e5a7fb3aae9d4eef9d8d91c42547d486
  Running command git clone --filter=blob:none -q https://bitbucket.corp.zscaler.com/scm/eio/zcsdgapi.git /private/var/folders/z5/f81ktg8d5ng_pskb9wg2q4qr0000gn/T/pip-install-_jsv_zuz/zcsdgapi_e5a7fb3aae9d4eef9d8d91c42547d486
  fatal: bad revision '43995bd42fa23bbc4c3a59d5fb9da99042fcf139'
  error: https://bitbucket.corp.zscaler.com/scm/eio/zcsdgapi.git did not send all necessary objects

  fatal: bad revision '43995bd42fa23bbc4c3a59d5fb9da99042fcf139'
  error: https://bitbucket.corp.zscaler.com/scm/eio/zcsdgapi.git did not send all necessary objects

The problem is reproduced on a mac terminal and ubuntu terminal , git versions are OSX

(fast2) ➜  ~ git --version
git version 2.32.0 (Apple Git-132)
(fast2) ➜  ~ and 

UBUNTU

$ git --version
git version 2.25.1

The complete workflow I performed is attached below. When trying with pip version 21.2.4 the install works correctly, when attempting with 21.3 it fails and the git clone command can be seen with the filter=blob:none flags set.

(fast2) ➜  ~ pip install --upgrade pip==21.2.4
Collecting pip==21.2.4
  Using cached pip-21.2.4-py3-none-any.whl (1.6 MB)
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 21.2.3
    Uninstalling pip-21.2.3:
      Successfully uninstalled pip-21.2.3
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
fast 22.4.15 requires zcsdgapi@ git+https://bitbucket.corp.zscaler.com/scm/eio/zcsdgapi.git, which is not installed.
Successfully installed pip-21.2.4
(fast2) ➜  ~ pip install zcsdgapi@git+https://bitbucket.corp.zscaler.com/scm/eio/zcsdgapi.git
Collecting zcsdgapi@ git+https://bitbucket.corp.zscaler.com/scm/eio/zcsdgapi.git
  Cloning https://bitbucket.corp.zscaler.com/scm/eio/zcsdgapi.git to /private/var/folders/z5/f81ktg8d5ng_pskb9wg2q4qr0000gn/T/pip-install-nir9f8fj/zcsdgapi_77ada8a7032f41c0a49a2ffb2cf02c19
  Running command git clone -q https://bitbucket.corp.zscaler.com/scm/eio/zcsdgapi.git /private/var/folders/z5/f81ktg8d5ng_pskb9wg2q4qr0000gn/T/pip-install-nir9f8fj/zcsdgapi_77ada8a7032f41c0a49a2ffb2cf02c19
  Resolved https://bitbucket.corp.zscaler.com/scm/eio/zcsdgapi.git to commit 26390c3b0eb26c94a8702af9d2a734faba4bcd8d
Requirement already satisfied: urllib3>=1.15 in ./.pyenv/versions/3.10.0/envs/fast2/lib/python3.10/site-packages (from zcsdgapi@ git+https://bitbucket.corp.zscaler.com/scm/eio/zcsdgapi.git) (1.26.9)
Requirement already satisfied: six>=1.10 in ./.pyenv/versions/3.10.0/envs/fast2/lib/python3.10/site-packages (from zcsdgapi@ git+https://bitbucket.corp.zscaler.com/scm/eio/zcsdgapi.git) (1.16.0)
Requirement already satisfied: certifi in ./.pyenv/versions/3.10.0/envs/fast2/lib/python3.10/site-packages (from zcsdgapi@ git+https://bitbucket.corp.zscaler.com/scm/eio/zcsdgapi.git) (2021.10.8)
Requirement already satisfied: python-dateutil in ./.pyenv/versions/3.10.0/envs/fast2/lib/python3.10/site-packages (from zcsdgapi@ git+https://bitbucket.corp.zscaler.com/scm/eio/zcsdgapi.git) (2.8.2)
Using legacy 'setup.py install' for zcsdgapi, since package 'wheel' is not installed.
Installing collected packages: zcsdgapi
    Running setup.py install for zcsdgapi ... done
Successfully installed zcsdgapi-6.1.0
WARNING: You are using pip version 21.2.4; however, version 22.0.4 is available.
You should consider upgrading via the '/Users/achari/.pyenv/versions/3.10.0/envs/fast2/bin/python3.10 -m pip install --upgrade pip' command.
(fast2) ➜  ~ pip uninstall zcsdgapi
Found existing installation: zcsdgapi 6.1.0
Uninstalling zcsdgapi-6.1.0:
  Would remove:
    /Users/achari/.pyenv/versions/3.10.0/envs/fast2/lib/python3.10/site-packages/zcsdgapi-6.1.0-py3.10.egg-info
    /Users/achari/.pyenv/versions/3.10.0/envs/fast2/lib/python3.10/site-packages/zcsdgapi/*
Proceed (Y/n)? Y
  Successfully uninstalled zcsdgapi-6.1.0
(fast2) ➜  ~ pip install --upgrade pip==21.3
Collecting pip==21.3
  Using cached pip-21.3-py3-none-any.whl (1.7 MB)
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 21.2.4
    Uninstalling pip-21.2.4:
      Successfully uninstalled pip-21.2.4
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
fast 22.4.15 requires zcsdgapi@ git+https://bitbucket.corp.zscaler.com/scm/eio/zcsdgapi.git, which is not installed.
Successfully installed pip-21.3
(fast2) ➜  ~ pip install zcsdgapi@git+https://bitbucket.corp.zscaler.com/scm/eio/zcsdgapi.git
Collecting zcsdgapi@ git+https://bitbucket.corp.zscaler.com/scm/eio/zcsdgapi.git
  Cloning https://bitbucket.corp.zscaler.com/scm/eio/zcsdgapi.git to /private/var/folders/z5/f81ktg8d5ng_pskb9wg2q4qr0000gn/T/pip-install-_jsv_zuz/zcsdgapi_e5a7fb3aae9d4eef9d8d91c42547d486
  Running command git clone --filter=blob:none -q https://bitbucket.corp.zscaler.com/scm/eio/zcsdgapi.git /private/var/folders/z5/f81ktg8d5ng_pskb9wg2q4qr0000gn/T/pip-install-_jsv_zuz/zcsdgapi_e5a7fb3aae9d4eef9d8d91c42547d486
  fatal: bad revision '43995bd42fa23bbc4c3a59d5fb9da99042fcf139'
  error: https://bitbucket.corp.zscaler.com/scm/eio/zcsdgapi.git did not send all necessary objects

  fatal: bad revision '43995bd42fa23bbc4c3a59d5fb9da99042fcf139'
  error: https://bitbucket.corp.zscaler.com/scm/eio/zcsdgapi.git did not send all necessary objects

Expected behavior

pip install package from a git repo is expected to work as it did before pip version 21.3 and install the package successfully.

pip version

21.3

Python version

3.8, 3.9 and 3.10.0

OS

Mac OS and Ubuntu, docker python3.8:latest

How to Reproduce

  1. Install python3.8 and higher and pip version 21.3 and higher
  2. Install a package from a git repo (dont know if there are server side settings required to get this reproduced as we dont have access to the server settings we are installing from)
  3. the fatal error seen as below

The complete workflow I performed is attached below. When trying with pip version 21.2.4 the install works correctly, when attempting with 21.3 it fails and the git clone command can be seen with the filter=blob:none flags set.

Output

(fast2) ➜  ~ pip install --upgrade pip==21.3
Collecting pip==21.3
  Using cached pip-21.3-py3-none-any.whl (1.7 MB)
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 21.2.4
    Uninstalling pip-21.2.4:
      Successfully uninstalled pip-21.2.4
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
fast 22.4.15 requires zcsdgapi@ git+https://bitbucket.corp.zscaler.com/scm/eio/zcsdgapi.git, which is not installed.
Successfully installed pip-21.3
(fast2) ➜  ~ pip install zcsdgapi@git+https://bitbucket.corp.zscaler.com/scm/eio/zcsdgapi.git
Collecting zcsdgapi@ git+https://bitbucket.corp.zscaler.com/scm/eio/zcsdgapi.git
  Cloning https://bitbucket.corp.zscaler.com/scm/eio/zcsdgapi.git to /private/var/folders/z5/f81ktg8d5ng_pskb9wg2q4qr0000gn/T/pip-install-_jsv_zuz/zcsdgapi_e5a7fb3aae9d4eef9d8d91c42547d486
  Running command git clone --filter=blob:none -q https://bitbucket.corp.zscaler.com/scm/eio/zcsdgapi.git /private/var/folders/z5/f81ktg8d5ng_pskb9wg2q4qr0000gn/T/pip-install-_jsv_zuz/zcsdgapi_e5a7fb3aae9d4eef9d8d91c42547d486
  fatal: bad revision '43995bd42fa23bbc4c3a59d5fb9da99042fcf139'
  error: https://bitbucket.corp.zscaler.com/scm/eio/zcsdgapi.git did not send all necessary objects

  fatal: bad revision '43995bd42fa23bbc4c3a59d5fb9da99042fcf139'
  error: https://bitbucket.corp.zscaler.com/scm/eio/zcsdgapi.git did not send all necessary objects

Code of Conduct

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
pradyunsgcommented, May 3, 2022

Since the folks affected by this are likely institutional users with an internal source control deployment, I’ll note that you’re welcome to file PRs against pip to improve things for this usecase. If there’s some way for pip to gracefully detect this, based on whether the server supports this feature, we’d be happy to accept a PR for it – assuming we don’t degrade the experience for users who have a new-enough git and are using a new-enough server instance (eg: github.com).

0reactions
KalleDKcommented, May 3, 2022

I ran into the same problem, and would really like for the combability, as I have no say in the server’s version / settings. The solution right now (for me) is downgrade git to get the other branch. Autodetect would be nice, but for my cases a simple switch would be more than enough.

Read more comments on GitHub >

github_iconTop Results From Across the Web

git - pip install from a gitosis
I would rather use the ssh uri syntax (rather than the SCP syntax) git clone git+ssh://git@server/repo.git.
Read more >
PIP Install Git - A quick read
Git Installation. Before installing Git, you should first determine whether you have it installed by running the following git command: git -- ...
Read more >
'pip install' From a Git Repository - Adam Johnson
Installing via Git. Pip can speak git to do this through its Version Control System (VCS) Support. (Git is one version control system.) ......
Read more >
jupyterlab-git
jupyter server extension list jupyter labextension list. If they do not match or one is missing, please reinstall the package. the Git panel...
Read more >
Installing Private Python Packages
Pip supports installing packages from a Git repository using the URI form: ... Check the GitHub documentation on how to create a personal...
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