> ## Documentation Index
> Fetch the complete documentation index at: https://private-04b27de1.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# autogen.code_utils.create_virtual_env

<code class="doc-symbol doc-symbol-heading doc-symbol-function" />

#### create\_virtual\_env

```python theme={null}
create_virtual_env(dir_path: str, **env_args) -> SimpleNamespace
```

Creates a python virtual environment and returns the context.<br />

<b>Parameters:</b>

| Name         | Description                                                            |
| ------------ | ---------------------------------------------------------------------- |
| `dir_path`   | Directory path where the env will be created.<br /><br />**Type:** str |
| `**env_args` | Any extra args to pass to the `EnvBuilder`<br /><br />                 |

<b>Returns:</b>

| Type                  | Description                                      |
| --------------------- | ------------------------------------------------ |
| types.SimpleNamespace | SimpleNamespace: the virtual env context object. |

<br />
