Unable to import python packages "azure-identity","psycopg2" and "sh" in Azure Automation (python 3)

MF 71 Reputation points
2022-03-28T14:53:05.48+00:00

Hi, I'm trying to import these two packages in Azure Automation python3.

https://pypi.org/project/psycopg2/#files
https://pypi.org/project/sh/#files

I have downloaded tar.gz files and added to "Python Packages" however I get this error message:

Runtime version
3.8.0
Error
Orchestrator.Activities.PythonPackageExtractException: Error while extractinig Python package: pip could not convert tar.gz file C:\Users\Client\Temp\psycopg2.tar.gz to wheel file Processing c:\users\client\temp\psycopg2.tar.gz ERROR: Command errored out with exit status 1: command: 'C:\WPy64-3800\python-3.8.0.amd64\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Client\Temp\pip-req-build-m8folar4\setup.py'"'"'; ....

Error
Orchestrator.Activities.PythonPackageExtractException: Error while extractinig Python package: pip could not convert tar.gz file C:\Users\Client\Temp\sh.tar.gz to wheel file Processing c:\users\client\temp\sh.tar.gz ERROR: Command errored out with exit status 1: command: 'C:\WPy64-3800\python-3.8.0.amd64\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Client\Temp\pip-req-build-xu8allvp\setup.py'"'.....

How can I import these packages?

Looking forward to hearing from you.

Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
1,259 questions
0 comments No comments
{count} votes

Accepted answer
  1. tbgangav-MSFT 10,416 Reputation points
    2022-03-29T09:13:39.437+00:00

    Hi @MF ,

    I was also able to reproduce the issue and has received the same error. However as mentioned here, the Azure Sandbox environment might not have the required compilers for C/C++ binaries so it's recommended to use wheel files. Hence, I have used the wheel files that are highlighted in the below screenshot and was able to successfully import the packages.

    187864-image.png

    187709-image.png

    187805-image.png


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.