Skip to content

Docker cannot build, RUN pip install mmseg fails #563

@JSchuurmans

Description

@JSchuurmans

Checklist

  1. I have searched related issues but cannot get the expected help. Yes
  2. The bug has not been fixed in the latest version. No

Describe the bug
Docker cannot build the image. RUN pip install mmseg fails. It looks like a python 2 vs 3 incompatibility. See Error traceback and Bug fix.

Reproduction

  1. What command or script did you run?
docker build -t mmdetection3d docker/
  1. Did you make any modifications on the code or config? No

Environment

Docker

Error traceback

Step 11/19 : RUN pip install mmseg
 ---> Running in 798c6d89b234
Collecting mmseg
  Downloading mmseg-1.3.0.tar.gz (817 kB)
    ERROR: Command errored out with exit status 1:
     command: /opt/conda/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ofv4t21p/mmseg/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ofv4t21p/mmseg/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-ofv4t21p/mmseg/pip-egg-info
         cwd: /tmp/pip-install-ofv4t21p/mmseg/
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-ofv4t21p/mmseg/setup.py", line 6, in <module>
        reload(sys)
    NameError: name 'reload' is not defined
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
The command '/bin/sh -c pip install mmseg' returned a non-zero code: 1

Bug fix
Comment out the line that errors. This is not a fix, more like a workaround. (EDIT:

# RUN pip install mmseg

EDIT: Docker builds, but running demo fails because it cannot import mmseg.

docker run --gpus all --shm-size=8g -it -v /bigdata/:/mmdetection3d/data mmdetection3d

root@bb54c2e6f3dd:/mmdetection3d# python demo/pcd_demo.py demo/data/kitti/kitti_000008.bin configs/second/hv_second_secfpn_6x8_80e_kitti-3d-car.py checkpoints/hv_second_secfpn_6x8_80e_kitti-3d-car_20200620_230238-393f000c.pth
Traceback (most recent call last):
  File "demo/pcd_demo.py", line 3, in <module>
    from mmdet3d.apis import inference_detector, init_model, show_result_meshlab
  File "/mmdetection3d/mmdet3d/__init__.py", line 4, in <module>
    import mmseg
ModuleNotFoundError: No module named 'mmseg'

I found the following on https://www.programmersought.com/article/91541059533/ .
ForPython 2.X:

import sys
reload(sys)
sys.setdefaultencoding("utf-8")

For >=Python 3.4:

import importlib
importlib.reload(sys)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions