Reputation: 53
I am trying to set up a build pipeline for my python project in Azure Devops. But, I keep getting an error when it tries to install dependencies:
ERROR: Could not open requirements file: [Errno 2] No such file or directory: 'requirements.txt'
I have a requirments.txt
file in the root directory of the repo. Is that the right place? From what I've read it should be. What am I doing wrong?
Upvotes: 1
Views: 2989
Reputation: 35514
ERROR: Could not open requirements file: [Errno 2] No such file or directory: 'requirements.txt'
Based on the error message, it seems that requirements.txt
file does not exist in the path where the command is executed.
You could try the following two methods:
1.You can specify the path of the file in the command:
For example:
File structure:
Pipeline command:
- task: CmdLine@2
displayName: Command Line Script
inputs:
script: pip install -r $(build.sourcesdirectory)/requirements.txt --index-url $PIP_EXTRA_INDEX_URL
2.You can specify a specific working path in the Pipeline task.
workingDirectory: $(build.sourcesdirectory) #the folder path contains the file
For example:
- task: CmdLine@2
displayName: Command Line Script
inputs:
script: pip install -r requirements.txt --index-url $PIP_EXTRA_INDEX_URL
workingDirectory: $(build.sourcesdirectory)
Upvotes: 2