Issues when launching apphost from within an active venv with python resource
- Dominant language
- C#
- Stars
- 6.3k
- Forks
- 991
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 196
Description
### Is there an existing issue for this?
- [x] I have searched the existing issues
### Describe the bug
Given an AppHost with a python resource, if you start the apphost from a shell that has an active venv, the python resources will fail due to venv conflicts.
This effects poetry and pip package managers since they use the active venv instead of creating/using the project defined venv.
### Expected Behavior
Aspire should either:
Fail to launch in a venv.
Filter venv environment variables from python apps and their installers.
### Steps To Reproduce
use python starter template using `WithPip()` or `WithPoetry()` instead of `WithUv()`, create a different venv and activate it. Launch the apphost from this shell with an active venv.
### Exceptions (if any)
In uv you get this warning:
warning: `VIRTUAL_ENV=wrong-path` does not match the project environment path `.venv` and will be ignored; use `--active` to target the active environment instead
In poetry and pip you install in the active venv and then the app doesn't have the dependencies installed.
### .NET Version info
10
### Anything else?
I can share my active venv detection code that we use to exit the AppHost when we detect this.
Contributor guide
Assessment
This issue has not been assessed yet.