Tensorflow 2 Object Detection API docker build error

Hi,
I tried to do “docker build” from the models/research/object_detection/dockerfiles/tf2/Dockerfile
and got the following error. How I can fix it?
Thanks for any help.

Building wheel for dm-tree (setup.py): started
Building wheel for dm-tree (setup.py): finished with status ‘error’
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python -u -c ‘import io, os, sys, setuptools, tokenize; sys.argv[0] = ‘"’"’/tmp/pip-install-z_albvhs/dm-tree_ad6b4637bd08415abff9b9eedd488aa7/setup.py’"’"’; file=’"’"’/tmp/pip-install-z_albvhs/dm-tree_ad6b4637bd08415abff9b9eedd488aa7/setup.py’"’"’;f = getattr(tokenize, ‘"’"‘open’"’"’, open)(file) if os.path.exists(file) else io.StringIO(’"’"‘from setuptools import setup; setup()’"’"’);code = f.read().replace(’"’"’\r\n’"’"’, ‘"’"’\n’"’"’);f.close();exec(compile(code, file, ‘"’"‘exec’"’"’))’ bdist_wheel -d /tmp/pip-wheel-89wrvuv6
cwd: /tmp/pip-install-z_albvhs/dm-tree_ad6b4637bd08415abff9b9eedd488aa7/
Complete output (55 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/tree
copying tree/tree_benchmark.py → build/lib.linux-x86_64-3.6/tree
copying tree/init.py → build/lib.linux-x86_64-3.6/tree
copying tree/tree_test.py → build/lib.linux-x86_64-3.6/tree
copying tree/sequence.py → build/lib.linux-x86_64-3.6/tree
running build_ext
Traceback (most recent call last):
File “/tmp/pip-install-z_albvhs/dm-tree_ad6b4637bd08415abff9b9eedd488aa7/setup.py”, line 77, in _check_build_environment
subprocess.check_call([‘cmake’, ‘–version’])
File “/usr/lib/python3.6/subprocess.py”, line 306, in check_call
retcode = call(*popenargs, **kwargs)
File “/usr/lib/python3.6/subprocess.py”, line 287, in call
with Popen(*popenargs, **kwargs) as p:
File “/usr/lib/python3.6/subprocess.py”, line 729, in init
restore_signals, start_new_session)
File “/usr/lib/python3.6/subprocess.py”, line 1364, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: ‘cmake’: ‘cmake’

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “”, line 1, in
File “/tmp/pip-install-z_albvhs/dm-tree_ad6b4637bd08415abff9b9eedd488aa7/setup.py”, line 155, in
keywords=‘tree nest flatten’,
File “/usr/local/lib/python3.6/dist-packages/setuptools/init.py”, line 153, in setup
return distutils.core.setup(**attrs)
File “/usr/lib/python3.6/distutils/core.py”, line 148, in setup
dist.run_commands()
File “/usr/lib/python3.6/distutils/dist.py”, line 955, in run_commands
self.run_command(cmd)
File “/usr/lib/python3.6/distutils/dist.py”, line 974, in run_command
cmd_obj.run()
File “/usr/lib/python3/dist-packages/wheel/bdist_wheel.py”, line 204, in run
self.run_command(‘build’)
File “/usr/lib/python3.6/distutils/cmd.py”, line 313, in run_command
self.distribution.run_command(command)
File “/usr/lib/python3.6/distutils/dist.py”, line 974, in run_command
cmd_obj.run()
File “/usr/lib/python3.6/distutils/command/build.py”, line 135, in run
self.run_command(cmd_name)
File “/usr/lib/python3.6/distutils/cmd.py”, line 313, in run_command
self.distribution.run_command(command)
File “/usr/lib/python3.6/distutils/dist.py”, line 974, in run_command
cmd_obj.run()
File “/tmp/pip-install-z_albvhs/dm-tree_ad6b4637bd08415abff9b9eedd488aa7/setup.py”, line 70, in run
self._check_build_environment()
File “/tmp/pip-install-z_albvhs/dm-tree_ad6b4637bd08415abff9b9eedd488aa7/setup.py”, line 82, in _check_build_environment
) from e
RuntimeError: CMake must be installed to build the following extensions: _tree

