# ERROR: Could not open requirements file: [Errno 2] No such file or directory: 'requirements\.txt'

- **ID:** `pip/requirements-file-encoding-issue`
- **Domain:** pip
- **Category:** config_error
- **Error Code:** `ERROR`
- **Verification:** ai_generated
- **Fix Rate:** 90%

## Root Cause

The requirements file path contains a Unicode character that is misinterpreted due to shell escaping or file system encoding mismatch (e.g., a non-breaking space or right-to-left mark in the filename), causing the actual file path to differ from the specified one.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| pip 23.3 | active | — | — |
| pip 24.0 | active | — | — |
| pip 24.2 | active | — | — |

## Workarounds

1. **Use tab completion to select the exact filename from the filesystem: pip install -r ./req<tab>** (90% success)
   ```
   Use tab completion to select the exact filename from the filesystem: pip install -r ./req<tab>
   ```
2. **List the directory with ls -b to see escaped characters and recreate the file with a clean name: ls -b | grep requirements && cp "$(ls | grep requirements)" requirements_clean.txt** (85% success)
   ```
   List the directory with ls -b to see escaped characters and recreate the file with a clean name: ls -b | grep requirements && cp "$(ls | grep requirements)" requirements_clean.txt
   ```
3. **Recreate the requirements file from scratch using a text editor that shows invisible characters (e.g., vim with :set list).** (95% success)
   ```
   Recreate the requirements file from scratch using a text editor that shows invisible characters (e.g., vim with :set list).
   ```

## Dead Ends

- **Use a different shell (e.g., bash instead of zsh) to run the pip command** — The issue is not shell-specific; the filename on disk contains an invisible Unicode character that persists across shells. (95% fail)
- **Rename the file using mv requirements.txt requirements_fixed.txt** — If the filename contains invisible characters, typing 'requirements.txt' in the mv command may also include those characters, resulting in the same filename or a different one. (70% fail)
