Home > Back-end >  Unable install Django through Dockerfile
Unable install Django through Dockerfile

Time:05-17

when I run 'docker build .' command, "ERROR: Invalid requirement: 'Django=>4.0.4' (from line 1 of /requirements.txt) WARNING: You are using pip version 22.0.4; however, version 22.1 is available. You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command."

this error shows up. I have upgraded pip to the latest version. When I check version of pip , it shows 22.1. But when I run docker build command again, nothing changes. I have upgraded from this /usr/local/bin/python location. but still nothing changed.

I am using Ubuntu 20.04, python version is 3.8.

my docker file:

FROM python:3.8-alpine
MAINTAINER Kanan App Developer

ENV PYTHONUNBUFFERED 1

COPY ./requirements.txt /requirements.txt
RUN pip install -r /requirements.txt

RUN mkdir /app
WORKDIR /app
COPY ./app /app

RUN adduser -D user
USER user

requirements.txt file:

Django=>4.0.4
djangorestframework=>3.13.1

CodePudding user response:

Just use == or >= instead => in your requirements.txt, like this

Django==4.0.4
djangorestframework==3.13.1

CodePudding user response:

=> is not a valid realtional operator for greater than or equal to.

The valid operator is >=. So, your requirements.txt file should be:

Django>=4.0.4
djangorestframework>=3.13.1
  • Related