internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: feast-dev/feast

Issue:
Could not import module 'feast.infra.offline_stores.snowflake' while attempting to load class 'SnowflakeOfflineStoreConfig'
## Expected Behavior 
feast apply with snowflake as offline store failing

## Current Behavior
feast apply fails with exception Could not import module 'feast.infra.offline_stores.snowflake' while attempting to load class 'SnowflakeOfflineStoreConfig'

## Steps to reproduce

Config:
offline_store:
    type: snowflake.offline
    account: ${ACCOUNT}
    user: ${SNOWFLAKE_USER}
    password: ${SNOWFLAKE_PASSWORD}
    role: ${SNOWFLAKE_ROLE}
    warehouse: ${SNOWFLAKE_WAREHOUSE}
    database: ${SNOWFLAKE_DATABASE}
    schema: ${SNOWFLAKE_SCHEMA}

batch_engine:
  type: snowflake.engine
    account: ${ACCOUNT}
    user: ${SNOWFLAKE_USER}
    password: ${SNOWFLAKE_PASSWORD}
    role: ${SNOWFLAKE_ROLE}
    warehouse: ${SNOWFLAKE_WAREHOUSE}
    database: ${SNOWFLAKE_DATABASE}
    schema: ${SNOWFLAKE_SCHEMA}

### Specifications

- Version:  
   Feast SDK Version: "feast 0.30.2"
   Python 3.10.10

- Platform:  
   Mac os 13.2.1
- Subsystem:

## Possible Solution



Discussion:
I think #3587 should solve this

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -96,11 +96,7 @@
 BYTEWAX_REQUIRED = ["bytewax==0.15.1", "docker>=5.0.2", "kubernetes<=20.13.0"]
 
 SNOWFLAKE_REQUIRED = [
-    "snowflake-connector-python[pandas]>=2.7.3,<3",
-    # `pyOpenSSL==22.1.0` requires `cryptography<39,>=38.0.0`, which is incompatible
-    # with `snowflake-connector-python[pandas]==2.8.0`, which depends on
-    # `cryptography<37.0.0,>=3.1.0`.
-    "pyOpenSSL<22.1.0",
+    "snowflake-connector-python[pandas]>=3,<4",
 ]
 
 SPARK_REQUIRED = [


Test patch:
Repository: feast-dev/feast

Issue:
Schema inference of BQ OfflineStore costly
## Expected Behavior 
When making schema inference, I expect there would be an extra minor cost when scanning tables.

## Current Behavior
BQ OfflineStore made a full scan on the entire table, although we are using `limit` statement. According to GCP documentation:
`Applying a LIMIT clause to a SELECT * query does not affect the amount of data read. You are billed for reading all bytes in the entire table, and the query counts against your free tier quota.`

https://cloud.google.com/bigquery/docs/best-practices-costs

## Steps to reproduce
1. Prepare a large feature table
2. feast apply as a feature view

### Specifications

- Version: 0.28.0
- Platform: Linux
- Subsystem:

## Possible Solution
We can add a filter by `timestamp_field` by modifying this [line](https://github.com/feast-dev/feast/blob/master/sdk/python/feast/infra/offline_stores/bigquery_source.py#L183) even though there is no data, the schema could be inferred eventually


Discussion:

Resolving patch:
diff --git a/sdk/python/feast/infra/offline_stores/bigquery_source.py b/sdk/python/feast/infra/offline_stores/bigquery_source.py
--- a/sdk/python/feast/infra/offline_stores/bigquery_source.py
+++ b/sdk/python/feast/infra/offline_stores/bigquery_source.py
@@ -180,9 +180,9 @@ def get_table_column_names_and_types(
             if not isinstance(schema[0], bigquery.schema.SchemaField):
                 raise TypeError("Could not parse BigQuery table schema.")
         else:
-            bq_columns_query = f"SELECT * FROM ({self.query}) LIMIT 1"
-            queryRes = client.query(bq_columns_query).result()
-            schema = queryRes.schema
+            bq_columns_query = f"SELECT * FROM ({self.query}) LIMIT 0"
+            query_res = client.query(bq_columns_query).result()
+            schema = query_res.schema
 
         name_type_pairs: List[Tuple[str, str]] = []
         for field in schema:


Test patch:
Repository: feast-dev/feast

Issue:
SQL-Registry data_source_name `String(50)` is too short.
**Is your feature request related to a problem? Please describe.**
Our data sources have paths longer than 50 characters. This seems like an unnecessarily short limit for this field.

**Describe the solution you'd like**
A string limit of 255 characters feels more appropriate for a URI.

**Describe alternatives you've considered**
I considered requesting `sqlalchemy.types.Text` as the type instead, an unlimited string field.

**Additional context**
Add any other context or screenshots about the feature request here.



Discussion:

Resolving patch:
diff --git a/sdk/python/feast/infra/registry/sql.py b/sdk/python/feast/infra/registry/sql.py
--- a/sdk/python/feast/infra/registry/sql.py
+++ b/sdk/python/feast/infra/registry/sql.py
@@ -81,7 +81,7 @@
 data_sources = Table(
     "data_sources",
     metadata,
-    Column("data_source_name", String(50), primary_key=True),
+    Column("data_source_name", String(255), primary_key=True),
     Column("project_id", String(50), primary_key=True),
     Column("last_updated_timestamp", BigInteger, nullable=False),
     Column("data_source_proto", LargeBinary, nullable=False),


Test patch:
Repository: feast-dev/feast

Issue:
BigQuery internal type mapping does not support NUMERIC
## Expected Behavior 
Should handle mapping from BQ's NUMERIC type

## Current Behavior
Thrown KeyError

## Steps to reproduce
Prepare feature view with data source contains at least one NUMERIC column

### Specifications

- Version: 0.32.0
- Platform: ubuntu
- Subsystem:

## Possible Solution
Add NUMERIC to mapping logic



Discussion:

Resolving patch:
diff --git a/sdk/python/feast/type_map.py b/sdk/python/feast/type_map.py
--- a/sdk/python/feast/type_map.py
+++ b/sdk/python/feast/type_map.py
@@ -528,6 +528,7 @@ def bq_to_feast_value_type(bq_type_as_str: str) -> ValueType:
         "DATETIME": ValueType.UNIX_TIMESTAMP,
         "TIMESTAMP": ValueType.UNIX_TIMESTAMP,
         "INTEGER": ValueType.INT64,
+        "NUMERIC": ValueType.INT64,
         "INT64": ValueType.INT64,
         "STRING": ValueType.STRING,
         "FLOAT": ValueType.DOUBLE,


Test patch:
Repository: feast-dev/feast

Issue:
Redis version in setup.py contains fixable vulnerabilities
## Expected Behaviour 

## Current Behaviour:
trivvy scanning of our feature server container is failing due to the fixed version of redis in setup.py (4.2.2) - it looks this version hasn't been updated in a year. 

![Screenshot 2023-08-31 at 10 41 11](https://github.com/feast-dev/feast/assets/14976256/c3e2f538-e959-41bb-b975-277ab7c14bab)

## Steps to reproduce

### Specifications

- Version: feast[redis]==0.31.1
- Platform:
- Subsystem:

## Possible Solution
Bump to latest redis or lowest fixed version


Discussion:

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -92,7 +92,7 @@
 ]
 
 REDIS_REQUIRED = [
-    "redis==4.2.2",
+    "redis>=4.2.2,<5",
     "hiredis>=2.0.0,<3",
 ]
 


Test patch:
Repository: feast-dev/feast

Issue:
Postgres engine default keepalives_idle value causes setsockopt(TCP_KEEPIDLE) invalid value
Get `OperationalError: connection to server at "localhost" (127.0.0.1), port 5432 failed: setsockopt(TCP_KEEPIDLE) failed: Invalid argument` when run `feast apply`.
Because of `keepalives_idle=config.keepalives_idle` field in function '_get_conn' in `infra/utils/postgres/connection_utils.py` file. For example, to avoid this error I need to pass 'keepalives_idle=1', but that argument isn't parsed for the registry in feature_store.yaml and pass 'keepalives_idle=0' by default setting in `infra/utils/postgres/postgres_config.py`. 

- Version: 0.33.1
- Platform: linux ubuntu 20.04
- Subsystem:

## Possible Solution
Check this issue with the same problem https://github.com/TobikoData/sqlmesh/issues/750. I think you shouldn't pass 'keepalives_idle=0' by default.


Discussion:

Resolving patch:
diff --git a/sdk/python/feast/infra/utils/postgres/postgres_config.py b/sdk/python/feast/infra/utils/postgres/postgres_config.py
--- a/sdk/python/feast/infra/utils/postgres/postgres_config.py
+++ b/sdk/python/feast/infra/utils/postgres/postgres_config.py
@@ -25,4 +25,4 @@ class PostgreSQLConfig(FeastConfigBaseModel):
     sslkey_path: Optional[StrictStr] = None
     sslcert_path: Optional[StrictStr] = None
     sslrootcert_path: Optional[StrictStr] = None
-    keepalives_idle: int = 0
+    keepalives_idle: Optional[int] = None


Test patch:
Repository: feast-dev/feast

Issue:
Feast ui cannot parse url path
## Expected Behavior 

One of example cases:
When user navigate localhost:8888/p/order_count_project/feature-view/user_3_and_7_days_order_count should see related feature-view page

## Current Behavior

One of example cases:
When user navigate localhost:8888/p/order_count_project/feature-view/user_3_and_7_days_order_count see "Internal Server Error"

## Steps to reproduce

install feast 0.34.1
run feast ui
navigate homepage localhost:8888
navigate any page (entities or feature-view or data sources doesn't matter)
you will see the page you clicked at browser search bar like http://localhost:8888/p/order_count_project/data-source 
then refresh or copy url open in new tab
you will see internal server error

### Specifications

- Version: 0.34.1
- Platform: macos
- Subsystem: 

## Possible Solution

ui_server.py file updated recently. commit changes resource finder library and then it returns PosixPath. 
We should convert to str and add little "/" to "@app.api_route("/p/{path_name:path}", methods=["GET"])" function




Discussion:

Resolving patch:
diff --git a/sdk/python/feast/ui_server.py b/sdk/python/feast/ui_server.py
--- a/sdk/python/feast/ui_server.py
+++ b/sdk/python/feast/ui_server.py
@@ -77,7 +77,7 @@ def read_registry():
     # For all other paths (such as paths that would otherwise be handled by react router), pass to React
     @app.api_route("/p/{path_name:path}", methods=["GET"])
     def catch_all():
-        filename = ui_dir + "index.html"
+        filename = ui_dir.joinpath("index.html")
 
         with open(filename) as f:
             content = f.read()


Test patch:
Repository: feast-dev/feast

Issue:
google-cloud-bigquery 3.13.0 breaking change
## Expected Behavior 
Successfully get the pyarrow datatype from a feast ValueType using the `feast_value_type_to_pa` function

## Current Behavior
Currently receive the error `feast.errors.FeastExtrasDependencyImportError: cannot import name 'ARROW_SCALAR_IDS_TO_BQ' from 'google.cloud.bigquery._pandas_helpers'`

## Steps to reproduce
Install feast with the latest GCP dependencies and try to convert a feast schema to pyarrow through the use of the function `feast_value_type_to_pa` 

### Specifications

- Version: 0.34.1
- Platform: Linux
- Subsystem: Debian 11 (bullseye)

## Possible Solution
Downgrade to google-cloud-bigquery 3.12.0



Discussion:
@tfusillo mind making a PR for this?
I got the same error with 

> google-cloud-bigquery==0.32.1
> feast[redis,gcp]==0.33.1

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -31,7 +31,6 @@
     from setuptools.command.install import install
 
 except ImportError:
-    from distutils.command.build_ext import build_ext as _build_ext
     from distutils.command.build_py import build_py
     from distutils.core import setup
 
@@ -80,18 +79,18 @@
     # FastAPI does not correctly pull starlette dependency on httpx see thread(https://github.com/tiangolo/fastapi/issues/5656).
     "httpx>=0.23.3",
     "importlib-resources>=6.0.0,<7",
-    "importlib_metadata>=6.8.0,<7"
+    "importlib_metadata>=6.8.0,<7",
 ]
 
 GCP_REQUIRED = [
     "google-api-core>=1.23.0,<3",
     "googleapis-common-protos>=1.52.0,<2",
-    "google-cloud-bigquery[pandas]>=2,<4",
+    "google-cloud-bigquery[pandas]>=2,<3.13.0",
     "google-cloud-bigquery-storage >= 2.0.0,<3",
     "google-cloud-datastore>=2.1.0,<3",
     "google-cloud-storage>=1.34.0,<3",
     "google-cloud-bigtable>=2.11.0,<3",
-    "gcsfs",
+    "fsspec<2023.10.0",
 ]
 
 REDIS_REQUIRED = [
@@ -99,7 +98,7 @@
     "hiredis>=2.0.0,<3",
 ]
 
-AWS_REQUIRED = ["boto3>=1.17.0,<2", "docker>=5.0.2", "s3fs"]
+AWS_REQUIRED = ["boto3>=1.17.0,<2", "docker>=5.0.2", "fsspec<2023.10.0"]
 
 BYTEWAX_REQUIRED = ["bytewax==0.15.1", "docker>=5.0.2", "kubernetes<=20.13.0"]
 
@@ -159,8 +158,8 @@
         "moto",
         "mypy>=0.981,<0.990",
         "avro==1.10.0",
-        "gcsfs",
-        "urllib3>=1.25.4,<2",
+        "fsspec<2023.10.0",
+        "urllib3>=1.25.4,<3",
         "psutil==5.9.0",
         "py>=1.11.0",  # https://github.com/pytest-dev/pytest/issues/10420
         "pytest>=6.0.0,<8",
@@ -173,7 +172,6 @@
         "pytest-mock==1.10.4",
         "Sphinx>4.0.0,<7",
         "testcontainers>=3.5,<4",
-        "adlfs==0.5.9",
         "firebase-admin>=5.2.0,<6",
         "pre-commit<3.3.2",
         "assertpy==1.1",
@@ -184,10 +182,10 @@
         "types-pytz",
         "types-PyYAML",
         "types-redis",
-        "types-requests",
+        "types-requests<2.31.0",
         "types-setuptools",
         "types-tabulate",
-        "virtualenv<20.24.2"
+        "virtualenv<20.24.2",
     ]
     + GCP_REQUIRED
     + REDIS_REQUIRED


Test patch:
Repository: feast-dev/feast

Issue:
An error occurs when pushing to bigquery with microseconds timestamp fields
## Expected Behavior 

When you call the push API to add data with bigquery, you will receive a response of 200.

## Current Behavior

If timestamp_fields is entered in Microseconds, a 500 error occurs.

## Steps to reproduce

Call the API by inserting an Integer with microseconds precision into the timestamp field.

### Specifications

- Version: master branch
- Platform:
- Subsystem:

## Possible Solution

Allow truncation of numbers when coercing nano seconds in pyarrow write_table.



Discussion:

Resolving patch:
diff --git a/sdk/python/feast/infra/offline_stores/bigquery.py b/sdk/python/feast/infra/offline_stores/bigquery.py
--- a/sdk/python/feast/infra/offline_stores/bigquery.py
+++ b/sdk/python/feast/infra/offline_stores/bigquery.py
@@ -356,7 +356,10 @@ def write_logged_features(
             # In Pyarrow v13.0, the parquet version was upgraded to v2.6 from v2.4.
             # Set the coerce_timestamps to "us"(microseconds) for backward compatibility.
             pyarrow.parquet.write_table(
-                table=data, where=parquet_temp_file, coerce_timestamps="us"
+                table=data,
+                where=parquet_temp_file,
+                coerce_timestamps="us",
+                allow_truncated_timestamps=True,
             )
 
             parquet_temp_file.seek(0)
@@ -407,7 +410,10 @@ def offline_write_batch(
             # In Pyarrow v13.0, the parquet version was upgraded to v2.6 from v2.4.
             # Set the coerce_timestamps to "us"(microseconds) for backward compatibility.
             pyarrow.parquet.write_table(
-                table=table, where=parquet_temp_file, coerce_timestamps="us"
+                table=table,
+                where=parquet_temp_file,
+                coerce_timestamps="us",
+                allow_truncated_timestamps=True,
             )
 
             parquet_temp_file.seek(0)
diff --git a/sdk/python/feast/infra/utils/aws_utils.py b/sdk/python/feast/infra/utils/aws_utils.py
--- a/sdk/python/feast/infra/utils/aws_utils.py
+++ b/sdk/python/feast/infra/utils/aws_utils.py
@@ -353,7 +353,12 @@ def upload_arrow_table_to_redshift(
         with tempfile.TemporaryFile(suffix=".parquet") as parquet_temp_file:
             # In Pyarrow v13.0, the parquet version was upgraded to v2.6 from v2.4.
             # Set the coerce_timestamps to "us"(microseconds) for backward compatibility.
-            pq.write_table(table, parquet_temp_file, coerce_timestamps="us")
+            pq.write_table(
+                table,
+                parquet_temp_file,
+                coerce_timestamps="us",
+                allow_truncated_timestamps=True,
+            )
             parquet_temp_file.seek(0)
             s3_resource.Object(bucket, key).put(Body=parquet_temp_file)
 


Test patch:
Repository: feast-dev/feast

Issue:
No such option: -f for feast CLI
## Expected Behavior 

According to documentation:
https://docs.feast.dev/how-to-guides/feast-snowflake-gcp-aws/structuring-repos
```
feast -f staging/feature_store.yaml apply
```
should work

## Current Behavior

```
Usage: feast [OPTIONS] COMMAND [ARGS]...
Try 'feast --help' for help.

Error: No such option: -f
```
## Steps to reproduce

### Specifications

- Version: 0.34.1
- Platform: Linux
- Subsystem:



Discussion:
I think this is just a docs error. The [correct flag ](https://github.com/feast-dev/feast/blob/2192e6527fa10f1580e4dd8f350e05e45af981b7/sdk/python/feast/cli.py#L74)is `--feature-store-yaml` if you need this functionality, eg 

```
feast --feature-store-yaml=staging/feature_store.yaml apply
```

I agree.
> I agree.

I'm happy to open a PR to update these docs.
go for it if you have time. :)

Resolving patch:
diff --git a/sdk/python/feast/cli.py b/sdk/python/feast/cli.py
--- a/sdk/python/feast/cli.py
+++ b/sdk/python/feast/cli.py
@@ -76,6 +76,7 @@ def format_options(self, ctx: click.Context, formatter: click.HelpFormatter):
 )
 @click.option(
     "--feature-store-yaml",
+    "-f",
     help="Override the directory where the CLI should look for the feature_store.yaml file.",
 )
 @click.pass_context


Test patch:
Repository: feast-dev/feast

Issue:
Error when fetching historical data from Snowflake with null array type fields
## Expected Behavior 

When fetching data for an entity that has no record for a feature view with an array type column it should return `None` and not throw an exception.


## Current Behavior

When fetching historical data from a Snowflake offline store it'll throw an exception when an entity has no record in a FeatureView with an array-type field. 

## Steps to reproduce

### Specifications

- Version:
- Platform:
- Subsystem:

## Possible Solution

I'll have a PR up shortly.



Discussion:

Resolving patch:
diff --git a/sdk/python/feast/infra/offline_stores/snowflake.py b/sdk/python/feast/infra/offline_stores/snowflake.py
--- a/sdk/python/feast/infra/offline_stores/snowflake.py
+++ b/sdk/python/feast/infra/offline_stores/snowflake.py
@@ -463,7 +463,9 @@ def _to_df_internal(self, timeout: Optional[int] = None) -> pd.DataFrame:
                     Array(Float32),
                     Array(Bool),
                 ]:
-                    df[feature.name] = [json.loads(x) for x in df[feature.name]]
+                    df[feature.name] = [
+                        json.loads(x) if x else None for x in df[feature.name]
+                    ]
 
         return df
 


Test patch:
diff --git a/sdk/python/tests/unit/infra/offline_stores/test_snowflake.py b/sdk/python/tests/unit/infra/offline_stores/test_snowflake.py
--- a/sdk/python/tests/unit/infra/offline_stores/test_snowflake.py
+++ b/sdk/python/tests/unit/infra/offline_stores/test_snowflake.py
@@ -1,14 +1,18 @@
 import re
 from unittest.mock import ANY, MagicMock, patch
 
+import pandas as pd
 import pytest
+from pytest_mock import MockFixture
 
+from feast import FeatureView, Field, FileSource
 from feast.infra.offline_stores.snowflake import (
     SnowflakeOfflineStoreConfig,
     SnowflakeRetrievalJob,
 )
 from feast.infra.online_stores.sqlite import SqliteOnlineStoreConfig
 from feast.repo_config import RepoConfig
+from feast.types import Array, String
 
 
 @pytest.fixture(params=["s3", "s3gov"])
@@ -55,3 +59,25 @@ def test_to_remote_storage(retrieval_job):
         mock_get_file_names_from_copy.assert_called_once_with(ANY, ANY)
         native_path = mock_get_file_names_from_copy.call_args[0][1]
         assert re.match("^s3://.*", native_path), "path should be s3://*"
+
+
+def test_snowflake_to_df_internal(
+    retrieval_job: SnowflakeRetrievalJob, mocker: MockFixture
+):
+    mock_execute = mocker.patch(
+        "feast.infra.offline_stores.snowflake.execute_snowflake_statement"
+    )
+    mock_execute.return_value.fetch_pandas_all.return_value = pd.DataFrame.from_dict(
+        {"feature1": ['["1", "2", "3"]', None, "[]"]}  # For Valid, Null, and Empty
+    )
+
+    feature_view = FeatureView(
+        name="my-feature-view",
+        entities=[],
+        schema=[
+            Field(name="feature1", dtype=Array(String)),
+        ],
+        source=FileSource(path="dummy.path"),  # Dummy value
+    )
+    retrieval_job._feature_views = [feature_view]
+    retrieval_job._to_df_internal()
Repository: feast-dev/feast

Issue:
Bump the cryptography version to 42
**Is your feature request related to a problem? Please describe.**
`cryptography<42` package has some medium vulnerabilities. Example: https://scout.docker.com/vulnerabilities/id/CVE-2023-50782?s=github&n=cryptography&t=pypi&vr=%3C42.0.0&utm_source=desktop&utm_medium=ExternalLink

starlette and fastapi had some high vulnerabilities but that was recently bumped up and thanks to that, they are removed.

**Describe the solution you'd like**
Bump the cryptography package to>=42. Nice to have: bumping up of other compatible packages also. 



Discussion:
snowflake-connector-python is blocking the bump https://github.com/snowflakedb/snowflake-connector-python/blob/v3.7.0/setup.cfg#L48

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -148,7 +148,7 @@
     [
         "build",
         "virtualenv==20.23.0",
-        "cryptography>=35.0,<42",
+        "cryptography>=35.0,<43",
         "flake8>=6.0.0,<6.1.0",
         "black>=22.6.0,<23",
         "isort>=5,<6",


Test patch:
Repository: feast-dev/feast

Issue:
crash (segfault?) on protobuf>=4.24.0
## Expected Behavior 

Feast should not crash.

## Current Behavior

As commented in 028cc20a28118bd31deca8965782d5ad25f74300, Feast crashes with  protobuf>=4.24.0. The most recent version of protobuf that Feast can use is 4.23 which stopped being supported in August of 2023 <https://protobuf.dev/support/version-support/>

## Steps to reproduce

I see this on `feast apply`, the original report is unclear.


Discussion:
this one seems an urgent bug. 
working on this. I do see segmentation errors.
I find this related issue from protobuf's Github repo: https://github.com/protocolbuffers/protobuf/issues/13485  , especially, this comment: https://github.com/protocolbuffers/protobuf/issues/13485#issuecomment-1686758403

Resolving patch:
diff --git a/sdk/python/feast/feature_store.py b/sdk/python/feast/feature_store.py
--- a/sdk/python/feast/feature_store.py
+++ b/sdk/python/feast/feature_store.py
@@ -82,6 +82,7 @@
 from feast.infra.registry.sql import SqlRegistry
 from feast.on_demand_feature_view import OnDemandFeatureView
 from feast.online_response import OnlineResponse
+from feast.protos.feast.core.InfraObject_pb2 import Infra as InfraProto
 from feast.protos.feast.serving.ServingService_pb2 import (
     FieldStatus,
     GetOnlineFeaturesResponse,
@@ -745,7 +746,8 @@ def plan(
         # Compute the desired difference between the current infra, as stored in the registry,
         # and the desired infra.
         self._registry.refresh(project=self.project)
-        current_infra_proto = self._registry.proto().infra.__deepcopy__()
+        current_infra_proto = InfraProto()
+        current_infra_proto.CopyFrom(self._registry.proto().infra)
         desired_registry_proto = desired_repo_contents.to_registry_proto()
         new_infra = self._provider.plan_infra(self.config, desired_registry_proto)
         new_infra_proto = new_infra.to_proto()
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -51,7 +51,7 @@
     "numpy>=1.22,<1.25",
     "pandas>=1.4.3,<3",
     # Higher than 4.23.4 seems to cause a seg fault
-    "protobuf<4.23.4,>3.20",
+    "protobuf>=4.24.0,<5.0.0",
     "proto-plus>=1.20.0,<2",
     "pyarrow>=4",
     "pydantic>=2.0.0",


Test patch: