Reputation: 39
So I'm in the process of playing around with SonarCloud/SonarLint and had to set up some preliminaries - i.e. create AzureDevOps and Pipeline. This is my first time diving into Azure and I honestly don't understand how to go about fixing this error. I'm assuming I either need to create a 'requirements.txt' file or that I need to install dependencies....or both. Either way,I honestly don't know where to get started with this. Could someone please help? Below is the log I get from testing out the pipeline which is where my issue lies. Am I right in my assumption? Thanks in advance!
2020-12-20T01:30:10.5970195Z ##[section]Starting: Install dependencies
2020-12-20T01:30:10.5977975Z ==============================================================================
2020-12-20T01:30:10.5978665Z Task : Command line
2020-12-20T01:30:10.5978936Z Description : Run a command line script using Bash on Linux and macOS and cmd.exe on Windows
2020-12-20T01:30:10.5979213Z Version : 2.178.0
2020-12-20T01:30:10.5979420Z Author : Microsoft Corporation
2020-12-20T01:30:10.5979702Z Help : https://learn.microsoft.com/azure/devops/pipelines/tasks/utility/command-line
2020-12-20T01:30:10.5980019Z ==============================================================================
2020-12-20T01:30:11.0224446Z Generating script.
2020-12-20T01:30:11.0226001Z ========================== Starting Command Output ===========================
2020-12-20T01:30:11.0229091Z [command]/bin/bash --noprofile --norc /home/vsts/work/_temp/f501a929-0e67-45b9-9e28-7047fe9295cf.sh
2020-12-20T01:30:15.1478266Z DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
2020-12-20T01:30:15.8292586Z Collecting pip
2020-12-20T01:30:15.8700890Z Downloading pip-20.3.3-py2.py3-none-any.whl (1.5 MB)
2020-12-20T01:30:15.9513160Z Installing collected packages: pip
2020-12-20T01:30:15.9513725Z Attempting uninstall: pip
2020-12-20T01:30:15.9514085Z Found existing installation: pip 20.3.1
2020-12-20T01:30:16.0461039Z Uninstalling pip-20.3.1:
2020-12-20T01:30:16.0935089Z Successfully uninstalled pip-20.3.1
2020-12-20T01:30:16.9255324Z Successfully installed pip-20.3.3
2020-12-20T01:30:17.4315243Z DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
2020-12-20T01:30:17.5185497Z ERROR: Could not open requirements file: [Errno 2] No such file or directory: 'requirements.txt'
2020-12-20T01:30:17.5845613Z ##[error]Bash exited with code '1'.
2020-12-20T01:30:17.5859482Z ##[section]Finishing: Install dependencies
Upvotes: 2
Views: 5447
Reputation: 222722
I would highly recommend to go through the official documentation on Use CI/CD to deploy a Python web app to Azure App Service
Irrespective of Azure Devops, you need to have the dependencies define in requirements.txt and bound your dependencies to the respective environment. With Azure Devops, you need to define a task to install the dependencies from file which is defined here.
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(pythonVersion)'
displayName: 'Use Python $(pythonVersion)'
- script: |
python -m venv antenv
source antenv/bin/activate
python -m pip install --upgrade pip
pip install setup
pip install -r requirements.txt
workingDirectory: $(projectRoot)
displayName: "Install requirements"
```
Upvotes: 3