microsoft/autogen · error · ValueError
Pip install failed. {stdout}, {stderr}
Error message
Pip install failed. {stdout}, {stderr} What it means
Raised during Docker executor setup (_setup_functions) when `python -m pip install <packages>` executed inside the container exits non-zero. The packages come from the `required_packages` lists of the functions passed to the constructor. The message embeds the command output (note: an upstream quirk sets both stdout and stderr fields to result.output).
Source
Thrown at python/packages/autogen-ext/src/autogen_ext/code_executors/docker/_docker_code_executor.py:275
func_file.write_text(func_file_content)
# Collect requirements
lists_of_packages = [x.python_packages for x in self._functions if isinstance(x, FunctionWithRequirements)]
flattened_packages = [item for sublist in lists_of_packages for item in sublist]
required_packages = list(set(flattened_packages))
if len(required_packages) > 0:
logging.info("Ensuring packages are installed in executor.")
packages = shlex.join(required_packages)
result = await self._execute_code_dont_check_setup(
[CodeBlock(code=f"python -m pip install {packages}", language="sh")], cancellation_token
)
if result.exit_code != 0:
stdout = result.output
stderr = result.output
raise ValueError(f"Pip install failed. {stdout}, {stderr}")
# Attempt to load the function file to check for syntax errors, imports etc.
exec_result = await self._execute_code_dont_check_setup(
[CodeBlock(code=func_file_content, language="python")], cancellation_token
)
if exec_result.exit_code != 0:
raise ValueError(f"Functions failed to load: {exec_result.output}")
self._setup_functions_complete = True
async def _kill_running_command(self, command: List[str]) -> None:
if self._container is None or not self._running:
return
await asyncio.to_thread(self._container.exec_run, ["pkill", "-f", " ".join(command)])
async def _execute_command(self, command: List[str], cancellation_token: CancellationToken) -> Tuple[str, int]:
if self._container is None or not self._running:View on GitHub (pinned to 027ecf0a37)
Solutions
- Read the embedded pip output — it is the real pip error (resolution failure, network error, no matching distribution)
- Fix the package spec in the function's required_packages (correct name/pin) and retry
- If the container has no network, pre-install dependencies into a custom image and pass image="that-image" instead of relying on runtime pip
- For proxy environments, build the pip config into the image (ENV PIP_INDEX_URL=...) since the executor does not forward host proxy settings
Example fix
# before DockerCommandLineCodeExecutor(functions=[(fn, ["pandas==9.9.9"])]) # nonexistent version # after DockerCommandLineCodeExecutor(functions=[(fn, ["pandas>=2.0"])]) # or bake deps into an image: # Dockerfile: FROM python:3-slim / RUN pip install pandas DockerCommandLineCodeExecutor(image="my-executor:latest", functions=[fn])
Defensive patterns
Strategy: try-catch
Validate before calling
null
Type guard
null
Try / catch
try:
await executor.execute_code_blocks(blocks, ct)
except ValueError as e:
if "Pip install failed" in str(e):
# str(e) contains pip's real output: resolution error, network error, etc.
fix_required_packages_from_pip_output(str(e))
executor = DockerCommandLineCodeExecutor(functions=fixed_functions)
await executor.execute_code_blocks(blocks, ct) Prevention
- Pre-install heavy dependencies into a custom executor image instead of runtime pip
- Pin versions that have wheels for the image's Python version and architecture
- Ensure containers have network/proxy access before relying on runtime pip
When it happens
Trigger: First execute_code_blocks call when any function declares required_packages that pip cannot install in the container: package name typo, no network access in the container, incompatible Python version in the image, or an unpublished/unpinned dependency that breaks resolution.
Common situations: Containers without internet (corporate networks, --network none); pinning a package version with no wheel for the image's Python/arch (e.g. numpy on python:3-slim arm64); typo'd package names like 'pandasq'; proxy env vars not passed into the container.
Related errors
- Functions failed to load: {exec_result.output.strip()}
- Missing dependecies for DockerCommandLineCodeExecutor. Pleas
- Functions failed to load: {exec_result.output}
- Pip install failed. {stdout.decode()}, {stderr.decode()}
- Unauthorized
AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15).
Data as JSON: /api/errors/31301ab1fa2708de.
Report an issue: GitHub.