# ERROR: Could not open requirements file: [Errno 22] Invalid argument: 'requirements.txt'

- **ID:** `python/pip-requirements-file-encoding`
- **Domain:** python
- **Category:** encoding_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The requirements file has an invalid encoding (e.g., UTF-16 with BOM) or contains null bytes.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.9 | active | — | — |

## Workarounds

1. **Convert file to UTF-8 encoding** (90% success)
   ```
   iconv -f UTF-16 -t UTF-8 requirements.txt > requirements_utf8.txt
mv requirements_utf8.txt requirements.txt
   ```
2. **Recreate requirements file with proper encoding** (85% success)
   ```
   pip freeze > requirements.txt
# Ensure editor saves as UTF-8
   ```

## Dead Ends

- **Creating a new file with same name** — Does not fix encoding issue; may recreate with wrong encoding. (80% fail)
- **Using --no-cache-dir** — Cache is irrelevant; file reading fails. (90% fail)
