ManveerSinghKahlon-8000 avatar image
0 Votes"
ManveerSinghKahlon-8000 asked ·

Django Web App ImportError: cannot open shared object file: No such file or directory

I am trying to deploy a django website which uses facial recognition to verify users on login and hence uses the facial-recognition module which has cmake and dlib as pre-requisites. The problem arises in the github build wherein the app-build service seems to pip - install the modules out of order due to which the files become corrupted ( cmake must be installed before dlib and then facial-recognition module). i have tried to uninstall and install the modules manually in ssh but dlib takes so much time to install that the server times out and ssh shows waiting webapp to cold start but does not budge. I cant find any fix related to specifying an order to the pip install for requirements.txt file in the django app repository. When i visit the website it gives the error mention in the title.
Any ideas as to how i can fix this issue?

platform: python
platform-version: 3.8
pythonLocation: /opt/hostedtoolcache/Python/3.8.8/x64
/usr/bin/docker run --name e4ecdaaf1b5e3f4810b1c31ac556d2e5e6_185564 --label 5588e4 --workdir /github/workspace --rm -e pythonLocation -e INPUT_PLATFORM -e INPUT_PLATFORM-VERSION -e INPUT_SOURCE-DIRECTORY -e INPUT_OUTPUT-DIRECTORY -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/minor/minor":"/github/workspace" 5588e4:ecdaaf1b5e3f4810b1c31ac556d2e5e6 "" "python" "3.8" ""

No source directory was provided -- the root of the repository ('GITHUB_WORKSPACE' environment variable) will be built: '/github/workspace'
No output directory was provided
Platform provided: 'python'
Platform version provided: '3.8'
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed

0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 2348 100 2348 0 0 21678 0 --:--:-- --:--:-- --:--:-- 21740

Running command 'oryx build /github/workspace --platform python --platform-version 3.8'
Operation performed by Microsoft Oryx,
You can report issues at

Oryx Version: 0.2.20201112.1, Commit: a120bb248aa8d208ca5e02d7d9d075196e79cffd, ReleaseTagName: 20201112.1

Build Operation ID: |ntmp9gas4ag=.ab144135_
Repository Commit : 97a54453eb1848f2529697896107287f1ef707d3

Detecting platforms...
Detected following platforms:
python: 3.8.6
Version '3.8.6' of platform 'python' is not installed. Generating script to install it...

Source directory : /github/workspace
Destination directory: /github/workspace

Downloading and extracting 'python' version '3.8.6' to '/tmp/oryx/platforms/python/3.8.6'...
Downloaded in 1 sec(s).
Verifying checksum...
Extracting contents...
Done in 3 sec(s).

