https://pantsbuild.org/ logo
#general
Title
# general
p

plain-summer-72727

10/31/2022, 11:29 PM
Hi - I'm trying out the new environments feature in 2.15.0a0 and I'm running into the following issue:
Copy code
raise InvalidFieldException(
pants.engine.target.InvalidFieldException: Unrecognized field `environment=local_docker` in target src/database:funstuff. Valid fields for the target type `pex_binary`: ['complete_platforms', 'dependencies', 'description', 'emit_warnings', 'entry_point', 'execution_mode', 'ignore_errors', 'include_requirements', 'include_sources', 'include_tools', 'inherit_path', 'interpreter_constraints', 'layout', 'output_path', 'platforms', 'resolve', 'resolve_local_platforms', 'restartable', 'script', 'shebang', 'strip_pex_env', 'tags', 'venv_site_packages_copies'].
I just want to confirm that I have 2.15.0a0 set up properly, since it looks like my pex_binary target isn't accepting
environment
as a field: • I set
pants_version
to 2.15.0a0 • In pants.toml, I set
[environments-preview.names]
to
local_docker="//:local_docker"
• In my topmost BUILD file I added:
Copy code
docker_environment(
    name="local_docker",
    platform="linux_x86_64",
    image="python:3.9-bullseye",
)
• Lastly, in src/database/BUILD I added:
Copy code
pex_binary(
    name="funstuff",
    entry_point="funstuff.py",
    environment="local_docker",
)

docker_image(
    name="docker_image",
    instructions=[
        "FROM python:3.9-bullseye",
        'ENTRYPOINT ["/main"]',
        "COPY examples/main.pex /main",
    ],
)
(funstuff.py is just a hello-world Python script). Definitely understand that this is an alpha build but I figured this is likely a basic error w/ something I'm msising. Help would be appreciated - thank you!
w

witty-crayon-22786

10/31/2022, 11:34 PM
mmm: it looks like
pex_binary
didn’t actually get its
environment=
field: sorry for the oversight! we’ll get a change out for that tomorrow.
p

plain-summer-72727

10/31/2022, 11:36 PM
No worries - thank you for the quick response!
a

ancient-vegetable-10556

11/02/2022, 5:21 PM
Just getting a fix into
main
now!
i

incalculable-hydrogen-44003

11/04/2022, 2:39 PM
Thank you! @ancient-vegetable-10556 Are we good to try it out?
a

ancient-vegetable-10556

11/04/2022, 2:50 PM
@incalculable-hydrogen-44003 You may have to use
PANTS_SHA
to invoke it, as there isn’t a release yet, but if you’re OK with that, then yes!
i

incalculable-hydrogen-44003

11/04/2022, 2:51 PM
ok. we will give it a shot
I get these errors when I run with the SHA
Copy code
A deprecated alias for `[python-repos].find_links`.
12:01:42.32 [ERROR] Invalid option 'tailor_ignore_solitary_init_files' under [python] in /home/sepehr500/Documents/starkblast/pants.toml
12:01:42.32 [ERROR] Invalid option 'inits' under [python-infer] in /home/sepehr500/Documents/starkblast/pants.toml
12:01:42.32 [ERROR] Invalid config entries detected. See log for details on which entries to update or remove.
(Specify --no-verify-config to disable this check.)
Were these options removed?
a

ancient-vegetable-10556

11/04/2022, 4:05 PM
Not sure which sha you’re trying, but if you got a sha from main instead of the release branch, try
34c5cd8f22d9db60c4478824cbdc17932b15457c
first
i

incalculable-hydrogen-44003

11/04/2022, 4:05 PM
2de6f77ee6dfb4acf89e45f5e3b9ec7cb8ebdb11
a

ancient-vegetable-10556

11/04/2022, 4:05 PM
options shouldn’t have disappeared after 2.15.0a1 went out
i

incalculable-hydrogen-44003

11/04/2022, 4:06 PM
ok. will give that sha a shot
a

ancient-vegetable-10556

11/04/2022, 4:06 PM
2de…
is on
main
, which will have the 2.16 API, not the 2.15 API
i

incalculable-hydrogen-44003

11/04/2022, 4:07 PM
got it
a

ancient-vegetable-10556

11/04/2022, 4:07 PM
34c….
is on
2.15.x
i

incalculable-hydrogen-44003

11/04/2022, 4:07 PM
ERROR: No matching distribution found for pantsbuild.pants==2.15.0a0+git34c5cd8f
with sha
34c5cd8f22d9db60c4478824cbdc17932b15457c
a

ancient-vegetable-10556

11/04/2022, 4:09 PM
how are you running pants?
i

incalculable-hydrogen-44003

11/04/2022, 4:09 PM
PANTS_SHA=34c5cd8f22d9db60c4478824cbdc17932b15457c ./pants package src/cort/manage.py -- runserver 0.0.0.0:8000 --noreload
a

ancient-vegetable-10556

11/04/2022, 4:10 PM
hmm ok
that seems right, and it’s failing for me similarly
OK, I’ve figured it out. Using
PANTS_SHA
goes and looks for a wheel that has been built in CI.
34c
did not have a wheel uploaded. I went back through commits in the 2.15.x branch, and this one has the fix available, and is ready to go:
217edbcdc37b3005abb96911f1e65a7d6b938669
i

incalculable-hydrogen-44003

11/04/2022, 4:14 PM
ok. thanks. will give it a shot
hmm...getting the same error
Copy code
A deprecated alias for `[python-repos].find_links`.
12:01:42.32 [ERROR] Invalid option 'tailor_ignore_solitary_init_files' under [python] in /home/sepehr500/Documents/starkblast/pants.toml
12:01:42.32 [ERROR] Invalid option 'inits' under [python-infer] in /home/sepehr500/Documents/starkblast/pants.toml
12:01:42.32 [ERROR] Invalid config entries detected. See log for details on which entries to update or remove.
(Specify --no-verify-config to disable this check.)
a

ancient-vegetable-10556

11/04/2022, 4:16 PM
OK, I’m not 100% across changes made to tailor. That’s usually Eric’s role, but they’re out today
i

incalculable-hydrogen-44003

11/04/2022, 4:16 PM
ok. no worries. thanks
So would you say at the moment there is no way to test out cross-platform builds?
because of the pex
environment=
issue?
a

ancient-vegetable-10556

11/04/2022, 4:19 PM
There is no way to test it on a published version of Pants. You can use that sha I sent — try using
--no-verify-config
to switch off the errors. There may be a way to adjust your config to silence those errors, but
--no-verify-config
is at least a starting point
make sure you can successfully do a single-environment build first though
w

witty-crayon-22786

11/04/2022, 4:19 PM
@incalculable-hydrogen-44003: what version were you using previously? we recommend updating 1 minor version at a time (2.13 -> 2.14, 2.14 -> 2.15, etc)
things shouldn’t be removed without deprecations: if they were, it’s a bug
i

incalculable-hydrogen-44003

11/04/2022, 4:21 PM
we are on 13. I can bump to 15 see what happens
tried out
2.15.0a0
and got
nvalid option 'tailor_ignore_solitary_init_files'
I guess they were removed?
w

witty-crayon-22786

11/04/2022, 4:24 PM
@incalculable-hydrogen-44003: what i am saying is that you should upgrade to 2.14 successfully before trying to go to 2.15*
but yes: in 2.14 you should see a deprecation for that option
i

incalculable-hydrogen-44003

11/04/2022, 4:24 PM
ok. trying that now
w

witty-crayon-22786

11/04/2022, 4:24 PM
i

incalculable-hydrogen-44003

11/04/2022, 4:26 PM
hm...ya got
Invalid option 'inits'
on 2.14.0
I guess I will look at the changelog for deprecation
w

witty-crayon-22786

11/04/2022, 4:26 PM
let’s start a new thread for this: you’ll need to do the 2.14 upgrade before trying to jump to 2.15
i

incalculable-hydrogen-44003

11/04/2022, 4:26 PM
sounds good. sorry about that
w

witty-crayon-22786

11/04/2022, 4:26 PM
and fix any deprecations you already have on 2.13
and regarding not being able to use PANTS_SHA for some builds: those are likely “docs only” builds, which won’t build wheels
i

incalculable-hydrogen-44003

11/04/2022, 6:30 PM
Getting this error after fixing deprecation errors
[Errno 2] No such file or directory: '/tmp/pants-sandbox-hFwPns/.tmp/pex-pip-log.ck6i41a7/pip.log'
on the sha
217edbcdc37b3005abb96911f1e65a7d6b938669
w

witty-crayon-22786

11/04/2022, 6:34 PM
that’s probably unrelated to this thread, but we’d be happy to help debug it… can you open a new thread with some more context? alpha releases are … alpha
i

incalculable-hydrogen-44003

11/04/2022, 6:34 PM
yup!
4 Views