{"record":{"id":"a5a9bb366b0c3f80","repo":"ATH-MaaS/Pixelle-Video","slug":"dashscope-package-not-installed-run-pip-install","errorCode":null,"errorMessage":"dashscope package not installed. Run: pip install dashscope","messagePattern":"dashscope package not installed\\. Run: pip install dashscope","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"pixelle_video/services/api_services/image_dashscope.py","lineNumber":99,"sourceCode":"            if isinstance(value, dict):\n                for key, val in value.items():\n                    if key in {\"image\", \"url\", \"image_url\"} and isinstance(val, str):\n                        results.append(val)\n                    else:\n                        walk(val)\n            elif isinstance(value, list):\n                for item in value:\n                    walk(item)\n\n        walk(to_plain(payload))\n        return [url for url in results if isinstance(url, str)]\n\n    def generate_image(self, prompt, model=\"wan2.7-image\", size=\"1024*1024\", n=1, session_id=None, save_dir=None):\n        \"\"\"\n        Text to Image generation using DashScope\n        \"\"\"\n        if ImageGeneration is None:\n            raise RuntimeError(\"dashscope package not installed. Run: pip install dashscope\")\n\n        try:\n            messages = [{\"role\": \"user\", \"content\": [{\"text\": prompt}]}]\n            with self._proxy_env():\n                response = ImageGeneration.call(\n                    model=model,\n                    api_key=self.api_key,\n                    messages=messages,\n                    n=n,\n                    size=size,\n                    watermark=False,\n                )\n\n            if response.status_code == 200:\n                results = self._extract_image_urls(getattr(response, \"output\", None))\n                if not results:\n                    raise RuntimeError(f\"DashScope image generation returned no image URLs. output={getattr(response, 'output', None)}\")\n                ","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/ATH-MaaS/Pixelle-Video/blob/848b054e4fae40dabc62ec58e960b573e83793ac/pixelle_video/services/api_services/image_dashscope.py#L81-L117","documentation":"generate_image requires the dashscope SDK's ImageGeneration API; if the package is not installed, the module-level import is None and this RuntimeError is raised with an install hint.","triggerScenarios":"Calling generate_image when the 'dashscope' pip package is absent from the environment (fresh venv, Docker image without the dependency, optional-dependency not installed).","commonSituations":"Deploying without requirements.txt; using a slim base image; installing a different/older SDK that does not expose ImageGeneration; mixing project venvs.","solutions":["Run: pip install dashscope","Pin dashscope in requirements.txt/pyproject dependencies","Rebuild/redeploy the container image with the dependency","Verify the installed dashscope version exposes ImageGeneration"],"exampleFix":"# before\npip install pixelle-video\n# after\npip install pixelle-video dashscope","handlingStrategy":"validation","validationCode":"try:\n    import dashscope\n    from dashscope import ImageGeneration\nexcept ImportError:\n    raise SystemExit(\"Run: pip install dashscope\")","typeGuard":null,"tryCatchPattern":"try:\n    paths = gen.generate_image(prompt=p)\nexcept RuntimeError as e:\n    if \"dashscope package not installed\" in str(e):\n        raise SystemExit(\"Run: pip install dashscope\") from e","preventionTips":["Pin dashscope in requirements.txt","Verify imports in a smoke test at deploy time","Avoid optional undeclared dependencies"],"tags":["dependency","missing-package","installation"],"backgroundTag":"missing-dependency","analyzedSha":"848b054e4fae40dabc62ec58e960b573e83793ac","analyzedAt":"2026-08-30T03:24:41.468Z","schemaVersion":2},"datasetVersion":"2026-08-30T08:17:16.595Z"}