{"id":"ec04ed2af76ef97c","repo":"pypa/pip","slug":"cannot-find-command-cls-name-r-do-you-have-cl","errorCode":null,"errorMessage":"Cannot find command {cls.name!r} - do you have {cls.name!r} installed and in your PATH?","messagePattern":"Cannot find command (.+?) - do you have (.+?) installed and in your PATH\\?","errorType":"exception","errorClass":"BadCommand","httpStatus":null,"severity":"error","filePath":"src/pip/_internal/vcs/versioncontrol.py","lineNumber":655,"sourceCode":"            return call_subprocess(\n                cmd,\n                show_stdout,\n                cwd,\n                on_returncode=on_returncode,\n                extra_ok_returncodes=extra_ok_returncodes,\n                command_desc=command_desc,\n                extra_environ=extra_environ,\n                unset_environ=cls.unset_environ,\n                spinner=spinner,\n                log_failed_cmd=log_failed_cmd,\n                stdout_only=stdout_only,\n            )\n        except NotADirectoryError:\n            raise BadCommand(f\"Cannot find command {cls.name!r} - invalid PATH\")\n        except FileNotFoundError:\n            # errno.ENOENT = no such file or directory\n            # In other words, the VCS executable isn't available\n            raise BadCommand(\n                f\"Cannot find command {cls.name!r} - do you have \"\n                f\"{cls.name!r} installed and in your PATH?\"\n            )\n        except PermissionError:\n            # errno.EACCES = Permission denied\n            # This error occurs, for instance, when the command is installed\n            # only for another user. So, the current user don't have\n            # permission to call the other user command.\n            raise BadCommand(\n                f\"No permission to execute {cls.name!r} - install it \"\n                f\"locally, globally (ask admin), or check your PATH. \"\n                f\"See possible solutions at \"\n                f\"https://pip.pypa.io/en/latest/reference/pip_freeze/\"\n                f\"#fixing-permission-denied.\"\n            )\n\n    @classmethod\n    def is_repository_directory(cls, path: str) -> bool:","sourceCodeStart":637,"sourceCodeEnd":673,"githubUrl":"https://github.com/pypa/pip/blob/d7d0d0a39494e28ec1c407bd0680e4a4d1067791/src/pip/_internal/vcs/versioncontrol.py#L637-L673","documentation":"Raised by `VCS.run_command` when spawning the VCS executable raises `FileNotFoundError` (ENOENT) — the executable is simply not installed or not on PATH. pip re-raises it as `BadCommand` with an install hint, since without the VCS binary no clone/checkout can proceed.","triggerScenarios":"Any pip install/freeze operation against a `git+`/`svn+`/`hg+`/`bzr+` URL when the corresponding `git`/`svn`/`hg`/`bzr` binary cannot be found by the OS via PATH lookup.","commonSituations":"Minimal Docker/CI images that omit git/svn; fresh OS installs without dev tools; relying on a virtualenv that does not provide system VCS binaries; SSH-ing into a server where the VCS is only installed for a different user.","solutions":["Install the missing VCS tool: `apt-get install git` / `yum install subversion` / `brew install mercurial`.","Verify with `which git` (or `svn`, `hg`, `bzr`) that the binary resolves on PATH.","If installed but not found, add its directory to PATH (e.g. `/usr/local/bin`, `/opt/homebrew/bin`).","In Docker/CI, add the VCS package to the image build."],"exampleFix":"# before (in Dockerfile)\nRUN pip install git+https://github.com/org/repo.git\n# -> FileNotFoundError -> BadCommand\n\n# after\nRUN apt-get update && apt-get install -y git \\\n && pip install git+https://github.com/org/repo.git","handlingStrategy":"validation","validationCode":"import shutil, sys\n\ndef ensure_vcs_available(name: str) -> None:\n    if shutil.which(name) is None:\n        raise EnvironmentError(\n            f\"{name!r} not found on PATH; install it (e.g. apt-get install {name})\"\n        )\n\n# before any pip VCS op:\nensure_vcs_available(\"git\")","typeGuard":"null","tryCatchPattern":"from pip._internal.exceptions import BadCommand\ntry:\n    pip_api_call(...)\nexcept BadCommand as e:\n    # prompt user to install the missing VCS\n    ...","preventionTips":["In Docker/CI images, install the VCS binary you intend to `pip install` from.","Assert `shutil.which('git')` is set at the start of CI.","Document required system packages alongside Python deps."],"tags":["vcs","missing-dependency","environment","path"],"analyzedSha":"d7d0d0a39494e28ec1c407bd0680e4a4d1067791","analyzedAt":"2026-08-04T20:55:04.259Z","schemaVersion":2}