ERROR: Failed building wheel for dm-tree
Running setup.py clean for dm-tree
Building wheel for docopt (setup.py): started
Building wheel for docopt (setup.py): finished with status ‘done’
Created wheel for docopt: filename=docopt-0.6.2-py2.py3-none-any.whl size=19852 sha256=f390926b2a96adb2c573c342f9390ce2644756190c86e50f18c1f82a8e407bc2
Stored in directory: /home/tensorflow/.cache/pip/wheels/3f/2a/fa/4d7a888e69774d5e6e855d190a8a51b357d77cc05eb1c097c9
Building wheel for promise (setup.py): started
Building wheel for promise (setup.py): finished with status ‘done’
Created wheel for promise: filename=promise-2.3-py3-none-any.whl size=23950 sha256=5279ad2957508d846b150764576bdcfbcb9c2d0e4958da85e009e497e28bea99
Stored in directory: /home/tensorflow/.cache/pip/wheels/59/9a/1d/3f1afbbb5122d0410547bf9eb50955f4a7a98e53a6d8b99bd1
Successfully built object-detection avro-python3 pycocotools crcmod dill kaggle opencv-python opencv-python-headless seqeval clang docopt promise
Failed to build dm-tree
Installing collected packages: google-auth, wheel, tensorboard-data-server, pyparsing, protobuf, numpy, grpcio, cached-property, typing-extensions, threadpoolctl, text-unidecode, tensorflow-estimator, tensorboard, scipy, python-dateutil, pillow, kiwisolver, keras, joblib, importlib-resources, httplib2, h5py, googleapis-common-protos, gast, flatbuffers, cycler, clang, uritemplate, typeguard, tqdm, tensorflow-metadata, tensorflow-hub, tensorflow, tabulate, scikit-learn, regex, pytz, python-slugify, promise, portalocker, matplotlib, google-auth-httplib2, google-api-core, docopt, dm-tree, dill, dataclasses, colorama, tf-slim, tensorflow-text, tensorflow-model-optimization, tensorflow-io-gcs-filesystem, tensorflow-datasets, tensorflow-addons, seqeval, sentencepiece, sacrebleu, pyyaml, pymongo, pydot, pycocotools, pyarrow, py-cpuinfo, psutil, proto-plus, pandas, orjson, opencv-python-headless, opencv-python, oauth2client, kaggle, hdfs, google-api-python-client, gin-config, fastavro, Cython, crcmod, cloudpickle, tf-models-official, tensorflow-io, lvis, contextlib2, avro-python3, apache-beam, object-detection
Running setup.py install for dm-tree: started
Running setup.py install for dm-tree: finished with status ‘error’
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python -u -c ‘import io, os, sys, setuptools, tokenize; sys.argv[0] = ‘"’"’/tmp/pip-install-z_albvhs/dm-tree_ad6b4637bd08415abff9b9eedd488aa7/setup.py’"’"’; file=’"’"’/tmp/pip-install-z_albvhs/dm-tree_ad6b4637bd08415abff9b9eedd488aa7/setup.py’"’"’;f = getattr(tokenize, ‘"’"‘open’"’"’, open)(file) if os.path.exists(file) else io.StringIO(’"’"‘from setuptools import setup; setup()’"’"’);code = f.read().replace(’"’"’\r\n’"’"’, ‘"’"’\n’"’"’);f.close();exec(compile(code, file, ‘"’"‘exec’"’"’))’ install --record /tmp/pip-record-wcl1pb12/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/tensorflow/.local/include/python3.6m/dm-tree
cwd: /tmp/pip-install-z_albvhs/dm-tree_ad6b4637bd08415abff9b9eedd488aa7/
Complete output (57 lines):
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/tree
copying tree/tree_benchmark.py → build/lib.linux-x86_64-3.6/tree
copying tree/init.py → build/lib.linux-x86_64-3.6/tree
copying tree/tree_test.py → build/lib.linux-x86_64-3.6/tree
copying tree/sequence.py → build/lib.linux-x86_64-3.6/tree
running build_ext
Traceback (most recent call last):
File “/tmp/pip-install-z_albvhs/dm-tree_ad6b4637bd08415abff9b9eedd488aa7/setup.py”, line 77, in _check_build_environment
subprocess.check_call([‘cmake’, ‘–version’])
File “/usr/lib/python3.6/subprocess.py”, line 306, in check_call
retcode = call(*popenargs, **kwargs)
File “/usr/lib/python3.6/subprocess.py”, line 287, in call
with Popen(*popenargs, **kwargs) as p:
File “/usr/lib/python3.6/subprocess.py”, line 729, in init
restore_signals, start_new_session)
File “/usr/lib/python3.6/subprocess.py”, line 1364, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: ‘cmake’: ‘cmake’

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/pip-install-z_albvhs/dm-tree_ad6b4637bd08415abff9b9eedd488aa7/setup.py", line 155, in <module>
    keywords='tree nest flatten',
  File "/usr/local/lib/python3.6/dist-packages/setuptools/__init__.py", line 153, in setup
    return distutils.core.setup(**attrs)
  File "/usr/lib/python3.6/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/lib/python3.6/distutils/dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/usr/local/lib/python3.6/dist-packages/setuptools/command/install.py", line 61, in run
    return orig.install.run(self)
  File "/usr/lib/python3.6/distutils/command/install.py", line 589, in run
    self.run_command('build')
  File "/usr/lib/python3.6/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/usr/lib/python3.6/distutils/command/build.py", line 135, in run
    self.run_command(cmd_name)
  File "/usr/lib/python3.6/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/tmp/pip-install-z_albvhs/dm-tree_ad6b4637bd08415abff9b9eedd488aa7/setup.py", line 70, in run
    self._check_build_environment()
  File "/tmp/pip-install-z_albvhs/dm-tree_ad6b4637bd08415abff9b9eedd488aa7/setup.py", line 82, in _check_build_environment
    ) from e
