Workaround to install cmake on GCP App Engine Standard Environment

Viewed 370

I need to install dlib package on App Engine Standard for an application that requires cmake. Below is the error I am facing while the installation.

I tried adding cmake and cmake-setup in requirements.txt but no use.

ERROR: Failed to build one or more wheels
  ERROR: Failed building wheel for dlib
  ----------------------------------------
  
  *******************************************************************
   CMake must be installed to build the following extensions: _dlib_pybind11
  *******************************************************************
  RuntimeError:
      "\n*******************************************************************\n")
 File "/tmp/pip-wheel-hz_z90ap/dlib/setup.py", line 125, in get_cmake_version
      cmake_version = self.get_cmake_version()
    File "/tmp/pip-wheel-hz_z90ap/dlib/setup.py", line 129, in run
      cmd_obj.run()
    File "/opt/python3.7/lib/python3.7/distutils/dist.py", line 985, in run_command
      self.distribution.run_command(command)
    File "/opt/python3.7/lib/python3.7/distutils/cmd.py", line 313, in run_command
      self.run_command(cmd_name)
    File "/opt/python3.7/lib/python3.7/distutils/command/build.py", line 135, in run
      cmd_obj.run()
    File "/opt/python3.7/lib/python3.7/distutils/dist.py", line 985, in run_command
      self.distribution.run_command(command)
    File "/opt/python3.7/lib/python3.7/distutils/cmd.py", line 313, in run_command
      self.run_command('build')
    File "/env/lib/python3.7/site-packages/wheel/bdist_wheel.py", line 290, in run
      cmd_obj.run()
    File "/opt/python3.7/lib/python3.7/distutils/dist.py", line 985, in run_command
      self.run_command(cmd)
    File "/opt/python3.7/lib/python3.7/distutils/dist.py", line 966, in run_commands
      dist.run_commands()
    File "/opt/python3.7/lib/python3.7/distutils/core.py", line 148, in setup
      return distutils.core.setup(**attrs)
    File "/env/lib/python3.7/site-packages/setuptools/__init__.py", line 144, in setup
      'Topic :: Software Development',
    File "/tmp/pip-wheel-hz_z90ap/dlib/setup.py", line 262, in <module>
    File "<string>", line 1, in <module>
  Traceback (most recent call last):
...

Please suggest a fix.

2 Answers

You can use non-Python dependencies in the Flexible environment, via a custom runtime. From About Custom Runtimes:

Custom runtimes allow you to define new runtime environments, which might include additional components like language interpreters or application servers.

See also Building Custom Runtimes.

If you want to customize your environment, you can use a container. Deploy it on App Engine flexible as suggested by Dustin but, be careful App Engine Flex doesn't scale to 0, and thus you pay even if your service isn't used.

Because you have a container, I recommend you to have a look to Cloud Run. It's similar to App Engine, but it scales to 0 and it's very powerful.

Related