# ERROR: Invalid requirement: 'package [extra1, extra2]' (line 1 of requirements.txt). Hint: = is not a valid operator. Did you mean == ?

- **ID:** `pip/invalid-requirement-extra-spacing`
- **Domain:** pip
- **Category:** config_error
- **Verification:** ai_generated
- **Fix Rate:** 95%

## Root Cause

The requirements.txt contains an invalid syntax with a space between the package name and brackets for extras, or uses '=' instead of '==', causing pip to fail parsing.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| pip 23.3 | active | — | — |
| Python 3.9 | active | — | — |

## Workarounds

1. **Fix the syntax: remove spaces and use correct operator. Change 'package [extra1, extra2]' to 'package[extra1,extra2]' and ensure version specifier uses '==' not '='.** (95% success)
   ```
   Fix the syntax: remove spaces and use correct operator. Change 'package [extra1, extra2]' to 'package[extra1,extra2]' and ensure version specifier uses '==' not '='.
   ```
2. **Use pip's parsing to validate: 'pip install --dry-run -r requirements.txt' to catch syntax errors before full install.** (90% success)
   ```
   Use pip's parsing to validate: 'pip install --dry-run -r requirements.txt' to catch syntax errors before full install.
   ```
3. **Regenerate requirements.txt with 'pip freeze' after manual install to avoid syntax issues.** (85% success)
   ```
   Regenerate requirements.txt with 'pip freeze' after manual install to avoid syntax issues.
   ```

## Dead Ends

- **** — Adding a comment to requirements.txt does not fix the syntax error. (99% fail)
- **** — Running 'pip install --upgrade pip' does not change parsing rules; the syntax is still invalid. (95% fail)
- **** — Using 'pip install -r requirements.txt --ignore-requires-python' ignores Python version checks but not syntax errors. (98% fail)
