# WithPip

- Module: [Aspire.Hosting.Python](/reference/api/go/aspire.hosting.python.md)
- Version: `17.0.0`
- Kind: `method`
- Defined on: [`PythonAppResource`](/reference/api/go/aspire.hosting.python/pythonappresource.md)
- Source: [GitHub](https://github.com/microsoft/aspire/tree/bcfa151cdca6d0a573f22d5d9c23f9c727cb3b2f)

Configures the Python resource to use pip as the package manager and optionally installs packages before the application starts.

## Remarks

This method creates a child resource that runs `pip install` in the working directory of the Python application.
The Python application will wait for this resource to complete successfully before starting.
Pip will automatically detect and use either pyproject.toml or requirements.txt based on which file exists in the application directory.
If pyproject.toml exists, pip will use it. Otherwise, if requirements.txt exists, pip will use that.
Calling this method will replace any previously configured package manager (such as uv).

## Definition

```go
func (PythonAppResource) WithPip(options ...*WithPipOptions) PythonAppResource
```

## Parameters

- `options` (`...*WithPipOptions`) -- optional settings, see [Options](#options)

## Options

Optional parameters are passed in a trailing `options ...*WithPipOptions` argument.

- `Install` (`*bool`) -- When true (default), automatically installs packages before the application starts. When false, only sets the package manager annotation without creating an installer resource.
- `InstallArgs` (`[]string`) -- The command-line arguments passed to pip install command.

## Returns

[`PythonAppResource`](/reference/api/go/aspire.hosting.python/pythonappresource.md) -- The resource builder.

Returns a handle; failures surface later via `Err()`.

## Applies to

- [`PythonAppResource`](/reference/api/go/aspire.hosting.python/pythonappresource.md)
- [`UvicornAppResource`](/reference/api/go/aspire.hosting.python/uvicornappresource.md)
