I am totally new to metaflow. I am trying to confi...
# ask-metaflow
s
I am totally new to metaflow. I am trying to configure my vs code to be able to use metaflow. I have installed metaflow, metaflow[kubernetes], metaflow [batch] in the same virtual environment. But I still keep receiving error messages like "cannot locate step decorator plugin 'kubernetes' at metaflow.plugins.kubernetes.kubernetes decorator" when I try to run a simple .py file. Can you please help me with this? Greatly appreciate it.
1
v
hi Claire! Welcome meow wave
if you copy a basic flow like this in a file, say,
hello.py
Copy code
from metaflow import FlowSpec, step

class HelloFlow(FlowSpec):

    @step
    def start(self):
        print("Hello world!")
        self.next(self.end)

    @step
    def end(self):
        pass

if __name__ == "__main__":
    HelloFlow()
and try to run it with
python hello.py run
do you see any errors?
f
@victorious-lawyer-58417 IMO the example we may choose to run/debug along must have a
@kubernetes
decorator in use because of mention of the error around it by @stocky-city-94927? @stocky-city-94927 perhaps (and this may go as a guideline for reporting such issues, a "pinned" message 🙂 ), if you could share:
what steps you ran to install metaflow
Copy code
pip install metaflow .. metaflow[batch] ... metaflow[kubernetes]
what example were you running actually
Copy code
python <my-example-dag>.py run
the error trace you confronted?
Copy code
(traceback) ...
from ... ln 150
/home/aks/.....py ln 450
Ykwim!... btw @victorious-lawyer-58417 I tried to replicate the issue- I am installing metaflow from the master branch- and it takes me to version
2.9.14
in my venv. and, when I pull tutorials :
metaflor tutorials pull
and grep for usage of "@kuberntes", I see:
Copy code
from metaflow import FlowSpec, step, kubernetes, retry
as the usage, but it just doesnt exist/not importable. it rather exists as:
metaflor.plugins.kubernetes
, yet giving errors..
Copy code
Traceback (most recent call last):
  File "/home/sumit/.local/share/JetBrains/Toolbox/apps/pycharm-community-2/plugins/python-ce/helpers/pydev/pydevd.py", line 1496, in _exec
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "/home/sumit/.local/share/JetBrains/Toolbox/apps/pycharm-community-2/plugins/python-ce/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "/home/sumit/Documents/repos/apache/metaflow/examples/metaflow_flow_debuggings/k8s_decorator_error.py", line 5, in <module>
    class HelloFlow(FlowSpec):
  File "/home/sumit/Documents/repos/apache/metaflow/examples/metaflow_flow_debuggings/k8s_decorator_error.py", line 7, in HelloFlow
    @kubernetes()
TypeError: 'module' object is not callable
python-BaseException
because it is just not what it is expected to be! i.e a decorator func accepting args like :
cpu, memory ...
etc.
s
Thank you very much for the help! I tried the basic flow and I received the same error. I am detailing the process here so provide more detailed information. Thanks again for the help!@ I am using vs code. The interpreter I am using is Python 3.7.6 (base: conda). I first install virtualenv and created a virtual environment:
Copy code
pip install virtualenv
	virtualenv myenv
Then in the virtual environment, I typed these commands in the terminal:
Copy code
pip install metaflow
pip install metaflow[batch]                                                              pip install metaflow[kubernetes]
AFter installation, here are some warning messages like this for both batch and kuvernetes. Could this be why?
Copy code
requirement already satisfied: metaflow[batch] in d:\python\anaconda3\lib\site-packages (2.9.13)   WARNING: metaflow 2.9.13 does not provide the extra 'batch'
f
^^like what? what is the error? maybe you missed a screenshot/snippet in the above message? or am I unable to see..?
s
Still learning to post.... Here is the error message after I typied python helloworld.py in the terminal. I run this .py file twice and the two errors are different.
f
You seem to be on Windows, and apparently
fcntl
is not available in there: see this https://stackoverflow.com/a/45228507 not sure if metaflow is getting along with Windows, I have linux. someone from the core team may be of help ... (sorry I am a newbie too, just somewhat keen! )
s
Thank you very much for your help! Yes, I am on WIndows.