Skip to content

Torch is not found in Dockerfile #5117

@Tickets14

Description

@Tickets14

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 "<string>", line 2, in <module>
3.930         File "<pip-setuptools-caller>", line 34, in <module>
3.930         File "/tmp/pip-req-build-sz8hbgh3/setup.py", line 10, in <module>
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

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