Skip to content
Advertisement

How can I activate conda venv in Dockerfile? (pip not found)

I’m trying to build a docker image like

FROM ubuntu:latest
RUN apt update && apt upgrade -y && 
        apt install -y git wget libsuitesparse-dev gcc g++ swig && 
        cd ~ && wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && 
        sh Miniconda3-latest-Linux-x86_64.sh -b && rm Miniconda3-latest-Linux-x86_64.sh && 
        PATH=$PATH:~/miniconda3/condabin && 
        conda init bash && conda upgrade -y conda && /bin/bash -c "source ~/.bashrc" && 
        pip install numpy scipy matplotlib scikit_umfpack

However, /bin/bash -c "source ~/.bashrc" does not work… so I got /bin/sh: 1: pip: not found How can I build a docker image installing miniconda and python requirements using pip at the same time?

Advertisement

Answer

I would recommend using a pre-existing Docker image that already has Anaconda installed. For example, this link has a Docker image endorsed by Anaconda itself. There may be others on Dockerhub that also have Anaconda installed already. In the case you already tried an image with Anaconda and it didn’t meet your needs, let me know.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement