Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Unable to build Docker Image #275

Open
arshagarwal opened this issue Sep 11, 2020 · 8 comments
Open

Unable to build Docker Image #275

arshagarwal opened this issue Sep 11, 2020 · 8 comments

Comments

@arshagarwal
Copy link

arshagarwal commented Sep 11, 2020

While building the docker image using docker build -t densepose:c2-cuda9-cudnn7 . the following error was encountered:

Step 7/13 : RUN pip install -r /densepose/requirements.txt
 ---> Running in 9cdffe87ef82
Requirement already satisfied: numpy>=1.13 in /usr/local/lib/python2.7/dist-packages (from -r /densepose/requirements.txt (line 1))
Collecting pyyaml>=3.12 (from -r /densepose/requirements.txt (line 2))
  Downloading https://files.pythonhosted.org/packages/64/c2/b80047c7ac2478f9501676c988a5411ed5572f35d1beff9cae07d321512c/PyYAML-5.3.1.tar.gz (269kB)
Requirement already satisfied: matplotlib in /usr/local/lib/python2.7/dist-packages (from -r /densepose/requirements.txt (line 3))
Collecting opencv-python>=3.2 (from -r /densepose/requirements.txt (line 4))
  Downloading https://files.pythonhosted.org/packages/a1/d6/8422797e35f8814b1d9842530566a949d9b5850a466321a6c1d5a99055ee/opencv-python-4.3.0.38.tar.gz (88.0MB)
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-z0GaqG/opencv-python/setup.py", line 9, in <module>
        import skbuild
    ImportError: No module named skbuild 

Has anyone fixed this?
Any help is highly appreciated.

@RSKothari
Copy link

Did you make any progress on this @arshagarwal ?

@arshagarwal
Copy link
Author

No, I am afraid. @RSKothari

@handrew
Copy link

handrew commented Oct 17, 2020

According to the OpenCV PyPI page, this error is due to having an old version of pip. In the Dockerfile before pip installing the requirements, you should simply add RUN pip install --upgrade pip.

That gets me past this error, but it fails to build for something else!

  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python2 /usr/local/lib/python2.7/dist-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmpaMKMfJ
       cwd: /tmp/pip-install-BKWgzr/opencv-python
  Complete output (22 lines):
  Traceback (most recent call last):
    File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/pep517/_in_process.py", line 280, in <module>
      main()
    File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/pep517/_in_process.py", line 263, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/pep517/_in_process.py", line 114, in get_requires_for_build_wheel
      return hook(config_settings)
    File "/tmp/pip-build-env-amxONp/overlay/lib/python2.7/site-packages/setuptools/build_meta.py", line 146, in get_requires_for_build_wheel
      return self._get_build_requires(config_settings, requirements=['wheel'])
    File "/tmp/pip-build-env-amxONp/overlay/lib/python2.7/site-packages/setuptools/build_meta.py", line 127, in _get_build_requires
      self.run_setup()
    File "/tmp/pip-build-env-amxONp/overlay/lib/python2.7/site-packages/setuptools/build_meta.py", line 243, in run_setup
      self).run_setup(setup_script=setup_script)
    File "/tmp/pip-build-env-amxONp/overlay/lib/python2.7/site-packages/setuptools/build_meta.py", line 142, in run_setup
      exec(compile(code, __file__, 'exec'), locals())
    File "setup.py", line 448, in <module>
      main()
    File "setup.py", line 99, in main
      % {"ext": re.escape(sysconfig.get_config_var("EXT_SUFFIX"))}
    File "/usr/lib/python2.7/re.py", line 210, in escape
      s = list(pattern)
  TypeError: 'NoneType' object is not iterable
  ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python2 /usr/local/lib/python2.7/dist-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmpaMKMfJ Check the logs for full command output.

@mhq6634
Copy link

mhq6634 commented Oct 19, 2020

@handrew do you have any updates on how to resolve the new error? I get the same

@handrew
Copy link

handrew commented Oct 19, 2020

