pypa/pip · error · BadCommand
No permission to execute {cls.name!r} - install it locally,
Error message
No permission to execute {cls.name!r} - install it locally, globally (ask admin), or check your PATH. See possible solutions at https://pip.pypa.io/en/latest/reference/pip_freeze/#fixing-permission-denied. What it means
Raised by `VCS.run_command` when executing the VCS binary raises `PermissionError` (EACCES) — the file exists but the current user lacks execute permission on it. Common when a tool is installed for a different user or the binary's mode bits forbid execution. pip wraps it as `BadCommand` and links the pip docs on fixing permission-denied.
Source
Thrown at src/pip/_internal/vcs/versioncontrol.py:664
spinner=spinner,
log_failed_cmd=log_failed_cmd,
stdout_only=stdout_only,
)
except NotADirectoryError:
raise BadCommand(f"Cannot find command {cls.name!r} - invalid PATH")
except FileNotFoundError:
# errno.ENOENT = no such file or directory
# In other words, the VCS executable isn't available
raise BadCommand(
f"Cannot find command {cls.name!r} - do you have "
f"{cls.name!r} installed and in your PATH?"
)
except PermissionError:
# errno.EACCES = Permission denied
# This error occurs, for instance, when the command is installed
# only for another user. So, the current user don't have
# permission to call the other user command.
raise BadCommand(
f"No permission to execute {cls.name!r} - install it "
f"locally, globally (ask admin), or check your PATH. "
f"See possible solutions at "
f"https://pip.pypa.io/en/latest/reference/pip_freeze/"
f"#fixing-permission-denied."
)
@classmethod
def is_repository_directory(cls, path: str) -> bool:
"""
Return whether a directory path is a repository directory.
"""
logger.debug("Checking in %s for %s (%s)...", path, cls.dirname, cls.name)
return os.path.exists(os.path.join(path, cls.dirname))
@classmethod
def get_repository_root(cls, location: str) -> str | None:
"""View on GitHub (pinned to d7d0d0a394)
Solutions
- Run `chmod +x $(which git)` (or `svn`/`hg`/`bzr`) to restore the execute bit.
- Reinstall the VCS tool for the current user, or system-wide via the package manager so permissions are correct.
- If you lack admin rights, install a local user copy (e.g. via conda/homebrew user install) and prepend its bin to PATH.
- Check parent directory permissions do not block traversal to the binary.
Example fix
# before $ pip install git+https://github.com/org/repo.git -> BadCommand: No permission to execute 'git' # after $ sudo chmod +x $(which git) $ pip install git+https://github.com/org/repo.git
Defensive patterns
Strategy: validation
Validate before calling
import os, shutil, stat
def ensure_vcs_executable(name: str) -> None:
path = shutil.which(name)
if path is None:
raise EnvironmentError(f"{name!r} not on PATH")
if not os.access(path, os.X_OK):
raise PermissionError(f"{path} is not executable by current user") Type guard
null
Try / catch
from pip._internal.exceptions import BadCommand
try:
pip_api_call(...)
except BadCommand as e:
if "No permission to execute" in str(e):
# chmod/reinstall path
... Prevention
- Install VCS tools via package manager so exec bits are correct.
- Avoid copying binaries without preserving mode bits (`cp -p`).
- On shared hosts, install a user-local copy if you lack sudo.
When it happens
Trigger: `call_subprocess` raises `PermissionError` while spawning `git`/`svn`/`hg`/`bzr`. The executable is present on PATH but its filesystem permissions (or a parent directory's) deny the current user the x-bit.
Common situations: A shared server where git was installed by another user with mode 0700; a broken `chmod` that stripped execute bits; running pip as a different uid than the one that owns the binary; containers where binaries were copied without preserving exec permissions.
Related errors
- venv-creation-error
- An error occurred while writing to the configuration file {f
- Error reading {path}: {e}
- Cannot find command {cls.name!r} - invalid PATH
- Cannot find command {cls.name!r} - do you have {cls.name!r}
AI-assisted analysis of pypa/pip@d7d0d0a394 (2026-08-04).
Data as JSON: /data/errors/e47f6263aebbbf40.json.
Report an issue: GitHub.