I can install fastai inside docker without seeing any error however my python program is not able to import/use fastai.
My docker files looks like below:
FROM python:3.8-slim-buster
RUN apt-get update \
&& apt-get install -y --no-install-recommends apt-utils gcc build-essential
# Keeps Python from generating .pyc files in the container
ENV PYTHONDONTWRITEBYTECODE=1
# Turns off buffering for easier container logging
ENV PYTHONUNBUFFERED=1
# Install pip requirements
RUN python -m pip install -r requirements.txt
WORKDIR /app
ADD . .
CMD ["python", "/app/prog.py"]
And my requirements.txt file look like below:
-f https://download.pytorch.org/whl/torch_stable.html
torch==1.7.0+cpu
torchaudio==0.7.0
torchvision==0.8.1+cpu
fastai==2.1.4
My sample prog.py looks like below:
from fastai import *
from fastai.text import *
import torch
if __name__ =='__main__':
defaults.device = torch.device("cpu")
My program is failing with error:
NameError: name ‘defaults’ is not defined
I did some investigation and found that in installed location, the fast.text.init.py file is empty which is not case with my conda installation on my host machine.