Fixing the versions of pyyaml (#233) and opencv-python in requirements.txt will do it. Then it works for me!

@grapefruitL
Copy link

grapefruitL commented Nov 3, 2020

@handrew
i still got err:

Step 8/15 : RUN pip install --upgrade pip -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
 ---> Running in b9cfc0377dd4
Collecting pip
  Downloading http://mirrors.aliyun.com/pypi/packages/cb/28/91f26bd088ce8e22169032100d4260614fc3da435025ff389ef1d396a433/pip-20.2.4-py2.py3-none-any.whl (1.5MB)
Installing collected packages: pip
  Found existing installation: pip 9.0.1
    Uninstalling pip-9.0.1:
      Successfully uninstalled pip-9.0.1
Successfully installed pip-20.2.4
Removing intermediate container b9cfc0377dd4
 ---> 4e4ffb98bc5a
Step 9/15 : RUN pip install -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com -r /densepose/requirements.txt
 ---> Running in 8a01bf720696
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Looking in indexes: http://mirrors.aliyun.com/pypi/simple/
Requirement already satisfied: numpy>=1.13 in /usr/local/lib/python2.7/dist-packages (from -r /densepose/requirements.txt (line 1)) (1.14.0)
Collecting pyyaml==3.12
  Downloading http://mirrors.aliyun.com/pypi/packages/4a/85/db5a2df477072b2902b0eb892feb37d88ac635d36245a72a6a69b23b383a/PyYAML-3.12.tar.gz (253 kB)
Requirement already satisfied: matplotlib in /usr/local/lib/python2.7/dist-packages (from -r /densepose/requirements.txt (line 3)) (2.1.1)
Collecting opencv-python>=3.2
  Downloading http://mirrors.aliyun.com/pypi/packages/a1/d6/8422797e35f8814b1d9842530566a949d9b5850a466321a6c1d5a99055ee/opencv-python-4.3.0.38.tar.gz (88.0 MB)
  Installing build dependencies: started
  Installing build dependencies: still running...
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'error'
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python2 /usr/local/lib/python2.7/dist-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmp_ouhfF
       cwd: /tmp/pip-install-b2pPsK/opencv-python
  Complete output (22 lines):
  Traceback (most recent call last):
    File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/pep517/_in_process.py", line 280, in <module>
      main()
    File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/pep517/_in_process.py", line 263, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/pep517/_in_process.py", line 114, in get_requires_for_build_wheel
      return hook(config_settings)
    File "/tmp/pip-build-env-kZZEKX/overlay/lib/python2.7/site-packages/setuptools/build_meta.py", line 146, in get_requires_for_build_wheel
      return self._get_build_requires(config_settings, requirements=['wheel'])
    File "/tmp/pip-build-env-kZZEKX/overlay/lib/python2.7/site-packages/setuptools/build_meta.py", line 127, in _get_build_requires
      self.run_setup()
    File "/tmp/pip-build-env-kZZEKX/overlay/lib/python2.7/site-packages/setuptools/build_meta.py", line 243, in run_setup
      self).run_setup(setup_script=setup_script)
    File "/tmp/pip-build-env-kZZEKX/overlay/lib/python2.7/site-packages/setuptools/build_meta.py", line 142, in run_setup
      exec(compile(code, __file__, 'exec'), locals())
    File "setup.py", line 448, in <module>
      main()
    File "setup.py", line 99, in main
      % {"ext": re.escape(sysconfig.get_config_var("EXT_SUFFIX"))}
    File "/usr/lib/python2.7/re.py", line 210, in escape
      s = list(pattern)
  TypeError: 'NoneType' object is not iterable
  ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python2 /usr/local/lib/python2.7/dist-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmp_ouhfF Check the logs for full command output.

i have updated pip and specified the version of pyyaml as you can see in the log above
Can you figure out what's going on?

@camenares
Copy link

camenares commented Nov 24, 2020

@grapefruitL I was getting the exact same errors as you. I changed all >= to == in the requirements, and used 3.2.0.6 for opencv. I'm sure there's a cleaner way, but my Dockerfile is now:

# Use Caffe2 image as parent image
FROM caffe2/caffe2:snapshot-py2-cuda9.0-cudnn7-ubuntu16.04

RUN mv /usr/local/caffe2 /usr/local/caffe2_build
ENV Caffe2_DIR /usr/local/caffe2_build

ENV PYTHONPATH /usr/local/caffe2_build:${PYTHONPATH}
ENV LD_LIBRARY_PATH /usr/local/caffe2_build/lib:${LD_LIBRARY_PATH}

# Clone the Detectron repository
RUN git clone https://github.com/facebookresearch/densepose /densepose

# Change Requirements
RUN find /densepose/requirements.txt -type f -exec sed -i 's/>=/==/g' {} \;
RUN find /densepose/requirements.txt -type f -exec sed -i 's/3.2/3.2.0.6/g' {} \;

# Update Pip
RUN pip install --upgrade pip

# Install Python dependencies
RUN pip install -r /densepose/requirements.txt

# Install the COCO API
RUN git clone https://github.com/cocodataset/cocoapi.git /cocoapi
WORKDIR /cocoapi/PythonAPI
RUN make install

# Go to Densepose root
WORKDIR /densepose

# Set up Python modules
RUN make

# [Optional] Build custom ops
RUN make ops

This allowed docker build -t densepose:c2-cuda9-cudnn7 . to complete successfully, and the subsequent

nvidia-docker run --rm -it densepose:c2-cuda9-cudnn7 python2 detectron/tests/test_batch_permutation_op.py

@grapefruitL
Copy link

@camenares thanks! solve it!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants