0

I want to make use of Python 3.4 x86 as my build target. Microsoft hosted agents don't have that as an option - 3.5 is the lowest version 3x branch.

Can I just install python during run process - still use Microsoft hosted agent but with python version I like?

The UsePythonVersion doesn't install it. enter image description here

3 Answers 3

0

It seems that you are using Hosted agent vs2017-win2016 and we can see that the Python version installed by the agent does not contain Python 3.4

Check the task prerequisites:

  • A Microsoft-hosted agent with side-by-side versions of Python installed, or a self-hosted agent with Agent.ToolsDirectory configured (see FAQ).

This task will fail if no Python versions are found in Agent.ToolsDirectory. Available Python versions on Microsoft-hosted agents can be found here.

As a workaround, we should install the Python 3.4 via command line and then use the task Use Python version to specify the Python version. Check this doc for more details.

Update1

It seems that we cannot install 3.4 in the hosted agent.

TEST1 install python via power shell script:

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

Invoke-WebRequest -Uri "{URL}" -OutFile "$(Build.SourcesDirectory)/{python install file .exe}"

$(Build.SourcesDirectory)/{python install file .exe} /quiet InstallAllUsers=0 PrependPath=1 Include_test=0

But cannot found python 3.4 exe file in the download website.

TEST2 install the python via extension.

Extension: Python build tools

Task: Install Python on Windows

According to the json file, we can see that 3.5.2 is the lowest version.

Sign up to request clarification or add additional context in comments.

4 Comments

Hello. I carefully read the documentation. For Microsoft hosted agent, there doesn't appear to be a task to install Python. Is the idea that using PowerShell or CMD task I should download python MSI and install manually? The FAQ link you shared points to self hosted agent. Thanks!
Hi @Konrads, Yes, the FAQ is points to self hosted agent, I want to share the first with you: A Microsoft-hosted agent with side-by-side versions of Python installed. We need to have this python version and then we could use the task to specify the version.
About install python via power shell or cmd, you could check this ticket and then kindly share the result here.
Hi @Konrads, It seems that we cannot do this, check the update1
0

Hmm. Exe isn’t there but msi’s are. They take same options as EXE I believe

2 Comments

Hi, Thanks for the sharing, you could Accept it as an Answer , it could help other community members who get the same issues and we could archive this thread, thanks.
Hey. Not sure where did we land on this. I tried for a while to install the msi without much success using the powershell route - no log written, silently fails. I don’t suppose there is a way to take the hosted image and fire it up as a Azure VM to debug?
0

If you are using a customized agent You need to add an environment for AGENT_TOOLSDIRECTORY and a python folder structure (https://go.microsoft.com/fwlink/?linkid=871498). In my case, I did in docker file used to generate the agent.

ENV AGENT_TOOLSDIRECTORY="/AGENT_DEVOPS"
RUN mkdir /AGENT_DEVOPS
RUN mkdir /AGENT_DEVOPS/Python

# python 3.8
RUN mkdir /AGENT_DEVOPS/Python/3.8.0
RUN apt-get install python3.8-venv
RUN python3.8 -m venv /AGENT_DEVOPS/Python/3.8.0/x64
RUN touch /AGENT_DEVOPS/Python/3.8.0/x64.complete

# python 3.7
RUN mkdir /AGENT_DEVOPS/Python/3.7.5
RUN apt-get install python3.7-venv
RUN python3.7 -m venv /AGENT_DEVOPS/Python/3.7.5/x64
RUN touch /AGENT_DEVOPS/Python/3.7.5/x64.complete

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.