EnvironmentNotConfigured: Unable to configure client

Does anyone know why a Python UDF being called in Pipeline Builder would throw the following error?

EnvironmentNotConfigured: Unable to configure client

The UDF imports the necessary resource like this:

from ontology_sdk import FoundryClient

And it’s being used as follows:

FoundryClient().ontology.queries.[functionName]

When testing in the code repository UI, the live preview works perfectly. However, when running the same UDF in Pipeline Builder, it seems unable to instantiate the client. I also tried explicitly passing the hostname to the FoundryClient, but that didn’t resolve the issue.
Has anyone encountered this before or have suggestions for debugging or fixing it?

1 Like

Hi @deank - by default, Python UDFs used in Pipeline Builder are not granted the network access required to call query functions (or access the ontology more broadly) using a FoundryClient.

In order to use a FoundryClient in Pipeline Builder, your best option currently would be to use an external source that is configured for egress to your Foundry instance’s domain:

https://www.palantir.com/docs/foundry/data-connection/set-up-source

https://www.palantir.com/docs/foundry/functions/python-functions-builder#external-api-calls-in-pipeline-builder

https://www.palantir.com/docs/foundry/functions/python-functions-api-calls

You would then explicitly pass hostname and auth (from your source) into the foundry client constructor: FoundryClient(auth=..., hostname=...)

1 Like