question

PatrickSchneider-6088 avatar image
0 Votes"
PatrickSchneider-6088 asked MayankBargali-MSFT edited

Problems import sysidentpy package

Hello,

for a system identification I need the python package sysidentpy.
(see https://pypi.org/project/sysidentpy/)

However, the integration of the package into my Azure Function App does not want to succeed.

Following is my requirements.txt file:
azure-functions
azure-iot-hub
azure-digitaltwins-core
azure-identity
numpy==1.21.0
pandas==1.3.0
matplotlib==3.4.2
sysidentpy==0.1.5.3

The following error is issued:
0:03:13 func-PI-RnD-DEWestMid-001: [08:03:13+0000] Collecting sysidentpy==0.1.5.3
10:03:13 func-PI-RnD-DEWestMid-001: [08:03:13+0000] Using cached sysidentpy-0.1.5.3.tar.gz (21.5 MB)
10:03:14 func-PI-RnD-DEWestMid-001: ERROR: Command errored out with exit status 1:
10:03:14 func-PI-RnD-DEWestMid-001: command: /tmp/oryx/platforms/python/3.9.0/bin/python3.9 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-6gu_bg92/sysidentpy/setup.py'"'"'; file='"'"'/tmp/pip-install-6gu_bg92/sysidentpy/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r
10:03:14 func-PI-RnD-DEWestMid-001: '"'"', '"'"'
10:03:14 func-PI-RnD-DEWestMid-001: '"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-_3sq2mjs
10:03:14 func-PI-RnD-DEWestMid-001: cwd: /tmp/pip-install-6gu_bg92/sysidentpy/
10:03:14 func-PI-RnD-DEWestMid-001: Complete output (1 lines):
10:03:14 func-PI-RnD-DEWestMid-001: numpy is required during installation
10:03:14 func-PI-RnD-DEWestMid-001: ----------------------------------------
10:03:14 func-PI-RnD-DEWestMid-001: ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

The following article notes that this may be related to the Python version used. According to the article, I need Python version 3.8 and numpy version 1.19.3.
(see https://github.com/wilsonrljr/sysidentpy/issues/39)

I have also tried it with the mentioned numpy version but it did not work either.

My Function App is implemented in Linux. I had set the python version to 3.8 or 3.9 (I am not sure).

Is there a way to check the specific Version (Not whether it is only 3.x but whether it is really 3.8 or 3.9)
And is there a way to set the existing function app to 3.8?

Are there any other comments which could solve the problem.

I hope someone can help me further.

With best regards
Patrick

azure-functions
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

MayankBargali-MSFT avatar image
2 Votes"
MayankBargali-MSFT answered MayankBargali-MSFT edited

@PatrickSchneider-6088 In scenario where the modules can be installed using pip then you can mentioned the same in your requirements.txt and those modules will get installed.

But in cases if those module or dependencies cannot be installed using pip then you need to use build native dependencies or enable remote build.
You can refer to python troubleshooting document for more details.

If it works locally then you can try with build native dependencies or enable remote build.

· 6
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello MayankBargali-MSFT,

thank you for your help.
I am not yet very experienced in using azure and therefore still have some problem understanding everything that you noted.

What I have tried in the meantime to implement your comments:
- Installed pip locally - worked!
- Created requirements.txt from venv
- Tried to deploy the project

Problem: Locally I am working on windows. Azure Function is Linux based.
Therefore the pip installation of "pywin32==301" fails.
(When I delete "pywin32==301" the sysidentpy installation fails)

The requirements.txt:
attrs==21.2.0
azure-core==1.16.0
azure-digitaltwins-core==1.1.0
azure-functions==1.7.0
azure-identity==1.6.0
azure-iot-hub==2.4.0
certifi==2021.5.30
cffi==1.14.6
chardet==4.0.0
colorama==0.4.4
cryptography==3.4.7
cycler==0.10.0
future==0.18.2
idna==2.10
isodate==0.6.0
kiwisolver==1.3.1
matplotlib==3.4.2
msal==1.12.0
msal-extensions==0.3.0
msrest==0.6.21
numpy==1.21.0
oauthlib==3.1.1
pandas==1.3.0
Pillow==8.3.1
portalocker==1.7.1
pycparser==2.20
PyJWT==2.1.0
pyparsing==2.4.7
pyswarms==1.3.0
python-dateutil==2.8.1
pytz==2021.1
pywin32==301
PyYAML==5.4.1
requests==2.25.1
requests-oauthlib==1.3.0
scipy==1.7.0
six==1.16.0
sysidentpy==0.1.5.3
torch==1.7.1
tqdm==4.61.2
typing-extensions==3.10.0.0
uamqp==1.4.1
urllib3==1.26.6

It is not possible to use Windows in Azure Functions App (with Python).

Can you help me further.

Thank you very much!

With best regards
Patrick



0 Votes 0 ·

@PatrickSchneider-6088 Have you tried the native build as mentioned previously. If it still didn't help I will suggest you to open the support ticket with us to assist us further.
If you don't have support plan then please let me know so I can help with one time free support ticket to assist you further

1 Vote 1 ·

@MayankBargali-MSFT Yes I tried the native build but it still doesn`t work.

I don`t have a support plan. It would be great if you could help me with a one time free support ticket.

How does this work?

0 Votes 0 ·
Show more comments
PatrickSchneider-6088 avatar image
0 Votes"
PatrickSchneider-6088 answered PatrickSchneider-6088 commented

Hello PierreLucGiguere-5297,

Thank you very much, that has already helped a lot.

The current App had the python version 3.9. I pulled up the Function App again and deposited the corresponding python version 3.8.

However, the problem remains the same, the package sysidentpy still can not be installed. (Same error message)

Can you help me further why the installation fails?

· 5
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Additional information:

SysIdentPy requires:

Python (>= 3.6)
NumPy (>= 1.5.0) for all numerical algorithms
Matplotlib >= 1.5.2 for static plotiing and visualizations
Pytorch (>=1.7.1) for building feed-forward neural networks
(according to https://pypi.org/project/sysidentpy/)

But install Pytorch fails too.

Error:
10:37:23 func-PI-RnD-DEWestMid-002: [08:37:23+0000] Building wheels for collected packages: Pytorch
10:37:23 func-PI-RnD-DEWestMid-002: [08:37:23+0000] Building wheel for Pytorch (setup.py): started
...
10:37:23 func-PI-RnD-DEWestMid-002: File "<string>", line 1, in <module>
10:37:23 func-PI-RnD-DEWestMid-002: File "/tmp/pip-install-sendh9p_/pytorch/setup.py", line 15, in <module>
10:37:23 func-PI-RnD-DEWestMid-002: raise Exception(message)
10:37:23 func-PI-RnD-DEWestMid-002: Exception: You tried to install "pytorch". The package named for PyTorch is "torch"
10:37:23 func-PI-RnD-DEWestMid-002: ----------------------------------------
10:37:23 func-PI-RnD-DEWestMid-002: ERROR: Failed building wheel for Pytorch

Install Torch fails too.

0 Votes 0 ·

Hello Patrick,

Glad I could help a little bit.

It looks like you need torch when it comes to linux:

113016-image.png


Source: https://pytorch.org/get-started/locally/


1 Vote 1 ·
image.png (30.2 KiB)

Hello PierreLucGiguere-5297,

Thanks! I installed torch.

Install torch like this:
torch==1.5.0
doesn't work.

But the souce you referenced described the installation in Azure Functions like this:
-f https://download.pytorch.org/whl/torch_stable.html
torch==1.5.0+cpu
torchvision==0.6.0+cpu
=> this worked!

But install sysidentpy is still not possible.
Is there something similar to do for the sysidentpy package?

0 Votes 0 ·
Show more comments
PierreLucGiguere-5297 avatar image
1 Vote"
PierreLucGiguere-5297 answered

Hi Patrick,

You can check the exact version by adapting the following command :

 az functionapp config show --name thisisaname --resource-group rg-testfunction --query linuxFxVersion --output tsv

You have to replace the --name and --resource-group for the name of the functionapp and its resource-group respectively.

The Python version is set when the function app is created and can't be changed.

Source: https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-python?tabs=application-level#python-version


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.