{"id":"ec99aae741ee6566","repo":"pypa/pip","slug":"could-not-determine-editor-to-use","errorCode":null,"errorMessage":"Could not determine editor to use.","messagePattern":"Could not determine editor to use\\.","errorType":"exception","errorClass":"PipError","httpStatus":null,"severity":"error","filePath":"src/pip/_internal/commands/configuration.py","lineNumber":289,"sourceCode":"        # We successfully ran a modifying command. Need to save the\n        # configuration.\n        try:\n            self.configuration.save()\n        except Exception:\n            logger.exception(\n                \"Unable to save configuration. Please report this as a bug.\"\n            )\n            raise PipError(\"Internal Error.\")\n\n    def _determine_editor(self, options: Values) -> str:\n        if options.editor is not None:\n            return options.editor\n        elif \"VISUAL\" in os.environ:\n            return os.environ[\"VISUAL\"]\n        elif \"EDITOR\" in os.environ:\n            return os.environ[\"EDITOR\"]\n        else:\n            raise PipError(\"Could not determine editor to use.\")\n","sourceCodeStart":271,"sourceCodeEnd":290,"githubUrl":"https://github.com/pypa/pip/blob/d7d0d0a39494e28ec1c407bd0680e4a4d1067791/src/pip/_internal/commands/configuration.py#L271-L290","documentation":"Raised by ConfigurationCommand._determine_editor when no editor can be found: --editor was not passed, and neither VISUAL nor EDITOR is set in the environment (configuration.py:281-289). 'pip config edit' needs an editor to launch, so it aborts.","triggerScenarios":"Running 'pip config edit' (with no --editor) in a shell where VISUAL and EDITOR are both unset, e.g. a minimal container, a fresh CI runner, or an SSH session without a profile.","commonSituations":"Containers/CI images that ship no EDITOR default; non-interactive shells; stripped-down embedded Python; a user who never set a default editor.","solutions":["Set EDITOR (or VISUAL): export EDITOR=nano (or vim, code --wait, etc.).","Pass the editor inline: pip config edit --editor nano.","Add the export to your shell profile (~/.bashrc, ~/.zshrc) for persistence."],"exampleFix":"// before\npip config edit\n// after\npip config edit --editor nano","handlingStrategy":"validation","validationCode":"import os\nif not (editor_flag or os.environ.get(\"VISUAL\") or os.environ.get(\"EDITOR\")):\n    raise SystemExit(\"No editor: pass --editor or set VISUAL/EDITOR\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set EDITOR in your shell profile for persistence.","In containers/CI, pass --editor explicitly or set the env var."],"tags":["pip","config","cli","missing-environment","editor"],"analyzedSha":"d7d0d0a39494e28ec1c407bd0680e4a4d1067791","analyzedAt":"2026-08-04T20:55:04.259Z","schemaVersion":2}