Hi Everyone, i was using prefect 2.7.7 till now an...
# ask-community
n
Hi Everyone, i was using prefect 2.7.7 till now and decided to migrate to prefect 3.2. The first problem that occured to us is creating a deployment. earlier with prefect 2.7.7 we are creating deployment by below command.
Copy code
prefect deployment build -sb "s3/inferencing-bucket" -n "algo.57" -q "algo-57" "algo-57.py:start_inferencing_57"
for prefect 3.2 i read in the documentation that we had run
prefect init
which will generate yaml file and then we need to run
prefect deploy
. but when i run prefect init in CLI it ask for gcs bucket name and when i write the bucket name it throws a below error.
Copy code
root@a3124f089d1f:/opt/prefect# prefect init
? Would you like to initialize your deployment configuration with a recipe? [Use arrows to move; enter to select; n to select none]
┏━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃    ┃ Name         ┃ Description                                                                                   ┃
┡━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│    │ azure        │ Store code within an Azure Blob Storage container                                             │
│    │ docker-azure │ Store code within an Azure Blob Storage container and build a custom docker image for runtime │
│    │ docker-git   │ Store code within a git repository and build a custom docker image for runtime                │
│ >  │ gcs          │ Store code within a GCS bucket                                                                │
│    │ docker       │ Store code within a custom docker image alongside its runtime environment                     │
│    │ docker-s3    │ Store code within S3 and build a custom docker image for runtime                              │
│    │ docker-gcs   │ Store code within GCS and build a custom docker image for runtime                             │
│    │ s3           │ Store code within an S3 bucket                                                                │
│    │ git          │ Store code within git repository                                                              │
│    │ local        │ Store code on a local filesystem                                                              │
│    │              │ No, I'll use the default deployment configuration.                                            │
└────┴──────────────┴───────────────────────────────────────────────────────────────────────────────────────────────┘
                Required inputs for 'gcs' recipe                
┏━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Field Name ┃ Description                                     ┃
┡━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ bucket     │ The bucket to store and retrieve this code from │
└────────────┴─────────────────────────────────────────────────┘
bucket: prefect-flows-platform
---------------
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/prefect/cli/_utilities.py", line 44, in wrapper
    return fn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/prefect/cli/_types.py", line 155, in sync_fn
    return asyncio.run(async_fn(*args, **kwargs))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/asyncio/runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/asyncio/base_events.py", line 654, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/prefect/cli/deploy.py", line 218, in init
    for fname in initialize_project(name=name, recipe=recipe, inputs=inputs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/prefect/deployments/base.py", line 202, in initialize_project
    if create_default_prefect_yaml(".", name=project_name, contents=configuration):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/prefect/deployments/base.py", line 45, in create_default_prefect_yaml
    with default_file.open(mode="r") as df:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/pathlib.py", line 1044, in open
    return io.open(self, mode, buffering, encoding, errors, newline)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/lib/python3.11/site-packages/prefect/deployments/templates/prefect.yaml'
b
Hi Nimesh! Can you put the stack trace of the error in this thread 🧵 ? It's a big block of text to have in the main slack channel. Please & thank you 🙏
Do you see the same thing when running
prefect init --recipe gcs
within a new directory?
n
Thanks bianca for resposne, I tried running the command that you gave. I encounter the following error.
Copy code
prefect init --recipe gcs
                Required inputs for 'gcs' recipe                
┏━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Field Name ┃ Description                                     ┃
┡━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ bucket     │ The bucket to store and retrieve this code from │
└────────────┴─────────────────────────────────────────────────┘
bucket: prefect-flows-platform
---------------
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/prefect/cli/_utilities.py", line 44, in wrapper
    return fn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/prefect/cli/_types.py", line 155, in sync_fn
    return asyncio.run(async_fn(*args, **kwargs))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/asyncio/runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/asyncio/base_events.py", line 654, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/prefect/cli/deploy.py", line 218, in init
    for fname in initialize_project(name=name, recipe=recipe, inputs=inputs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/prefect/deployments/base.py", line 202, in initialize_project
    if create_default_prefect_yaml(".", name=project_name, contents=configuration):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/prefect/deployments/base.py", line 45, in create_default_prefect_yaml
    with default_file.open(mode="r") as df:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/pathlib.py", line 1044, in open
    return io.open(self, mode, buffering, encoding, errors, newline)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/lib/python3.11/site-packages/prefect/deployments/templates/prefect.yaml'
An exception occurred.
root@a3124f089d1f:/opt/prefect#
Background- i am running prefect 2.7.7 using docker compose with comtainers named - orion, agent and postgres. And have written an entrypoint file which has the CLi command toh create a deployment yaml and then creating a deployment using it. I want to move toh prefect 3 with minimum changes to my docker. Compose Please help