{"record":{"id":"e9a0c85db789e742","repo":"huggingface/open-r1","slug":"required-morphcloud-dependencies-not-installed-e","errorCode":null,"errorMessage":"Required MorphCloud dependencies not installed: {e}","messagePattern":"Required MorphCloud dependencies not installed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/open_r1/utils/code_providers.py","lineNumber":209,"sourceCode":"\n        self.num_parallel = num_parallel\n        self.morph_router_url = morph_router_url\n\n        if self.morph_router_url is not None:\n            self.routed_sandbox = RoutedMorphSandbox(router_url=self.morph_router_url)\n            return\n\n        import os\n\n        self.api_key = os.getenv(\"MORPH_API_KEY\")\n        if not self.api_key:\n            raise ValueError(\"MorphCloud API key not found. Please set the MORPH_API_KEY environment variable.\")\n\n        try:\n            self.client = MorphCloudClient(api_key=self.api_key)\n            self.Sandbox = Sandbox\n        except ImportError as e:\n            raise ImportError(f\"Required MorphCloud dependencies not installed: {e}\")\n\n    def execute_scripts(self, scripts: List[str], languages: List[str]) -> List[float]:\n        \"\"\"Execute scripts using MorphCloud Sandbox API.\n\n        Args:\n            scripts: List of Python scripts to execute\n            language: Programming language\n\n        Returns:\n            List of float rewards (one per script)\n        \"\"\"\n\n        if hasattr(self, \"routed_sandbox\"):\n            try:\n                results = self.routed_sandbox.run_code(\n                    scripts=scripts,\n                    languages=languages,\n                    timeout=90,","sourceCodeStart":191,"sourceCodeEnd":227,"githubUrl":"https://github.com/huggingface/open-r1/blob/1416fa0cf21595d2083b399a2a0bbddd7f6e9563/src/open_r1/utils/code_providers.py#L191-L227","documentation":"This ImportError wraps an ImportError raised while constructing MorphCloudClient or binding the Sandbox class inside MorphProvider.__init__. The original exception message is interpolated into `{e}`, so it means morphcloud's own internal dependencies (or a partial install) are broken even though the top-level import passed the earlier availability check.","triggerScenarios":"MorphProvider.__init__ executes `self.client = MorphCloudClient(api_key=...)` or `self.Sandbox = Sandbox` and one of those imports raises ImportError — e.g. morphcloud installed with missing extras, a broken transitive dependency, or a version whose submodule layout changed.","commonSituations":"Pip resolved an old/incompatible morphcloud version; a partial install after a network failure; conflicting package versions (e.g. pydantic/httpx pinned elsewhere) breaking morphcloud's imports; importing Sandbox from a submodule path that moved between versions.","solutions":["Read the wrapped message in {e} to identify the actual missing module","Reinstall cleanly: pip install --force-reinstall -U morphcloud","Install any extras morphcloud documents (e.g. pip install 'morphcloud[all]')","Pin/align conflicting dependency versions named in the inner error"],"exampleFix":"// before\nprovider = MorphProvider()  # ImportError: Required MorphCloud dependencies not installed: No module named 'morphcloud.sandbox'\n// after\n# shell: pip install --force-reinstall -U morphcloud\nprovider = MorphProvider()  # works","handlingStrategy":"try-catch","validationCode":"def check_morph_client():\n    try:\n        from morphcloud.api import MorphCloudClient  # noqa: F401\n    except ImportError as e:\n        raise SystemExit(f\"morphcloud broken install: {e}; run pip install --force-reinstall -U morphcloud\") from e","typeGuard":"def morph_client_importable() -> bool:\n    try:\n        from morphcloud.api import MorphCloudClient  # noqa: F401\n        return True\n    except ImportError:\n        return False","tryCatchPattern":"try:\n    provider = MorphProvider()\nexcept ImportError as e:\n    logger.error(\"MorphCloud deps broken: %s\", e)\n    logger.error(\"Fix with: pip install --force-reinstall -U morphcloud\")\n    raise SystemExit(1) from e","preventionTips":["Pin morphcloud and its key transitive deps in a lockfile","Use a clean venv per project to avoid version conflicts","Re-run pip check in CI to catch broken dependency graphs","Read the inner {e} message first — it names the actual missing module"],"tags":["python","dependency-conflict","import-error","broken-install"],"backgroundTag":"broken-dependency-install","analyzedSha":"1416fa0cf21595d2083b399a2a0bbddd7f6e9563","analyzedAt":"2026-08-30T08:56:53.400Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}