Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Scratchaker/Windows-Python-Launcher/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The Virtual Environment configuration options enable automatic creation and management of Python virtual environments. This ensures your project dependencies are isolated from system-wide packages and other projects.Configuration Options
Controls whether a virtual environment will be created and used for running Python scripts.Valid values:
1- Enable virtual environment (recommended)0- Disable virtual environment (use system Python)
- Check if the virtual environment already exists
- Create it if it doesn’t exist
- Activate the virtual environment before running your script
Specifies the name of the virtual environment directory that will be created in your project folder.Common values:
pyvenv- Default generic namevenv- Common convention.venv- Hidden directory (recommended for version control)env- Another common conventionproject-env- Project-specific naming
.\{venvname}\ relative to the launcher location.If this directory already exists, the launcher will use the existing virtual environment without recreating it.
Controls whether dependencies from a requirements file should be automatically installed when creating a new virtual environment.Valid values:
1- Install requirements automatically0- Skip requirements installation
- Packages are ONLY installed when creating a NEW virtual environment
- Existing virtual environments are NOT updated
- This prevents unexpected package updates on every run
Specifies the path to the requirements file that contains project dependencies.Valid values:
requirements.txt- Standard conventionrequirements-dev.txt- Development dependenciesrequirements-prod.txt- Production dependencies%cd%\config\requirements.txt- Relative path to subdirectoryC:\shared\requirements.txt- Absolute path
This setting is only used when
installrequirementsfile is set to 1.Usage Examples
Standard Configuration (Recommended)
The default configuration works well for most projects:- Create
pyvenv\directory on first run - Install packages from
requirements.txt - Activate the environment before running your script
Using .venv (Version Control Friendly)
Many developers prefer hidden virtual environment directories:Disable Virtual Environment
For simple scripts or when using system-wide packages:Manual Dependency Management
Create the virtual environment but don’t auto-install dependencies:- You want to manually control when packages are installed
- You’re testing different package versions
- Your project doesn’t use a requirements file
Multiple Requirements Files
Use different requirements files for different environments:Development
Production
Custom Requirements Location
If your requirements file is in a subdirectory:Virtual Environment Lifecycle
First Run (New Project)
- Launcher checks if
{venvname}\directory exists - Directory doesn’t exist → Create new virtual environment
- If
installrequirementsfile=1, install packages from{requirementsfile} - Activate virtual environment
- Run Python script
Subsequent Runs (Existing Environment)
- Launcher checks if
{venvname}\directory exists - Directory exists → Skip creation and package installation
- Activate existing virtual environment
- Run Python script
Packages are never automatically updated in existing environments. This prevents unexpected behavior and ensures reproducibility.
Updating Dependencies
To update packages in an existing virtual environment:Option 1: Recreate Environment
Option 2: Manual Update
Requirements File Format
The launcher uses pip to install packages, so your requirements file should follow pip’s format:Basic Format
With Comments
Advanced Features
Common Configurations
Simple Project
No Dependencies
System-Wide Packages Only
Multiple Environments
Troubleshooting
Virtual Environment Creation Fails
If venv creation fails:- Check Python installation: Ensure
python -m venvworks - Verify permissions: Ensure you can create directories in the project folder
- Check disk space: Verify sufficient space for the virtual environment
- Try system Python: Test with
usevenv=0to rule out venv issues
Requirements Installation Fails
If package installation fails:- Check requirements file: Ensure
{requirementsfile}exists and is valid - Test manually: Try
pip install -r requirements.txtmanually - Check network: Ensure you can reach PyPI (https://pypi.org)
- Verify package names: Check for typos in package names
- Check constraints: Ensure version constraints are satisfiable
Packages Not Updating
If new packages in requirements.txt aren’t installed: Solutions:- Delete the
{venvname}directory and run the launcher again - Manually install:
{venvname}\Scripts\activate.bat && pip install -r requirements.txt
Wrong Virtual Environment Used
If the launcher uses the wrong environment:- Check venvname: Verify
venvnamematches your intended directory - Check directory: Look for multiple venv directories in your project
- Recreate: Delete the wrong directory and let the launcher recreate it
Best Practices
Always Use Virtual Environments
Enableusevenv=1 for all projects to maintain isolation:
Use Hidden Directories
Use.venv to keep the directory out of sight:
.gitignore:
Pin Dependencies
Use exact versions in requirements.txt for reproducibility:Document Dependencies
Add comments to requirements.txt explaining why packages are needed:Separate Dev and Prod Requirements
Maintain separate files: requirements.txt (production):Regular Updates
Periodically recreate virtual environments to get security updates:Related Configuration
- Python Setup - Configure which Python creates the virtual environment
- Overview - General configuration principles