Get revision of VCS requirement failed when cached wheel is reused #349
Closed
Description
- I have searched the issue tracker and believe that this is not a duplicate.
Maybe this is an upstream bug of pip. And pdm locking part of the below steps behaves weirdly in bad networking condition. I will fire a new issue about this in a short time.
Steps to reproduce
- use pdm to initialize a new project
- add a git dependency
pdm add "git+https://github.com/python/mypy@effd970ad1e8bb09fd2a18634339e1d043a83400#egg=mypy" --dev
- run
pdm lock
Actual behavior
pdm lock
fails to run and outputs this
[BadCommand]: Cannot find command 'git' - do you have 'git' installed and in your PATH?
the detailed traceback
======== Start resolving requirements ========
mypy @ git+https://github.com/python/mypy@effd970ad1e8bb09fd2a18634339e1d043a83400
Adding requirement mypy @ git+https://github.com/python/mypy@effd970ad1e8bb09fd2a18634339e1d043a83400
Using cached wheel link: file:///Users/linw1995/Library/Caches/pdm/wheels/7f/86/0c/c911b94ddd61f7c9815e1cfe91ce087954b384fcbec43e3437/mypy-0.820%2Bdev.effd970ad1e8bb09fd2a18634339e1d043a83400-py3-none-any.whl
Adding requirement typed-ast<1.5.0,>=1.4.0(from mypy 0.820+dev.effd970ad1e8bb09fd2a18634339e1d043a83400)
Adding requirement typing-extensions>=3.7.4(from mypy 0.820+dev.effd970ad1e8bb09fd2a18634339e1d043a83400)
Adding requirement mypy-extensions<0.5.0,>=0.4.3(from mypy 0.820+dev.effd970ad1e8bb09fd2a18634339e1d043a83400)
Adding requirement types-typing-extensions>=3.7.0(from mypy 0.820+dev.effd970ad1e8bb09fd2a18634339e1d043a83400)
Adding requirement types-mypy-extensions>=0.4.0(from mypy 0.820+dev.effd970ad1e8bb09fd2a18634339e1d043a83400)
Adding requirement toml(from mypy 0.820+dev.effd970ad1e8bb09fd2a18634339e1d043a83400)
New pin: mypy 0.820+dev.effd970ad1e8bb09fd2a18634339e1d043a83400
======== Ending round 0 ========
New pin: mypy-extensions 0.4.3
======== Ending round 1 ========
New pin: types-typing-extensions 3.7.2
======== Ending round 2 ========
New pin: types-mypy-extensions 0.4.2
======== Ending round 3 ========
New pin: typing-extensions 3.7.4.3
======== Ending round 4 ========
New pin: toml 0.10.2
======== Ending round 5 ========
New pin: typed-ast 1.4.2
======== Ending round 6 ========
======== Resolution Result ========
Stable pins:
mypy 0.820+dev.effd970ad1e8bb09fd2a18634339e1d043a83400
mypy-extensions 0.4.3
types-typing-extensions 3.7.2
types-mypy-extensions 0.4.2
typing-extensions 3.7.4.3
toml 0.10.2
typed-ast 1.4.2
Error [Errno 2] No such file or directory: '/var/folders/h5/9g_q36ss4zn092x45_k1gx7w0000gn/T/pdm-buildgm7z5azg/mypy' while executing command git rev-parse HEAD
Error occurs
Traceback (most recent call last):
File "/Users/linw1995/.local/pipx/shared/lib/python3.9/site-packages/pip/_internal/vcs/versioncontrol.py", line 680, in run_command
return call_subprocess(cmd, show_stdout, cwd,
File "/Users/linw1995/.local/pipx/shared/lib/python3.9/site-packages/pip/_internal/utils/subprocess.py", line 181, in call_subprocess
proc = subprocess.Popen(
File "/usr/local/Cellar/python@3.9/3.9.1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 947, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/local/Cellar/python@3.9/3.9.1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 1819, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/var/folders/h5/9g_q36ss4zn092x45_k1gx7w0000gn/T/pdm-buildgm7z5azg/mypy'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/linw1995/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/termui.py", line 187, in logging
yield logger
File "/Users/linw1995/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/cli/actions.py", line 89, in do_lock
data = format_lockfile(mapping, dependencies, summaries)
File "/Users/linw1995/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/cli/utils.py", line 336, in format_lockfile
base.update(v.as_lockfile_entry())
File "/Users/linw1995/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/models/candidates.py", line 274, in as_lockfile_entry
result.update(revision=self.revision)
File "/usr/local/Cellar/python@3.9/3.9.1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/functools.py", line 969, in __get__
val = self.func(instance)
File "/Users/linw1995/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/models/candidates.py", line 141, in revision
return vcs.get_backend(self.req.vcs).get_revision(self.ireq.source_dir)
File "/Users/linw1995/.local/pipx/shared/lib/python3.9/site-packages/pip/_internal/vcs/git.py", line 362, in get_revision
current_rev = cls.run_command(
File "/Users/linw1995/.local/pipx/shared/lib/python3.9/site-packages/pip/_internal/vcs/versioncontrol.py", line 692, in run_command
raise BadCommand(
pip._internal.exceptions.BadCommand: Cannot find command 'git' - do you have 'git' installed and in your PATH?
Expected behavior
re-lock success
Environment Information
# Paste the output of `pdm info && pdm info --env` below:
PDM version: 1.4.4
Python Interpreter: /Users/linw1995/.pyenv/versions/3.9.0/bin/python3 (3.9.0)
Project Root: /private/tmp/pdm_test
{
"implementation_name": "cpython",
"implementation_version": "3.9.0",
"os_name": "posix",
"platform_machine": "x86_64",
"platform_release": "20.3.0",
"platform_system": "Darwin",
"platform_version": "Darwin Kernel Version 20.3.0: Thu Jan 21 00:07:06 PST 2021; root:xnu-7195.81.3~1/RELEASE_X86_64",
"python_full_version": "3.9.0",
"platform_python_implementaiton": "CPython",
"python_version": "3.9",
"sys_platform": "darwin"
}