question

KevinZhu-8717 avatar image
1 Vote"
KevinZhu-8717 asked ryanchill commented

ImportError: libGL.so.1: cannot open shared object file: No such file or directory

Hi fellow experts,

I hope you're doing well.
I'm currently experiencing an issue with azure - I cannot import module cv2 because there's an ImportError: libGL.so.1. I've searched far and wide on the web but nothing really seems to help me. See the picture below.
33042-image.png
I'm running my FLASK application from sublime text and the command terminal, and I've successfully deployed this application to Azure. See the picture below.
32983-image.png

I really don't understand what I need to do in order to resolve this issue, and I'm not understanding some of the forum solutions people are posting towards this question. I'm very new to web development and I was hoping I could get your help on this.

To see my full code, here is the link to it: https://github.com/kevinzhu99/imageView
If you know of any solutions to this problem, or any questions you have with my problem to gain more context, please let me know and I will get back to you as soon as possible.

Thank you in advance!


azure-webapps
image.png (146.4 KiB)
image.png (22.4 KiB)
· 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.

Update: My azure page will only load my initial page/ index page, but not the page I actually want (shnGetCamImg) because Azure isn't reading cv2 properly. I want to say that I'm confident and I have everything I need (if not more) in my requirements.txt file, but please correct me if I'm wrong.

Once again, I'm fairly new to Azure so if there's anyway to resolve this issue I'm willing to take that route. If there may be any rare chance that you would need my email, it is kevin.zhu87@live.com.

Thank you in advance!

0 Votes 0 ·

I get this error

File "/antenv/lib/python3.7/site-packages/cv2/__init__.py", line 5, in 
2021-04-07T07:52:48.333151458Z     from .cv2 import *
2021-04-07T07:52:48.333154158Z ImportError: libGL.so.1: cannot open shared object file: No such file or directory


Adding a dockerfile doesnt help.

0 Votes 0 ·

@sandeep-8504, adding a dockerfile won't work in this case, unless if you're deploying an image. Do you have any deployment errors? How are you deploying?

0 Votes 0 ·

Hey @KevinZhu-8717 , have you found the solution to this problem yet.I'm trying to deploy a website with a flask backend and I'm also getting the same error. I have tried deploying it on IBM cloud foundary and Heroku and the problem remains same.Please let me know if you have found any solution to this problem.

0 Votes 0 ·

How are you deploying @AadilKhan-9946? Are there any errors in your deployment log?

0 Votes 0 ·
ryanchill avatar image
1 Vote"
ryanchill answered ArnaudDeJaegher-1719 commented

Hi @KevinZhu-8717,

Please see the answer I posted here with regards to missing modules.

I also noticed shnGetCamImg wil fail because cameraip is not being set if the request method is GET. Your if condition terminates after pic_type = (request.form['picOptions']).


· 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.

Hi @ryanchill, I responded to your last email and to the module not found post. Deployment isn't an issue, I've been following the Kudu deployment. It's when you load the webpage and get onto the second page where my page crashes. On my local computer, this entire webpage works 100% fine with no errors, it's when I try using it on Azure where everything starts failing. I don't understand what's going on - especially now because my webpage is giving me a different error now and I don't know what to do. If you have any other questions about my code, please let me know and I will get back to you as soon as possible.

1 Vote 1 ·

I have same problem and not able to solve .

Can you share a list of instruction as I am not gettign your answer?


2021-02-11T10:25:32.196031501Z [2021-02-11 10:25:32 +0000] [43] [ERROR] Exception in worker process
2021-02-11T10:25:32.196230402Z from .cv2 import *
2021-02-11T10:25:32.196233302Z ImportError: libGL.so.1: cannot open shared object file: No such file or directory

0 Votes 0 ·
ryanchill avatar image ryanchill ArnaudDeJaegher-1719 ·

Hi @ArnaudDeJaegher-1719,

Make sure that you have SCM_DO_BUILD_DURING_DEPLOYMENT app setting set to 1.

Regards,
Ryan

0 Votes 0 ·
Show more comments
ArnaudDeJaegher-1719 avatar image
0 Votes"
ArnaudDeJaegher-1719 answered

DOCKERFILE

FROM python:3


RUN pip install --upgrade pip

build variables.

ENV DEBIAN_FRONTEND noninteractive

install Microsoft SQL Server requirements.

ENV ACCEPT_EULA=Y
RUN apt-get update -y && apt-get update \
&& apt-get install -y --no-install-recommends curl gcc g++ gnupg unixodbc-dev

Add SQL Server ODBC Driver 17 for Ubuntu 18.04

RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
&& curl https://packages.microsoft.com/config/debian/10/prod.list > /etc/apt/sources.list.d/mssql-release.list \
&& apt-get update \
&& apt-get install -y --no-install-recommends --allow-unauthenticated msodbcsql17 mssql-tools \
&& echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile \
&& echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc



RUN apt install libgl1-mesa-glx -y
RUN apt-get install 'ffmpeg'\
'libsm6'\
'libxext6' -y

WORKDIR /app

COPY . /app

RUN pip --no-cache-dir install -r requirements.txt

EXPOSE 5000

ENTRYPOINT ["python3"]
CMD ["run.py"]

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.