Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conda installed packages not found in container any more. #277

Open
sorenwacker opened this issue Feb 10, 2022 · 0 comments
Open

Conda installed packages not found in container any more. #277

sorenwacker opened this issue Feb 10, 2022 · 0 comments

Comments

@sorenwacker
Copy link

sorenwacker commented Feb 10, 2022

For some reason, conda installed packages are not found anymore inside the container.
First, I had issues that pip was not found during build. Now the build runs through, however I cannot start my service as Django is cannot be imported.

dockerfile:

FROM continuumio/miniconda3
ENV PYTHONUNBUFFERED=1
RUN mkdir /static
RUN apt update && apt install -y build-essential time libgraphviz-dev graphviz
RUN conda install -c conda-forge python==3.10 django==4 pip
COPY backend/requirements.txt requirements.txt
RUN pip install -r requirements.txt
COPY ./backend /backend
WORKDIR /backend/

docker-compose.yml:

version: "3.3"
   
services:
  backend:
    container_name: backend
    restart: never
    #user: ${UID}
    build: 
      context: .
      dockerfile: dockerfiles/Dockerfile-backend
    env_file:
      - ./.env
    command: ./manage.py runserver --database docker
    volumes:
      - ./backend/:/backend/
      - ${STATIC}:/static/
    ports:
      - "8000:8000"
    depends_on:
      - db
  
  db:
    container_name: db
    restart: always
    image: postgres:13.4
    volumes:
      - ${DB}:/var/lib/postgresql/data
    environment:
      - POSTGRES_DB=postgres
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres

I tried various things like actually creating an environment other than base and added commands like this:

SHELL ["conda", "run", "-n", "base", "/bin/bash", "-c"]

I also changed the command in the docker-compose file accordingly, but nothing worked so far:

     command: conda run -n base -c './manage.py runserver --database docker'

I am a bit puzzled, because the same setup ran smoothly since almost a year in another project, and I did not have to add such things. Did something change with the image?

ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant