(prefect) λ prefect deploy flows.py:pipe Traceback...
# pacc-june-14-2023
t
(prefect) λ prefect deploy flows.py:pipe Traceback (most recent call last): File "D:\Packages\Miniconda\envs\prefect\lib\site-packages\prefect\cli\_utilities.py", line 41, in wrapper return fn(*args, **kwargs) File "D:\Packages\Miniconda\envs\prefect\lib\site-packages\prefect\utilities\asyncutils.py", line 255, in coroutine_wrapper return call() File "D:\Packages\Miniconda\envs\prefect\lib\site-packages\prefect\_internal\concurrency\calls.py", line 383, in call return self.result() File "D:\Packages\Miniconda\envs\prefect\lib\site-packages\prefect\_internal\concurrency\calls.py", line 283, in result return self.future.result(timeout=timeout) File "D:\Packages\Miniconda\envs\prefect\lib\site-packages\prefect\_internal\concurrency\calls.py", line 169, in result return self.__get_result() File "D:\Packages\Miniconda\envs\prefect\lib\concurrent\futures\_base.py", line 403, in __get_result raise self._exception File "D:\Packages\Miniconda\envs\prefect\lib\site-packages\prefect\_internal\concurrency\calls.py", line 346, in _run_async result = await coro File "D:\Packages\Miniconda\envs\prefect\lib\site-packages\prefect\cli\deploy.py", line 300, in deploy await _run_single_deploy( File "D:\Packages\Miniconda\envs\prefect\lib\site-packages\prefect\client\utilities.py", line 40, in with_injected_client return await fn(*args, **kwargs) File "D:\Packages\Miniconda\envs\prefect\lib\site-packages\prefect\cli\deploy.py", line 391, in _run_single_deploy flow_name = flow.name AttributeError: 'NoneType' object has no attribute 'name' An exception occurred.
j
can you share your flow code and prefect version here? Checking with other folks.
c
we had the same issue
j
And you solved with adding a
.
right?
c
both
prefect deploy 104\flow.py:pipe
and
prefect deploy .\104\flow.py:pipe
threw that error
j
What’s your flow code file?
c
Copy code
import httpx
from prefect import flow, task


@task
def fetch_cat_fact():
    return httpx.get("<https://catfact.ninja/fact?max_length=140>").json()["fact"]


@task(persist_result=True)
def formatting(fact: str):
    return fact.title()


@flow
def pipe():
    fact = fetch_cat_fact()
    formatted_fact = formatting(fact)


if __name__ == "__main__":
    pipe()
j
Did you get it working @Cody?
c
I have not
j
Ah. What’s your error traceback?
c
Copy code
❯❯❯  prefect deploy 104\flow.py:pipe  
Traceback (most recent call last):
  File "C:\Users\Cody\anaconda3\envs\pcc310\lib\site-packages\prefect\cli\_utilities.py", line 41, in wrapper
    return fn(*args, **kwargs)
  File "C:\Users\Cody\anaconda3\envs\pcc310\lib\site-packages\prefect\utilities\asyncutils.py", line 255, in coroutine_wrapper
    return call()
  File "C:\Users\Cody\anaconda3\envs\pcc310\lib\site-packages\prefect\_internal\concurrency\calls.py", line 383, in __call__
    return self.result()
  File "C:\Users\Cody\anaconda3\envs\pcc310\lib\site-packages\prefect\_internal\concurrency\calls.py", line 283, in result
    return self.future.result(timeout=timeout)
  File "C:\Users\Cody\anaconda3\envs\pcc310\lib\site-packages\prefect\_internal\concurrency\calls.py", line 169, in result
    return self.__get_result()
  File "C:\Users\Cody\anaconda3\envs\pcc310\lib\concurrent\futures\_base.py", line 403, in __get_result
    raise self._exception
  File "C:\Users\Cody\anaconda3\envs\pcc310\lib\site-packages\prefect\_internal\concurrency\calls.py", line 346, in _run_async
    result = await coro
  File "C:\Users\Cody\anaconda3\envs\pcc310\lib\site-packages\prefect\cli\deploy.py", line 300, in deploy
    await _run_single_deploy(
  File "C:\Users\Cody\anaconda3\envs\pcc310\lib\site-packages\prefect\client\utilities.py", line 40, in with_injected_client
    return await fn(*args, **kwargs)
  File "C:\Users\Cody\anaconda3\envs\pcc310\lib\site-packages\prefect\cli\deploy.py", line 391, in _run_single_deploy
    flow_name = flow.name
AttributeError: 'NoneType' object has no attribute 'name'
An exception occurred.
j
And where are you running your command?
I am thinking this might be windows related. What kind of shell are you in?
@Tim A - what kind of shell are you using?
c
one directory up from the flow file, but I also tried running in the same dir as the flow file
I'm running powershell inside pycharm
t
cmder - v 1.3.20.151
git version 2.39.0.windows.1
j
I think there might be an issue with the file paths - particularly forward and backward slashes.
Perhaps on our end trying to resolve file path.
t
it is not the file path provided at least:
Copy code
E:\prefect-training (main -> origin)
(prefect) λ prefect deploy weather.py:aggregate_temps
can't miss this one
python can import "weather.py" using "import weather" so its not a python path issue
j
Our
prefect deploy
cli command might be altering the path. But you tried it in the same directory, so maybe that’s not it.
t
is there a way to debug the prefect.cli.deploy() command?
I'm trying something along the lines as
Copy code
from prefect.cli.deploy import deploy

deploy(
    entrypoint='E:\\prefect-training\\weather.py',
    flow_name='randomize',
    names=['this-is-a-test',]
)
c
@Jeff Hale, when you say that the path is being altered, is that an issue between powershell and prefect? Just not sure if I'm doing something wrong
j
I’m just guessing at this point. That’s a hunch. But maybe not the case if you created the deployment in the same folder as your flow b/c there weren’t any slashes.
t
Just to be sure, i'll check this from WSL
Same result from WSL
Copy code
tim@PRO237:/mnt/e/prefect-training$ /home/tim/.local/bin/prefect deploy weather.py:randomize
Traceback (most recent call last):
  File "/home/tim/.local/lib/python3.10/site-packages/prefect/cli/_utilities.py", line 41, in wrapper
    return fn(*args, **kwargs)
  File "/home/tim/.local/lib/python3.10/site-packages/prefect/utilities/asyncutils.py", line 255, in coroutine_wrapper
    return call()
  File "/home/tim/.local/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py", line 383, in __call__
    return self.result()
  File "/home/tim/.local/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py", line 283, in result
    return self.future.result(timeout=timeout)
  File "/home/tim/.local/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py", line 169, in result
    return self.__get_result()
  File "/usr/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
    raise self._exception
  File "/home/tim/.local/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py", line 346, in _run_async
    result = await coro
  File "/home/tim/.local/lib/python3.10/site-packages/prefect/cli/deploy.py", line 300, in deploy
    await _run_single_deploy(
  File "/home/tim/.local/lib/python3.10/site-packages/prefect/client/utilities.py", line 40, in with_injected_client
    return await fn(*args, **kwargs)
  File "/home/tim/.local/lib/python3.10/site-packages/prefect/cli/deploy.py", line 391, in _run_single_deploy
    flow_name = flow.name
AttributeError: 'NoneType' object has no attribute 'name'
An exception occurred.
tim@PRO237:/mnt/e/prefect-training$
🙏 1
j
Making the deployment the way shown in 105 will hopefully not have this issue.
c
When I ran in WSL I got the same error, but it was a kind of janky install. In powershell I just listed my dir and ran the deploy command and still ran into the same error
Copy code
Directory: C:\wageup\pcc\prefect_lab\104


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----         6/14/2023     14:29                __pycache__
-a----         6/14/2023     13:42            381 flow.py
-a----         6/14/2023     13:29              0 __init__.py


 Cody   C:/wageup/pcc/prefect_lab/104  ﲍ                                                 pcc   14:31:07
❯❯❯  prefect deploy flow.py:pipe
Traceback (most recent call last):
t
Io and behold for 105
Copy code
E:\prefect-training (main -> origin)
(prefect) λ prefect deployment apply deployment.yaml
'deployment.yaml' did not conform to deployment spec: AttributeError("'NoneType' object
has no attribute 'name'")
j
You don’t want to use
prefect apply
With a prefect.yaml file you just want
prefect deploy path_to_flow:flow_function -n my_deployment_name
t
j
That tutorial should work fine.
prefect deployment apply
isn’t in that tutorial - maybe from somewhere else.
c
Did either of you ever figure out what the cause of this is? I'm still running into it.
Upgrading to prefect 2.10.16 runs things as expected
👍 1