{"record":{"id":"7872a4d1645055a1","repo":"PrefectHQ/fastmcp","slug":"uv-is-not-installed-please-install-it-with-curl","errorCode":null,"errorMessage":"uv is not installed. Please install it with: curl -LsSf https://astral.sh/uv/install.sh | sh","messagePattern":"uv is not installed\\. Please install it with: curl -LsSf https://astral\\.sh/uv/install\\.sh \\| sh","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"critical","filePath":"fastmcp_slim/fastmcp/utilities/mcp_server_config/v1/environments/uv.py","lineNumber":119,"sourceCode":"                self.python is not None,\n                self.dependencies is not None,\n                self.requirements is not None,\n                self.project is not None,\n                self.editable is not None,\n            ]\n        )\n\n    async def prepare(self, output_dir: Path | None = None) -> None:\n        \"\"\"Prepare the Python environment using uv.\n\n        Args:\n            output_dir: Directory where the persistent uv project will be created.\n                       If None, creates a temporary directory for ephemeral use.\n        \"\"\"\n\n        # Check if uv is available\n        if not shutil.which(\"uv\"):\n            raise RuntimeError(\n                \"uv is not installed. Please install it with: \"\n                \"curl -LsSf https://astral.sh/uv/install.sh | sh\"\n            )\n\n        # Only prepare environment if there are actual settings to apply\n        if not self._must_run_with_uv():\n            logger.debug(\"No environment settings configured, skipping preparation\")\n            return\n\n        # Handle None case for ephemeral use\n        if output_dir is None:\n            import tempfile\n\n            output_dir = Path(tempfile.mkdtemp(prefix=\"fastmcp-env-\"))\n            logger.info(f\"Creating ephemeral environment in {output_dir}\")\n        else:\n            logger.info(f\"Creating persistent environment in {output_dir}\")\n            output_dir = Path(output_dir).resolve()","sourceCodeStart":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/PrefectHQ/fastmcp/blob/1f021142978e0861cd910c8df4e8074bc7cf3978/fastmcp_slim/fastmcp/utilities/mcp_server_config/v1/environments/uv.py#L101-L137","documentation":"The UV environment manager shells out to the `uv` CLI to create/sync the project environment. If `uv` is not on PATH (`shutil.which('uv')` fails), `prepare()` raises RuntimeError with install instructions rather than failing obscurely later in a subprocess.","triggerScenarios":"Running an `fastmcp` config workflow (e.g. `fastmcp run`/deploy with a uv environment) on a machine where uv was never installed, or where PATH does not include ~/.local/bin or the uv install location.","commonSituations":"Fresh CI containers/VMs, Docker images without uv, installing uv as a non-root user whose bin dir is not on PATH in the execution environment, venvs created before uv install.","solutions":["Install uv: `curl -LsSf https://astral.sh/uv/install.sh | sh` (or `pip install uv`).","Ensure the uv binary directory is on PATH for the process running FastMCP (`export PATH=\"$HOME/.local/bin:$PATH\"`).","In Docker/CI, add an official uv install layer (e.g. `ghcr.io/astral-sh/uv`) before running the command.","Verify with `which uv` / `uv --version` in the same shell that runs the app."],"exampleFix":"// before (Dockerfile)\nRUN pip install fastmcp\nCMD [\"fastmcp\", \"run\", \"server.py\"]\n// after\nRUN pip install fastmcp\nRUN curl -LsSf https://astral.sh/uv/install.sh | sh\nENV PATH=\"/root/.local/bin:${PATH}\"\nCMD [\"fastmcp\", \"run\", \"server.py\"]","handlingStrategy":"validation","validationCode":"import shutil\nif not shutil.which('uv'):\n    raise SystemExit('uv is not installed. Install: curl -LsSf https://astral.sh/uv/install.sh | sh')","typeGuard":null,"tryCatchPattern":"try:\n    env.prepare(output_dir=dir)\nexcept RuntimeError as e:\n    if 'uv is not installed' in str(e):\n        subprocess.run(['pip', 'install', 'uv'], check=True)\n        env.prepare(output_dir=dir)\n    else:\n        raise","preventionTips":["Install uv in Docker/CI images before running fastmcp commands","Add ~/.local/bin to PATH in deployment scripts","Run `uv --version` as a CI preflight step"],"tags":["environment","uv","missing-dependency","deployment"],"backgroundTag":"missing-dependency","analyzedSha":"1f021142978e0861cd910c8df4e8074bc7cf3978","analyzedAt":"2026-08-29T14:31:16.082Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}