Multiple setup.py found and couldn't decide which one to use

Hello everyone,

I’m following the official Palantir Foundry tutorial for training a model from a code repository (https://www.palantir.com/docs/foundry/model-integration/tutorial-train-code-repositories) and I’ve run into the following error when launching my training job:

[STDERR]
ERROR × Multiple setup.py found and couldn’t decide which one to use: Found: [
"/app/ri.jemma.main.job.00000002-f0a5-8992-aeba-b3d43d8d1f8d-dce72e1c-bf76-4b0b-b900-b6bfae105b0f/repo/transforms-model-training/src/setup.py",
"/app/ri.jemma.main.job.00000002-f0a5-8992-aeba-b3d43d8d1f8d-dce72e1c-bf76-4b0b-b900-b6bfae105b0f/repo/transforms-model-training/src/setup.py.template",
]

What puzzles me is that in the “Project setup” section of the docs both setup.py and setup.py.template are shown side-by-side without any mention of a conflict—and the tutorial itself doesn’t indicate how to tell Foundry which one to pick.

What am I missing?

Did you try deleting the setup.py.template file?

In the end the underlying Git version control allows you to easily revert everything.

Hi @nicornk!

Yes, I did try deleting the setup.py.template file, but that just led to a different error:

[STDERR]
 WARN Traceback (most recent call last):    
 WARN   File "/app/ri.jemma.main.job.00000002-f299-1b66-9dc8-8dc784290303-f17780c2-5916-41ff-a526-cd4890d7a212/repo/transforms-model-training/build/conda/run-env/bin/transforms", line 11, in <module>    
 WARN     sys.exit(main())    
 WARN              ^^^^^^    
 WARN   File "/app/ri.jemma.main.job.00000002-f299-1b66-9dc8-8dc784290303-f17780c2-5916-41ff-a526-cd4890d7a212/repo/transforms-model-training/build/conda/run-env/lib/python3.12/site-packages/transforms/bin/__main__.py", line 47, in main    
 WARN     args.function(args)    
 WARN   File "/app/ri.jemma.main.job.00000002-f299-1b66-9dc8-8dc784290303-f17780c2-5916-41ff-a526-cd4890d7a212/repo/transforms-model-training/build/conda/run-env/lib/python3.12/site-packages/transforms/bin/buildgraph.py", line 84, in main    
 WARN     pipeline = Pipeline._from_entry_point(**kwargs)    
 WARN                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^    
 WARN   File "/app/ri.jemma.main.job.00000002-f299-1b66-9dc8-8dc784290303-f17780c2-5916-41ff-a526-cd4890d7a212/repo/transforms-model-training/build/conda/run-env/lib/python3.12/site-packages/transforms/api/_pipeline.py", line 272, in _from_entry_point    
 WARN     raise _errors.EntryPointError(    
 WARN transforms._errors.EntryPointError: "Key root was not found, please check your repo's meta.yaml and setup.py files"    
ERROR × User code error

  Maestro version 0.479.0

Besides, in the tutorial’s “Project setup” section both setup.cfg and setup.py.template are shown side-by-side without any instruction to remove one. I expected Foundry to handle both files correctly out of the box.

Thanks again for your help!

[FIXED]

Fixing Multiple Error in Palantir Foundry

Here’s a step-by-step summary of all the changes needed to get Foundry to discover your pipeline and transforms correctly:


1. Rename setup.py.template

  • What:
    mv src/setup.py.template src/setup.py
    
    

Why:
Avoids the initial error:

Multiple setup.py found and couldn’t decide which one to use…

2. Update the entry point in setup.py

Open src/setup.py and replace the placeholder with root:

Before
 entry_points={
-    "transforms.pipelines": ["@pipelineOverrideUuid@ = main.pipeline:pipeline"]
 }
After
 entry_points={
+    "transforms.pipelines": ["root = main.pipeline:pipeline"]
 }

Why:
Avoids the next error

Instructs Foundry to load your pipeline under the key root.

3. Explicitly import each transform module in pipeline.py

I would like to run my src/main/model_training/feature_engineering.py so edit src/main/pipeline.py :

from transforms.api import Pipeline
from main.model_training import feature_engineering

pipeline = Pipeline()
pipeline.discover_transforms feature_engineering

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.