ATH-MaaS/Pixelle-Video · error · RuntimeError
dashscope package not installed. Run: pip install dashscope
Error message
dashscope package not installed. Run: pip install dashscope
What it means
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.
Source
Thrown at pixelle_video/services/api_services/image_dashscope.py:99
if isinstance(value, dict):
for key, val in value.items():
if key in {"image", "url", "image_url"} and isinstance(val, str):
results.append(val)
else:
walk(val)
elif isinstance(value, list):
for item in value:
walk(item)
walk(to_plain(payload))
return [url for url in results if isinstance(url, str)]
def generate_image(self, prompt, model="wan2.7-image", size="1024*1024", n=1, session_id=None, save_dir=None):
"""
Text to Image generation using DashScope
"""
if ImageGeneration is None:
raise RuntimeError("dashscope package not installed. Run: pip install dashscope")
try:
messages = [{"role": "user", "content": [{"text": prompt}]}]
with self._proxy_env():
response = ImageGeneration.call(
model=model,
api_key=self.api_key,
messages=messages,
n=n,
size=size,
watermark=False,
)
if response.status_code == 200:
results = self._extract_image_urls(getattr(response, "output", None))
if not results:
raise RuntimeError(f"DashScope image generation returned no image URLs. output={getattr(response, 'output', None)}")
View on GitHub (pinned to 848b054e4f)
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
Example fix
# before pip install pixelle-video # after pip install pixelle-video dashscope
Defensive patterns
Strategy: validation
Validate before calling
try:
import dashscope
from dashscope import ImageGeneration
except ImportError:
raise SystemExit("Run: pip install dashscope") Try / catch
try:
paths = gen.generate_image(prompt=p)
except RuntimeError as e:
if "dashscope package not installed" in str(e):
raise SystemExit("Run: pip install dashscope") from e Prevention
- Pin dashscope in requirements.txt
- Verify imports in a smoke test at deploy time
- Avoid optional undeclared dependencies
When it happens
Trigger: Calling generate_image when the 'dashscope' pip package is absent from the environment (fresh venv, Docker image without the dependency, optional-dependency not installed).
Common situations: Deploying without requirements.txt; using a slim base image; installing a different/older SDK that does not expose ImageGeneration; mixing project venvs.
Understand the failure class
Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.
Related errors
AI-assisted analysis of ATH-MaaS/Pixelle-Video@848b054e4f (2026-08-30).
Data as JSON: /api/errors/a5a9bb366b0c3f80.
Report an issue: GitHub.