Hi guys, I am trying to use Kubernetes `RunNamespa...
# ask-community
t
Hi guys, I am trying to use Kubernetes
RunNamespacedJob
tasks in my flow. I installed Prefect using
pip install "prefect[kubernetes]"
, but when I try to run my flow i get `ImportError: Using
prefect.tasks.kubernetes
requires Prefect to be installed with the "kubernetes" extra.` . I also tried directly from source, cloning the git repo and running
pip install "./prefect[kubernetes]"
but I get the same result...
k
Hi @thebuleon29, I just tried this in a new environment and it installs correctly. What agent are you using? Local? Are you running the agent from the same Python environment?
t
Hi, I am not using an agent, just the
prefect run
command (
prefect run -p ./k8s_flow.py
). I can run other flows this way, even without the agent. Even when I try to launch the server and run the agent I get the same error when running
prefect register --project test -p ./k8s_flow.py
.
I don't think that it changes anything, but I still should precise that I am running Prefect in a Docker container.
It also sends this error:
ImportError: cannot import name 'client' from partially initialized module 'kubernetes' (most likely due to a circular import) (/usr/prefect/dags/kubernetes.py)
. I import like this:
from prefect.tasks.kubernetes.job import RunNamespacedJob
.
Ok sorry, that one is on me. There was another file in the directory called 'kubernetes.py' that was causing the error. It had nothing to do with Prefect.
k
Glad you figured it out 👍