Repository: iterative/dvc

Issue:
dvc install --use-pre-commit: dulwhich update breaks pre-commit 
# Bug Report

## Description

Last update of dulwich breaks dvc pre-commit installation.

### Reproduce

This the pre-commit config: 
```
repos:
  - repo: https://github.com/iterative/dvc
    rev: 2.0.5
    hooks:
      - id: dvc-pre-commit
        language_version: python3
        stages:
          - commit
      - always_run: true
        id: dvc-post-checkout
        language_version: python3
        stages:
          - post-checkout
```
(Note that rev tag might not be working properly) 

1. pip install pre-commit
2. pre-commit install
3. pre-commit run


### Expected

Succesfull dvc installation

### Environment information

```
root@e0116f15f272:/# dvc doctor
DVC version: 2.1.0 (conda)
---------------------------------
Platform: Python 3.7.10 on Linux-5.8.0-50-generic-x86_64-with-debian-buster-sid
Supports: http, https
```


**Additional Information (if any):**
```
  building 'dulwich._objects' extension
        creating build/temp.linux-x86_64-3.7
        creating build/temp.linux-x86_64-3.7/dulwich
        gcc -pthread -B /opt/conda/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/root/.cache/pre-commit/repostczxm03/py_env-python3/include -I/opt/conda/include/python3.7m -c dulwich/_objects.c -o build/temp.linux-x86_64-3.7/dulwich/_objects.o
        dulwich/_objects.c:22:10: fatal error: Python.h: No such file or directory
         #include <Python.h>
                  ^~~~~~~~~~
        compilation terminated.
        error: command 'gcc' failed with exit status 1
        ----------------------------------------
    ERROR: Command errored out with exit status 1: /root/.cache/pre-commit/repostczxm03/py_env-python3/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-fm2ivm8d/dulwich_79620e174c28465ca5a9c88dbcd337d6/setup.py'"'"'; __file__='"'"'/tmp/pip-install-fm2ivm8d/dulwich_79620e174c28465ca5a9c88dbcd337d6/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-5oqbd1rx/install-record.txt --single-version-externally-managed --compile --install-headers /root/.cache/pre-commit/repostczxm03/py_env-python3/include/site/python3.7/dulwich Check the logs for full command output.
```    

This can be fixed by adding the option `--pure` (if necessary) to dulwich installation (more info on Installation section [here](https://github.com/dulwich/dulwich))


Discussion:
Looks like only windows wheels got uploaded for the latest version. https://github.com/dulwich/dulwich/actions/runs/869690633 , this needs to be fixed on dulwich side. For now you could try installing dvc 2.1.0 specifically in your pre-commit hook.
Good catch there, did not realize about that :+1:
I have tried to install version 2.0.5 using the rev tag but with no success, it seems to be downloading latest version.
```
repos:
  - repo: https://github.com/iterative/dvc
    rev: 2.0.5
```


Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -51,7 +51,7 @@ def run(self):
     "colorama>=0.3.9",
     "configobj>=5.0.6",
     "gitpython>3",
-    "dulwich>=0.20.22",
+    "dulwich>=0.20.23",
     "pygit2>=1.5.0",
     "setuptools>=34.0.0",
     "nanotime>=0.5.2",


Test patch: