Hi team, I doubled check my docker container that ...
# flyte-support
c
Hi team, I doubled check my docker container that I pushed to GCP artifact repository , it has all my required libraries im using it in @task(container_image= ) option for a task but its giving the following error -
Copy code
Traceback (most recent call last):

      File "/opt/micromamba/envs/runtime/lib/python3.10/site-packages/flytekit/exceptions/scopes.py", line 242, in user_entry_point
        return wrapped(*args, **kwargs)
      File "/root/sat_stac.py", line 35, in parse_geojson
        from pystac_client import Client

Message:

    ModuleNotFoundError: No module named 'pystac_client'

User error.
I changed the docker tag but still the pyflyte run --remote keeps pointing to old tag
Copy code
Running Execution on Remote.

Image us-central1-docker.pkg.dev/glowing-cooler/flyte-utils/geoenv:vtRFq5MYr5OPDqCiXgA9BQ found. Skip building.
I dont need it to build a new one, i want it to respect the tag "latest". the tag it shows here after geoenv: is an old hash from previous commit.
do i have to register images as well?
f
You are using image config? It’s hashing the config and deduping on that. I do not follow the problem? Are you using latest somewhere
c
latest tag is here -
Copy code
image_spec = ImageSpec(
    registry="us-central1-docker.pkg.dev/glowing-cooler/flyte-utils",
    name="flytekit-geo",
    base_image="us-central1-docker.pkg.dev/glowing-cooler/flyte-utils/flytekit-geo:flytekit-geo-latest"
)
now I may have solved the tags issue. registering workflows are fine but the task not being able to find python modules is more of an issue.
im using @task(container_image=image_space)
Copy code
Traceback (most recent call last):

      File "/opt/micromamba/envs/runtime/lib/python3.10/site-packages/flytekit/exceptions/scopes.py", line 242, in user_entry_point
        return wrapped(*args, **kwargs)
      File "/root/sat_stac.py", line 35, in parse_geojson
        from pystac_client import Client

Message:

    ModuleNotFoundError: No module named 'pystac_client'

User error.
a
is the above your full ImageSpec config? In this case, I think you'd still need to specify
packages = ["pystac_client"]
or invoque a requirements file
c
its the full spec, because the way im using it is that the docker is prebuilt and kept in registry. I simply create the imagespec and use the image_spec as container_image parameter in the task. I understand there is container_task itself instead of ImageSpec, but simply referring to a docker for a task and making sure the imports for that task stays within the task seemed a good option. I was wondering how Flyte would prefer it. Can the flytekit docker kept separate for running the workflows, while other dockers who have special libraries in them can be referenced at each task?
a
simply referring to a docker for a task and making sure the imports for that task stays within the task seemed a good option.
ImageSpec should work for that use case. Could you share your base image config? Also, could you run a container using the custom docker image and check if pystac_client is available?
Also, how are you registering the workflow? I mean, what command?
c
Could you run a container using the custom docker image and check if pystac_client is available?
yep I checked the container im my local. the libraires are available here's the dockerfile
Copy code
ARG PYTHON_VERSION=3.12
FROM python:${PYTHON_VERSION}-slim-bookworm

WORKDIR /root
ENV VENV /opt/venv
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8
ENV PYTHONPATH /root

# Set environment variables for GDAL
ENV CPLUS_INCLUDE_PATH=/usr/include/gdal
ENV C_INCLUDE_PATH=/usr/include/gdal

RUN apt-get update && apt-get install -y \
	build-essential \
    	libgdal-dev \
    	libproj-dev \
    	libgeos-dev \
    	gdal-bin

# Install the AWS cli separately to prevent issues with boto being written over
RUN pip3 install awscli

# Install Python dependencies
COPY requirements.txt /root
RUN pip install uv
RUN uv pip install boto3 --system
RUN uv pip install -r /root/requirements.txt --system

COPY app /root/app
COPY $config /root/flyte.config

ARG tag
ENV FLYTE_INTERNAL_IMAGE $tag
how I register is pretty much them like how its done in these flytelab repos - https://github.com/flyteorg/flytelab/blob/main/projects/weather_forecasting/DEPLOYMENT.md using the Makefile
Copy code
.PHONY: register
register: docker-push serialize
	flytectl -c ${FLYTECTL_CONFIG} \
		register files \
		--project ${PROJECT} \
		--domain ${DOMAIN} \
		--archive flyte-package.tgz \
		--force \
		--version ${VERSION}
essentially i based my git repo on those projects, not many changes at all
a
@colossal-musician-95989 sorry for the silly questions, I want to make sure I follow, so is the expectation that ImageSpec use your custom image but respect the tag, so something like this?
<http://us-central1-docker.pkg.dev/glowing-cooler/flyte-utils/geoenv:flytekit-geo-latest|us-central1-docker.pkg.dev/glowing-cooler/flyte-utils/geoenv:flytekit-geo-latest>
c
i think i was misunderstanding how flyte register and package works earlier. Now I think the tag of the docker is generated in every register if a git commit has been made in the repo with some changes. I had initially tried to push a docker container to registry manually outside of the git repo, and then reference it in the ImageSpec, but even with the "latest" tag (hardcoded in imagespec) , it kept making its own tags, and using that for the task. So i currently don't want to follow that way . Right now my git repo has all the right req.txt files and correct Dockerfile, and the image it builds and tags works correctly when I exec into it in my local laptop and try to import python libraries. but once its on gcp registry, and a remote flyte run is started, the pod pulls that same image, but fails with the above "no module found" error. that's where I am currently