Raffaele Scarano
06/05/2023, 3:23 PMFROM prefecthq/prefect:2-python3.10-conda
(I need a conda env to install all the deps my code need).
My Dockerfile is:
FROM prefecthq/prefect:2-python3.10-conda
COPY environment.yml .
COPY requirements.txt .
COPY setup.cfg .
COPY setup.py .
COPY my-logic .
RUN apt-get update && apt-get install -y libarchive13
RUN conda install -c conda-forge mamba
RUN mamba env update --prefix /opt/conda/envs/prefect -f environment.yml
RUN pip install --upgrade pip setuptools --no-cache-dir
RUN pip install --trusted-host <http://pypi.python.org|pypi.python.org> --no-cache-dir .
ARG PREFECT_API_KEY
ENV PREFECT_API_KEY=$PREFECT_API_KEY
ARG PREFECT_API_URL
ENV PREFECT_API_URL=$PREFECT_API_URL
ENV PYTHONUNBUFFERED True
COPY flows/ /opt/prefect/flows/
ENTRYPOINT ["/bin/bash", "--login", "-c", "prefect agent start -q default"]
The action build goes well, but when i run the deploy from prefect cloud, the VM on GCP creates the job in CloudRun but it returns /opt/conda/bin/python: Error while finding module specification for 'prefect.engine' (ModuleNotFoundError: No module named 'prefect')
What I'm doing wrong?
I still do not understand if I have to change also the action/deploy-flows/action.yml
to make it create a conda env; in any case I tried both and nothing changed.
The modified action.yml is
runs:
using: "composite"
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.10
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
shell: bash
python-version: "${{ inputs.python_version }}"
cache: 'pip'
- id: install-myenv
run: |
conda install -c conda-forge mamba
mamba env update --file environment.yml
${{ inputs.install_command }}
shell: bash
- id: login-prefect
run: |
prefect config set PREFECT_API_KEY=${{ inputs.prefect_api_key }}
prefect config set PREFECT_API_URL=${{ inputs.prefect_api_url }}
shell: bash
If i switch my dockerfile back to a non conda image (FROM prefecthq/prefect:2-python3.10
), everything goes fine, but my deps are not fully covered.Zanie
Zanie
Raffaele Scarano
06/05/2023, 4:08 PMZanie
Zanie
Raffaele Scarano
06/05/2023, 4:11 PMRaffaele Scarano
06/05/2023, 4:12 PMRUN echo "conda activate prefect" >> ~/.bashrc
Zanie
prefect
one?Raffaele Scarano
06/05/2023, 4:15 PMRUN mamba env update --prefix /opt/conda/envs/prefect -f environment.yml
Zanie
Raffaele Scarano
06/05/2023, 4:18 PMRaffaele Scarano
06/05/2023, 4:19 PMRaffaele Scarano
06/05/2023, 4:53 PMFROM prefecthq/prefect:2-python3.10-conda
COPY requirements.txt .
COPY setup.py .
COPY prefect_utils .
RUN pip install --upgrade pip setuptools --no-cache-dir
RUN pip install --trusted-host <http://pypi.python.org|pypi.python.org> --no-cache-dir .
ARG PREFECT_API_KEY
ENV PREFECT_API_KEY=$PREFECT_API_KEY
ARG PREFECT_API_URL
ENV PREFECT_API_URL=$PREFECT_API_URL
ENV PYTHONUNBUFFERED True
COPY flows/ /opt/prefect/flows/
ENTRYPOINT ["/bin/bash", "--login", "-c", "prefect agent start -q default"]
Am I doing something wrong?