RuntimeError: CMake must be installed to build the following extensions: _tree
----------------------------------------

ERROR: Command errored out with exit status 1: /usr/local/bin/python -u -c ‘import io, os, sys, setuptools, tokenize; sys.argv[0] = ‘"’"’/tmp/pip-install-z_albvhs/dm-tree_ad6b4637bd08415abff9b9eedd488aa7/setup.py’"’"’; file=’"’"’/tmp/pip-install-z_albvhs/dm-tree_ad6b4637bd08415abff9b9eedd488aa7/setup.py’"’"’;f = getattr(tokenize, ‘"’"‘open’"’"’, open)(file) if os.path.exists(file) else io.StringIO(’"’"‘from setuptools import setup; setup()’"’"’);code = f.read().replace(’"’"’\r\n’"’"’, ‘"’"’\n’"’"’);f.close();exec(compile(code, file, ‘"’"‘exec’"’"’))’ install --record /tmp/pip-record-wcl1pb12/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/tensorflow/.local/include/python3.6m/dm-tree Check the logs for full command output.
The command ‘/bin/bash -c python -m pip install .’ returned a non-zero code: 1

@moshe_amitay

Welcome to the Tensorflow Forum!

Apologies. We are not supporting research models at this point of time.
Instead, we have come up with a new collection of official models with improved speed and performance .
Link to the official models : models/official at master · tensorflow/models · GitHub

Use below pip command to get started with the official models. Refer to the object detection tutorial if required.
pip3 install tf-models-official

Object detection Tutorial : Object detection with Model Garden  |  TensorFlow Core

Additionally refer the below link on step by step on how to get started with the official models: models/official at master · tensorflow/models · GitHub

Let us know if this works for you.

Thank you!

Hi Tanya
Thanks a lot - it works!
Moshe.

Hi Tanya
How I can convert my custom dataset to TFRECORDS file for segmentation?
(the example at TF tutorial here uses TF dataset and not suitable for custom datasets).