Python Version: /tmp/oryx/platforms/python/3.8.6/bin/python3.8
Python Virtual Environment: pythonenv3.8
Creating virtual environment...
Activating virtual environment...
Running pip install...
[10:36:11+0000] Collecting asgiref==3.3.1
[10:36:11+0000] Downloading asgiref-3.3.1-py3-none-any.whl (19 kB)
[10:36:11+0000] Collecting click==7.1.2
[10:36:11+0000] Downloading click-7.1.2-py2.py3-none-any.whl (82 kB)
[10:36:12+0000] Collecting cmake==3.18.4.post1
[10:36:12+0000] Downloading cmake-3.18.4.post1-py3-none-manylinux1_x86_64.whl (17.7 MB)
[10:36:12+0000] Collecting cv==1.0.0
[10:36:12+0000] Downloading cv-1.0.0-py3-none-any.whl (7.3 kB)
[10:36:13+0000] Collecting Django==3.1.6
[10:36:13+0000] Downloading Django-3.1.6-py3-none-any.whl (7.8 MB)
[10:36:13+0000] Collecting django-crispy-forms==1.11.0
[10:36:13+0000] Downloading django_crispy_forms-1.11.0-py3-none-any.whl (108 kB)
[10:36:13+0000] Collecting dlib==19.21.1
[10:36:13+0000] Downloading dlib-19.21.1.tar.gz (3.6 MB)
[10:36:14+0000] Collecting face-recognition==1.3.0
[10:36:14+0000] Downloading face_recognition-1.3.0-py2.py3-none-any.whl (15 kB)
[10:36:14+0000] Collecting face-recognition-models==0.3.0
[10:36:14+0000] Downloading face_recognition_models-0.3.0.tar.gz (100.1 MB)
[10:36:20+0000] Collecting gunicorn==20.0.4
[10:36:20+0000] Downloading gunicorn-20.0.4-py2.py3-none-any.whl (77 kB)
[10:36:21+0000] Collecting numpy==1.20.1
[10:36:21+0000] Downloading numpy-1.20.1-cp38-cp38-manylinux2010_x86_64.whl (15.4 MB)
[10:36:21+0000] Collecting opencv-python==
[10:36:21+0000] Downloading opencv_python- (50.4 MB)
[10:36:24+0000] Collecting Pillow==8.1.0
[10:36:24+0000] Downloading Pillow-8.1.0-cp38-cp38-manylinux1_x86_64.whl (2.2 MB)
[10:36:24+0000] Collecting pytz==2021.1
[10:36:24+0000] Downloading pytz-2021.1-py2.py3-none-any.whl (510 kB)
[10:36:24+0000] Collecting sqlparse==0.4.1
[10:36:24+0000] Downloading sqlparse-0.4.1-py3-none-any.whl (42 kB)
[10:36:24+0000] Collecting whitenoise==5.2.0
[10:36:24+0000] Downloading whitenoise-5.2.0-py2.py3-none-any.whl (19 kB)
[10:36:24+0000] Collecting cv2-tools==2.4.0
[10:36:24+0000] Downloading cv2_tools-2.4.0-py3-none-any.whl (22 kB)
[10:36:24+0000] Collecting python-constraint==1.4.0
[10:36:24+0000] Downloading python-constraint-1.4.0.tar.bz2 (18 kB)
[10:36:25+0000] Requirement already satisfied: setuptools>=3.0 in ./pythonenv3.8/lib/python3.8/site-packages (from gunicorn==20.0.4->-r requirements.txt (line 10)) (49.2.1)
[10:36:25+0000] Collecting imagehash
[10:36:25+0000] Downloading ImageHash-4.2.0-py2.py3-none-any.whl (295 kB)
[10:36:25+0000] Collecting scipy
[10:36:25+0000] Downloading scipy-1.6.1-cp38-cp38-manylinux1_x86_64.whl (27.3 MB)
[10:36:27+0000] Collecting PyWavelets
[10:36:27+0000] Downloading PyWavelets-1.1.1-cp38-cp38-manylinux1_x86_64.whl (4.4 MB)
[10:36:27+0000] Collecting six
[10:36:27+0000] Downloading six-1.15.0-py2.py3-none-any.whl (10 kB)
[10:36:27+0000] Building wheels for collected packages: dlib, face-recognition-models, python-constraint
[10:36:27+0000] Building wheel for dlib ( started
[10:36:28+0000] Building wheel for dlib ( finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /github/workspace/pythonenv3.8/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-3geqzfcc/dlib/'"'"'; file='"'"'/tmp/pip-install-3geqzfcc/dlib/'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);'"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-mds3svy8
cwd: /tmp/pip-install-3geqzfcc/dlib/
Complete output (53 lines):
running bdist_wheel
running build
running build_py
package init file 'tools/python/dlib/' not found (or not a regular file)
running build_ext
Traceback (most recent call last):
File "/tmp/pip-install-3geqzfcc/dlib/", line 120, in get_cmake_version
out = subprocess.check_output(['cmake', '--version'])
File "/tmp/oryx/platforms/python/3.8.6/lib/python3.8/", line 411, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "/tmp/oryx/platforms/python/3.8.6/lib/python3.8/", line 489, in run
with Popen(popenargs, *kwargs) as process:
File "/tmp/oryx/platforms/python/3.8.6/lib/python3.8/", line 854, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "/tmp/oryx/platforms/python/3.8.6/lib/python3.8/", line 1702, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'cmake'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-3geqzfcc/dlib/", line 223, in <module>
File "/github/workspace/pythonenv3.8/lib/python3.8/site-packages/setuptools/", line 165, in setup
return distutils.core.setup(attrs)
File "/tmp/oryx/platforms/python/3.8.6/lib/python3.8/distutils/", line 148, in setup
File "/tmp/oryx/platforms/python/3.8.6/lib/python3.8/distutils/", line 966, in run_commands
File "/tmp/oryx/platforms/python/3.8.6/lib/python3.8/distutils/", line 985, in run_command
File "/tmp/oryx/platforms/python/3.8.6/lib/python3.8/site-packages/wheel/", line 290, in run
File "/tmp/oryx/platforms/python/3.8.6/lib/python3.8/distutils/", line 313, in run_command
File "/tmp/oryx/platforms/python/3.8.6/lib/python3.8/distutils/", line 985, in run_command
File "/tmp/oryx/platforms/python/3.8.6/lib/python3.8/distutils/command/", line 135, in run
File "/tmp/oryx/platforms/python/3.8.6/lib/python3.8/distutils/", line 313, in run_command
File "/tmp/oryx/platforms/python/3.8.6/lib/python3.8/distutils/", line 985, in run_command
File "/tmp/pip-install-3geqzfcc/dlib/", line 129, in run
cmake_version = self.get_cmake_version()
File "/tmp/pip-install-3geqzfcc/dlib/", line 122, in get_cmake_version
raise RuntimeError("\n
\n" +

CMake must be installed to build the following extensions: _dlib_pybind11

ERROR: Failed building wheel for dlib
[10:36:28+0000] Running clean for dlib
[10:36:28+0000] Building wheel for face-recognition-models ( started
[10:36:43+0000] Building wheel for face-recognition-models ( finished with status 'done'
[10:36:44+0000] Created wheel for face-recognition-models: filename=face_recognition_models-0.3.0-py2.py3-none-any.whl size=100566173 sha256=381ee47ede1c18da837f6090590d25f9b8d0d3078c4a46dbe074b2350c902f22
[10:36:44+0000] Stored in directory: /usr/local/share/pip-cache/wheels/b4/4b/8f/751e99d45f089bdf366a7d3e5066db3c2b84a62e4377f534d7
[10:36:44+0000] Building wheel for python-constraint ( started
[10:36:44+0000] Building wheel for python-constraint ( finished with status 'done'
[10:36:44+0000] Created wheel for python-constraint: filename=python_constraint-1.4.0-py2.py3-none-any.whl size=24080 sha256=1647e748fc22f706da9caa0028f752d3fbf220c445ee26793296213b10a102f1
[10:36:44+0000] Stored in directory: /usr/local/share/pip-cache/wheels/86/ba/5c/4e9115777de42c6a2e1ca77ef7c9d0d479254c5080341b55c5
[10:36:44+0000] Successfully built face-recognition-models python-constraint
[10:36:44+0000] Failed to build dlib
DEPRECATION: Could not build wheels for dlib which do not use PEP 517. pip will fall back to legacy ' install' for these. pip 21.0 will remove support for this functionality. A possible replacement is to fix the wheel build issue reported above. You can find discussion regarding this at
[10:36:44+0000] Installing collected packages: asgiref, click, cmake, cv, sqlparse, pytz, Django, django-crispy-forms, dlib, face-recognition-models, Pillow, numpy, face-recognition, gunicorn, opencv-python, whitenoise, python-constraint, scipy, PyWavelets, six, imagehash, cv2-tools
[10:36:48+0000] Running install for dlib: started
[10:37:50+0000] Running install for dlib: still running...
[10:39:01+0000] Running install for dlib: still running...
[10:40:06+0000] Running install for dlib: still running...
[10:41:13+0000] Running install for dlib: still running...
[10:42:18+0000] Running install for dlib: still running...
[10:43:43+0000] Running install for dlib: still running...
[10:43:45+0000] Running install for dlib: finished with status 'done'
[10:43:53+0000] Successfully installed Django-3.1.6 Pillow-8.1.0 PyWavelets-1.1.1 asgiref-3.3.1 click-7.1.2 cmake-3.18.4.post1 cv-1.0.0 cv2-tools-2.4.0 django-crispy-forms-1.11.0 dlib-19.21.1 face-recognition-1.3.0 face-recognition-models-0.3.0 gunicorn-20.0.4 imagehash-4.2.0 numpy-1.20.1 opencv-python- python-constraint-1.4.0 pytz-2021.1 scipy-1.6.1 six-1.15.0 sqlparse-0.4.1 whitenoise-5.2.0
WARNING: You are using pip version 20.2.1; however, version 21.0.1 is available.
You should consider upgrading via the '/github/workspace/pythonenv3.8/bin/python -m pip install --upgrade pip' command.

Content in source directory is a Django app
Running collectstatic...

134 static files copied to '/github/workspace/static'.
'collectstatic' exited with exit code .
Done in 0 sec(s).

Removing existing manifest file
Creating a manifest file...
Manifest file created.

Done in 469 sec(s).

10 |1000 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.

1 Answer

brtrachMSFT-0711 avatar image
0 Votes"
brtrachMSFT-0711 answered ·

@ManveerSinghKahlon-8000 We apologize for the error that you have encountered.

Can you please try to execute the command below to see if that resolves the error? Please let us know the outcome.

 apt-get update
 apt-get install -y libsm6 libxext6 libxrender-dev
 pip install opencv-python
· 1 ·
10 |1000 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.

Unfortunately i cannot execute the commands since the application is being built through github workflow cli. I have seen solutions to add additional commands to add dependencies however those require the creation of custom docker image. This in turn requires the use of a service principal to use azure ad which i am unable to do so for some reason on a student subscription.

0 Votes 0 ·