https://prefect.io logo
c

Chris DeBracy

07/12/2023, 7:09 PM
I had earlier started some prefect.io tutorials and all was going well. Put it aside to look at some other tools and came back and upgraded to the latest, tried to set up Postgres along the way. At this point, I’m running Python 3.11 and when I run prefect server start, I get these errors and unsure how to resolve: sqlalchemy.exc.ProgrammingError: (sqlalchemy.dialects.postgresql.asyncpg.ProgrammingError) <class ‘asyncpg.exceptions.UndefinedObjectError’>: operator class “gin_trgm_ops” does not exist for access method “gin” [SQL: CREATE INDEX CONCURRENTLY trgm_ix_flow_name ON flow USING gin (name gin_trgm_ops); ] (Background on this error at: https://sqlalche.me/e/14/f405)
1
j

jpuris

07/12/2023, 7:50 PM
Heya! Which tutorial did you follow? For
GIN
index operator to be available you must add
pg_trgm
extension in the db prefect uses.
👍 1
Either tutorial is flawed or you've skipped a step 😕
s

Sahil Rangwala

07/12/2023, 7:53 PM
Hey @Chris DeBracy! Could you link the tutorial you followed and we can get that updated! thank you
c

Chris DeBracy

07/12/2023, 9:53 PM
I actually created the extension for pg_trgm across several schemas. I may still not have it right. Followed the steps here: https://docs.prefect.io/latest/ Getting this when I try to run python hello_prefect.py: /Users/cdebracy/dev/prefect.io/venv/bin/python /Users/cdebracy/dev/prefect.io/hello_prefect.py Traceback (most recent call last): File “/Users/cdebracy/dev/prefect.io/venv/lib/python3.11/site-packages/anyio/_core/_sockets.py”, line 167, in try_connect stream = await asynclib.connect_tcp(remote_host, remote_port, local_address) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File “/Users/cdebracy/dev/prefect.io/venv/lib/python3.11/site-packages/anyio/_backends/_asyncio.py”, line 1627, in connect_tcp await get_running_loop().create_connection( File “/usr/local/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/base_events.py”, line 1085, in create_connection raise exceptions[0] File “/usr/local/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/base_events.py”, line 1069, in create_connection sock = await self._connect_sock( ^^^^^^^^^^^^^^^^^^^^^^^^^ File “/usr/local/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/base_events.py”, line 973, in _connect_sock await self.sock_connect(sock, address) File “/usr/local/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/selector_events.py”, line 634, in sock_connect return await fut ^^^^^^^^^ File “/usr/local/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/selector_events.py”, line 674, in _sock_connect_cb raise OSError(err, f’Connect call failed {address}’) ConnectionRefusedError: [Errno 61] Connect call failed (‘127.0.0.1’, 4200) The above exception was the direct cause of the following exception: Traceback (most recent call last): File “/Users/cdebracy/dev/prefect.io/venv/lib/python3.11/site-packages/httpcore/_exceptions.py”, line 10, in map_exceptions yield File “/Users/cdebracy/dev/prefect.io/venv/lib/python3.11/site-packages/httpcore/_backends/anyio.py”, line 114, in connect_tcp stream: anyio.abc.ByteStream = await anyio.connect_tcp( ^^^^^^^^^^^^^^^^^^^^^^^^ File “/Users/cdebracy/dev/prefect.io/venv/lib/python3.11/site-packages/anyio/_core/_sockets.py”, line 225, in connect_tcp raise OSError(“All connection attempts failed”) from cause OSError: All connection attempts failed The above exception was the direct cause of the following exception: Traceback (most recent call last): File “/Users/cdebracy/dev/prefect.io/venv/lib/python3.11/site-packages/httpx/_transports/default.py”, line 60, in map_httpcore_exceptions yield File “/Users/cdebracy/dev/prefect.io/venv/lib/python3.11/site-packages/httpx/_transports/default.py”, line 353, in handle_async_request resp = await self._pool.handle_async_request(req) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File “/Users/cdebracy/dev/prefect.io/venv/lib/python3.11/site-packages/httpcore/_async/connection_pool.py”, line 262, in handle_async_request raise exc File “/Users/cdebracy/dev/prefect.io/venv/lib/python3.11/site-packages/httpcore/_async/connection_pool.py”, line 245, in handle_async_request response = await connection.handle_async_request(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File “/Users/cdebracy/dev/prefect.io/venv/lib/python3.11/site-packages/httpcore/_async/connection.py”, line 92, in handle_async_request raise exc File “/Users/cdebracy/dev/prefect.io/venv/lib/python3.11/site-packages/httpcore/_async/connection.py”, line 69, in handle_async_request stream = await self._connect(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File “/Users/cdebracy/dev/prefect.io/venv/lib/python3.11/site-packages/httpcore/_async/connection.py”, line 117, in _connect stream = await self._network_backend.connect_tcp(**kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File “/Users/cdebracy/dev/prefect.io/venv/lib/python3.11/site-packages/httpcore/_backends/auto.py”, line 31, in connect_tcp return await self._backend.connect_tcp( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File “/Users/cdebracy/dev/prefect.io/venv/lib/python3.11/site-packages/httpcore/_backends/anyio.py”, line 112, in connect_tcp with map_exceptions(exc_map): File “/usr/local/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/contextlib.py”, line 155, in exit self.gen.throw(typ, value, traceback) File “/Users/cdebracy/dev/prefect.io/venv/lib/python3.11/site-packages/httpcore/_exceptions.py”, line 14, in map_exceptions raise to_exc(exc) from exc httpcore.ConnectError: All connection attempts failed The above exception was the direct cause of the following exception: Traceback (most recent call last): File “/Users/cdebracy/dev/prefect.io/venv/lib/python3.11/site-packages/prefect/client/orchestration.py”, line 327, in api_healthcheck await self._client.get(“/health”) File “/Users/cdebracy/dev/prefect.io/venv/lib/python3.11/site-packages/httpx/_client.py”, line 1757, in get return await self.request( ^^^^^^^^^^^^^^^^^^^ File “/Users/cdebracy/dev/prefect.io/venv/lib/python3.11/site-packages/httpx/_client.py”, line 1530, in request return await self.send(request, auth=auth, follow_redirects=follow_redirects) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File “/Users/cdebracy/dev/prefect.io/venv/lib/python3.11/site-packages/prefect/client/base.py”, line 251, in send response = await self._send_with_retry( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File “/Users/cdebracy/dev/prefect.io/venv/lib/python3.11/site-packages/prefect/client/base.py”, line 193, in _send_with_retry response = await request() ^^^^^^^^^^^^^^^ File “/Users/cdebracy/dev/prefect.io/venv/lib/python3.11/site-packages/httpx/_client.py”, line 1617, in send response = await self._send_handling_auth( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File “/Users/cdebracy/dev/prefect.io/venv/lib/python3.11/site-packages/httpx/_client.py”, line 1645, in _send_handling_auth response = await self._send_handling_redirects( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File “/Users/cdebracy/dev/prefect.io/venv/lib/python3.11/site-packages/httpx/_client.py”, line 1682, in _send_handling_redirects response = await self._send_single_request(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File “/Users/cdebracy/dev/prefect.io/venv/lib/python3.11/site-packages/httpx/_client.py”, line 1719, in _send_single_request response = await transport.handle_async_request(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File “/Users/cdebracy/dev/prefect.io/venv/lib/python3.11/site-packages/httpx/_transports/default.py”, line 352, in handle_async_request with map_httpcore_exceptions(): File “/usr/local/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/contextlib.py”, line 155, in exit self.gen.throw(typ, value, traceback) File “/Users/cdebracy/dev/prefect.io/venv/lib/python3.11/site-packages/httpx/_transports/default.py”, line 77, in map_httpcore_exceptions raise mapped_exc(message) from exc httpx.ConnectError: All connection attempts failed The above exception was the direct cause of the following exception: Traceback (most recent call last): File “/Users/cdebracy/dev/prefect.io/hello_prefect.py”, line 8, in <module> print(my_favorite_function()) ^^^^^^^^^^^^^^^^^^^^^^ File “/Users/cdebracy/dev/prefect.io/venv/lib/python3.11/site-packages/prefect/flows.py”, line 511, in call return enter_flow_run_engine_from_flow_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File “/Users/cdebracy/dev/prefect.io/venv/lib/python3.11/site-packages/prefect/engine.py”, line 272, in enter_flow_run_engine_from_flow_call retval = from_sync.wait_for_call_in_loop_thread( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File “/Users/cdebracy/dev/prefect.io/venv/lib/python3.11/site-packages/prefect/_internal/concurrency/api.py”, line 243, in wait_for_call_in_loop_thread return call.result() ^^^^^^^^^^^^^ File “/Users/cdebracy/dev/prefect.io/venv/lib/python3.11/site-packages/prefect/_internal/concurrency/calls.py”, line 283, in result return self.future.result(timeout=timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File “/Users/cdebracy/dev/prefect.io/venv/lib/python3.11/site-packages/prefect/_internal/concurrency/calls.py”, line 169, in result return self.__get_result() ^^^^^^^^^^^^^^^^^^^ File “/usr/local/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/concurrent/futures/_base.py”, line 401, in __get_result raise self._exception File “/Users/cdebracy/dev/prefect.io/venv/lib/python3.11/site-packages/prefect/_internal/concurrency/calls.py”, line 346, in _run_async result = await coro ^^^^^^^^^^ File “/Users/cdebracy/dev/prefect.io/venv/lib/python3.11/site-packages/prefect/client/utilities.py”, line 51, in with_injected_client return await fn(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File “/Users/cdebracy/dev/prefect.io/venv/lib/python3.11/site-packages/prefect/engine.py”, line 327, in create_then_begin_flow_run await check_api_reachable(client, “Cannot create flow run”) File “/Users/cdebracy/dev/prefect.io/venv/lib/python3.11/site-packages/prefect/engine.py”, line 2393, in check_api_reachable raise RuntimeError( RuntimeError: Cannot create flow run. Failed to reach API at http://127.0.0.1:4200/api/. Process finished with exit code 1
Probably something stupid I’ve missed, but this worked great OOTB last time.
I found a reference to the ~/.prefect folder and deleted that since I had tried to configure Postgres earlier. Apparently it does not want to work against my GCP Cloud SQL instance of Postgres which is using the Cloud SQL proxy.
So I’m at least up and running with the sqlite3 database for now.
🙌 1