facebookresearch / facebookresearch/detectron2

Torch is not found in Dockerfile

Open
#5,117 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
34.7k
Forks
7.9k
PR merge metrics
No merged PRs in 30d

Description

Error when building a detectron2 on docker
Hello. Im experiencing a weird behavior where if im building a docker with detectron2 it always showing an error
```
3.930 × python setup.py egg_info did not run successfully.
3.930 │ exit code: 1
3.930 ╰─> [6 lines of output]
3.930 Traceback (most recent call last):
3.930 File "", line 2, in
3.930 File "", line 34, in
3.930 File "/tmp/pip-req-build-sz8hbgh3/setup.py", line 10, in
3.930 import torch
3.930 ModuleNotFoundError: No module named 'torch'
3.930 [end of output]
```
Here is my Dokerfile

```
FROM public.ecr.aws/lambda/python:3.9

# Install Git
RUN yum install -y git

# Copy requirements.txt
COPY requirements.txt ./

# Install the specified packages
RUN pip3 install -r requirements.txt;

COPY sample.py ./
CMD [ "sampl.handler"]
```

Here is my requirements.txt
```
boto3==1.28.62
Pillow==10.0.1
numpy==1.24.3
torch==2.0.0
torchvision==0.15.1
opencv-python==4.6.0.66
git+https://github.com/facebookresearch/detectron2.git

```

Contributor guide

Open the contributing guide

Research direction

Reproduce the Docker build from the shown Dockerfile using requirements.txt, then inspect the dependency installation order around torch and the git-based detectron2 package. The work is done when the image builds successfully without the ModuleNotFoundError for torch.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, python, pytorch
Domain
build-system, machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.