Azure Function - ModuleNotFoundError: No module named 'Cython' even though Cython is installed in Azure Devops

Martin Kostadinov 36 Reputation points
2023-01-11T10:24:16.48+00:00

I'm setting up some CI/CD for a Python app (Azure Function) using Azure Devops and I've stumbled upon an issue with one of the requirements. The error I receive is ModuleNotFoundError: No module named 'Cython' while trying to install pymssql-2.1.4. Before this requirement, I have set a Cython==0.29.21 to be installed and it is installed as it can be seen through out the logs as

Collecting Cython==0.29.21
  Downloading Cython-0.29.21-cp38-cp38-manylinux1_x86_64.whl (1.9 MB)
 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.9/1.9 MB 73.5 MB/s eta 0:00:00

I'm not sure why this error happens, I did some research and saw that it can be a problem with the pip version so I update the pip before doing the installation but the error keeps persisting. This is my yaml code for the part where I install the requirements.

python3 -m venv worker_venv
source worker_venv/bin/activate
python3 -m pip install pip --upgrade
pip3 install setuptools
pip3 install -r requirements.txt

I use python 3.8 version and ubuntu 20.04. Does somebody know how can I fix this?

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,232 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Mike Urnun 9,656 Reputation points Microsoft Employee
    2023-01-31T21:15:04.2766667+00:00

    Hello @Martin Kostadinov - Sorry for the long silence. Were you able to overcome this issue, or are you still facing it? If you still are facing this issue, with the CI/CD context aside, have you reviewed the guidance in the following doc?

    0 comments No comments