Hi community, I am new to flyte and trying ImageSp...
# flyte-support
p
Hi community, I am new to flyte and trying ImageSpec on local sandbox cluster. What's the "registry" parameter to use to make it work in sandbox? Currently I tried "localhost:30000" and "", both didn't work
g
what error did you see when using
localhost:30000
p
Failed to check if the image exists with error: 500 Server Error for http+docker://localhost/v1.46/distribution/localhost:30000/flytekit:Pz3VaSdcdn00DvUfXCbIYg/json: Internal Server Error ("Get "http://localhost:30000/v2/": dial tcp [:1]30000: connect: connection refused") Flytekit assumes the image localhost30000/flytekitPz3VaSdcdn00DvUfXCbIYg already exists.
g
are you using envd builder or default builder?
seems like your local registry is not running?
could you share the output of
kubectl get pods
p
Copy code
(flyte-env) (base) tharunsuresh@Tharuns-MacBook-Pro data_extraction % kubectl get pods
NAME                         READY  STATUS  RESTARTS  AGE
flyte-sandbox-docker-registry-6b4c94cc55-vl4m4    1/1   Running  0     85s
flyte-sandbox-kubernetes-dashboard-5b4465fcfb-shqp8  1/1   Running  0     85s
flyte-sandbox-buildkit-55b956cfbb-4d4rm        1/1   Running  0     85s
flyte-sandbox-postgresql-0              1/1   Running  0     86s
flyteagent-7684ddb7bd-sgg9h              1/1   Running  0     85s
flyte-sandbox-minio-797448f46d-xlrwn         1/1   Running  0     85s
flyte-sandbox-proxy-74bcd9c78f-nv8r6         1/1   Running  0     85s
flyte-sandbox-5958bb6bfd-rv4vv            1/1   Running  0     85s
Yeah, I thought so local registry is not running. Before I used
flytectl sandbox start --source .
command, now I changed to
flytectl demo start --source .
, I am getting the following error now. I am running on a Mac
Copy code
=> ERROR [stage-2 11/11] RUN echo "export PATH=/root/micromamba/envs/dev/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/nvidia/bin:/us  0.2s
------                                                                                                                                                                                    
 > [stage-2 11/11] RUN echo "export PATH=/root/micromamba/envs/dev/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/nvidia/bin:/usr/local/cuda/bin" >> $HOME/.profile:
0.225 /bin/bash: /home/flytekit/.profile: No such file or directory
------
Dockerfile:35
--------------------
  33 |     
  34 |     USER flytekit
  35 | >>> RUN echo "export PATH=$PATH" >> $HOME/.profile
  36 |     
--------------------
ERROR: failed to solve: process "/bin/bash -c echo \"export PATH=$PATH\" >> $HOME/.profile" did not complete successfully: exit code: 1
Failed with Exception <class 'subprocess.CalledProcessError'> Reason:
Command '['docker', 'image', 'build', '--tag', 'localhost:30000/flytekit:Bj3g6ZKSpVNItqiUKC_HRQ', '--platform', 'linux/amd64', '--push', '/var/folders/qg/y8ppg38d7ln8l624cdm8b8s80000gp/T/tmpuots2xcd']' returned non-zero exit status 1.
g
could you also share your image spec definition? I want to test it on my side
p
Sure
Copy code
image_definition = ImageSpec(
   name="flytekit",  # default docker image name.
   base_image="<http://ghcr.io/flyteorg/flytekit:py3.11-1.10.2|ghcr.io/flyteorg/flytekit:py3.11-1.10.2>",  # the base image that flytekit will use to build your image.
   packages=["pandas"],  # python packages to install.
   registry="localhost:30000", # the registry your image will be pushed to.
   python_version="3.11"  # Optional if python is installed in the base image.
)
g
which version of flytekit are you using?
you works for me
Copy code
from click.testing import CliRunner

from flytekit import ImageSpec, task, dynamic, workflow
from flytekit.clis.sdk_in_container import pyflyte
Copy code
image_definition = ImageSpec(
   name="flytekit",  # default docker image name.
   base_image="ghcr.io/flyteorg/flytekit:py3.11-1.10.2",  # the base image that flytekit will use to build your image.
   packages=["pandas", "mypy"],  # python packages to install.
   registry="localhost:30000", # the registry your image will be pushed to.
   python_version="3.11"
)


# hello
@task(container_image=image_definition)
def foo():
    print("foo")


@workflow
def wf():
    foo()
p
Oh okay, lemme check this
Copy code
>>> flytekit.__version__
'1.13.0'
g
could you replace
localhost:30000
with your docker registry, and try it again?
p
sure, will do
okay, I found one issue. I didn't have .profile file in HOME directory. I created that manually, and then ran
pyflyte pkgs
command. It ran envd builder and everything ran smoothly (Previously it was running docker builder by default)
🙌 1
🙌🏽 1
Thanks Kevin for the quick responses and support!
c
Hi team getting the same 500 error but my setup is a GCP flyte binary with nginx ingress have tried multiple things, made sure service account used has enough permissions the cluster of GKE is standard cluster with Workload Identity based permissions being provided to it im using artifact registry and not gchr,io
Copy code
FLYTECTL_CONFIG=~/.flyte/config.yaml REGISTRY=us-central1-docker.pkg.dev/glowing-cooler/flyte-utils make fast_register
echo /home/enceladus/Work/git/flyte-sen-2-workflow
/home/enceladus/Work/git/flyte-sen-2-workflow
pyflyte -c flyte.config --pkgs app package \
	--force \
	--in-container-source-path /root \
	--fast \
	--image us-central1-docker.pkg.dev/glowing-cooler/flyte-utils/flytekit-geo:flytekit-geo-latest
Loading packages ['app'] under source root /home/enceladus/Work/git/flyte-sen-2-workflow
Failed to check if the image exists with error:
 500 Server Error for <http+docker://localhost/v1.47/distribution/us-central1-docker.pkg.dev/flytekit-geo:nGTSjbjBIBC_oLWoMxJ0KQ/json>: Internal Server Error ("Head "<https://us-central1-docker.pkg.dev/v2/flytekit-geo/manifests/nGTSjbjBIBC_oLWoMxJ0KQ>": name invalid: invalid number of path components: 1")
nevermind ImageSpec python code was wrong solved now