Do I need a requirements txt file or should I install dependencies Azure DevOps

0 votes

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://docs.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

Mar 16, 2022 in DevOps & Agile by Edureka
• 13,670 points
1,484 views

1 answer to this question.

0 votes

I strongly advise you to read the official guide on deploying a Python web app to Azure App Service using CI/CD.

Regardless of whether you're using Azure Devops or not, you'll need to identify your dependencies in requirements.txt and link them to the appropriate environment. You must define a job in Azure Devops to install the requirements from the file specified above.

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"
answered Mar 24, 2022 by gaurav
• 23,260 points

Related Questions In DevOps & Agile

0 votes
1 answer

How do I use Devops with Xamarin and hockeyapp

It would be better if you use ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by Atul
• 10,240 points
514 views
+1 vote
2 answers

How do I run Apache server from Docker without mapping to a location?

If you're seeing a 500 error, that's ...READ MORE

answered Oct 18, 2018 in DevOps & Agile by lina
• 8,220 points
1,874 views
+14 votes
5 answers

How do I run a cron job inside a docker container

If you can SSH into your server ...READ MORE

answered Jul 27, 2018 in DevOps & Agile by Kalgi
• 52,360 points
15,919 views
0 votes
1 answer

to check file has the same value or not i.e comparing file with stat module.

Try the following script: Do the second time ...READ MORE

answered May 1, 2018 in DevOps & Agile by shubham
• 7,340 points
3,891 views
+1 vote
1 answer

How do I get a Docker container's IP address from the host?

Save your docker image as a tar ...READ MORE

answered Aug 29, 2018 in DevOps & Agile by shubham
• 7,340 points
745 views
0 votes
1 answer
0 votes
1 answer

How to edit file after I shell to a docker container?

Since docker images are trimmed to bare minimum ...READ MORE

answered Sep 11, 2018 in DevOps & Agile by Damon Salvatore
• 5,980 points
3,536 views
0 votes
1 answer

Is it possible to have a link to raw content of file in Azure DevOps

https://dev.azure.com/{{organization}}/{{project}}/_apis/sourceProviders/{{providerName}}/filecontents ?repository={{repository}} &path={{path}} &commitOrBranch={{commitOrBranch}} ...READ MORE

answered Mar 24, 2022 in DevOps & Agile by gaurav
• 23,260 points
2,729 views
0 votes
1 answer

How can I preview PowerPoint files in Azure DevOps (VSTS)?

For work item attachments, there are no ...READ MORE

answered Mar 8, 2022 in DevOps & Agile by gaurav
• 23,260 points
945 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP