Enable Deploy Metadata for Non-Certified Package Versions via Apex:
- Navigate to Salesforce Setup.
- Type in "Apex Settings" in the Quick Find search box and click Apex Settings.
- Enable the Deploy Metadata from Non-Certified Package Versions via Apex setting by checking the checkbox field.
- Click Save.