Hey, I'm trying to migrate from the old tool lockf...
# general
r
Hey, I'm trying to migrate from the old tool lockfiles to the new way but am getting the following error:
Copy code
InvalidLockfileError: You are consuming `isort[colors,pyproject]<6.0,>=5.9.3` from the `toolshed` lockfile at 3rdparty/python/toolshed.lock with incompatible inputs.



- The inputs use interpreter constraints (`CPython<4,>=3.7`) that are not a subset of those used to generate the lockfile (`CPython==3.8.* OR CPython==3.9.*`).

- The input interpreter constraints are specified by your code, using the `[python].interpreter_constraints` option and the `interpreter_constraints` target field.

- To create a lockfile with new interpreter constraints, update the option `[python].resolves_to_interpreter_constraints`, and then generate the lockfile (see below).

See <https://www.pantsbuild.org/v2.16/docs/python-interpreter-compatibility> for details.

To regenerate your lockfile, run `pants generate-lockfiles --resolve=toolshed`.

See <https://www.pantsbuild.org/v2.16/docs/python-third-party-dependencies> for details.
However. when I run
pants py-constraints ::
I get the following:
Copy code
Final merged constraints: CPython==3.8.*,==3.9.*
Everything in my repo is running either Python 3.8 or 3.9 so not sure which input it is complaining about
p
if you run
./pants help-advanced isort
you will see the interpreter for isort, if you didn't override those anywhere they will be the default, which is
CPython>=3.7,<4
so the workaround might require you to override this value in your pants.toml file.
h
This should be fixed in rc2/rc3 though - it will take the ICs from the lockfile
r
I'm getting this error when trying to upgrade to rc3 ->
Copy code
(3.9.16) nick.dellosa@Nicks-MacBook-Pro data-platform % pants --print-stacktrace -ldebug version
08:53:01.84 [DEBUG] acquiring lock: <pants.pantsd.lock.OwnerPrintingInterProcessFileLock object at 0x1184890a0>
08:53:01.84 [DEBUG] purging metadata directory: /Users/nick.dellosa/Projects/data-platform/.pids/1595a63b9a44/pantsd
08:53:01.84 [DEBUG] Launching pantsd
08:53:01.84 [DEBUG] purging metadata directory: /Users/nick.dellosa/Projects/data-platform/.pids/1595a63b9a44/pantsd
08:53:01.84 [DEBUG] pantsd command is: PANTS_DAEMON_ENTRYPOINT=pants.pantsd.pants_daemon:launch_new_pantsd_instance PYTHONPATH=/Users/nick.dellosa/Projects/data-platform/dist/export/python/virtualenvs/pants-plugins/3.9.16/bin:/Users/nick.dellosa/.pyenv/versions/3.9.16/lib/python39.zip:/Users/nick.dellosa/.pyenv/versions/3.9.16/lib/python3.9:/Users/nick.dellosa/.pyenv/versions/3.9.16/lib/python3.9/lib-dynload:/Users/nick.dellosa/Projects/data-platform/dist/export/python/virtualenvs/pants-plugins/3.9.16/lib/python3.9/site-packages /Users/nick.dellosa/Projects/data-platform/dist/export/python/virtualenvs/pants-plugins/3.9.16/bin/python3.9 /Users/nick.dellosa/Projects/data-platform/dist/export/python/virtualenvs/pants-plugins/3.9.16/bin/pants --print-stacktrace -ldebug version
08:53:06.88 [INFO] waiting for pantsd to start...
08:53:09.66 [INFO] pantsd started
08:53:09.66 [DEBUG] pantsd is running at pid 17339, pailgun port is 49979
08:53:09.66 [DEBUG] releasing lock: <pants.pantsd.lock.OwnerPrintingInterProcessFileLock object at 0x1184890a0>
08:53:09.66 [DEBUG] Connecting to pantsd on port 49979
08:53:09.67 [DEBUG] Connecting to pantsd on port 49979 attempt 1/3
08:53:09.67 [DEBUG] Connected to pantsd
08:53:09.69 [DEBUG] Launching 1 roots (poll=false).
08:53:09.69 [DEBUG] computed 1 nodes in 0.002483 seconds. there are 9 total nodes.
08:53:09.69 [ERROR] 1 Exception encountered:

Engine traceback:
  in select
    ..
  in pants.core.util_rules.environments.determine_local_environment
    ..
  in pants.core.util_rules.environments.determine_all_environments
    ..
  in construct_scope_environments_preview
    ..

Traceback (most recent call last):
  File "/Users/nick.dellosa/Projects/data-platform/dist/export/python/virtualenvs/pants-plugins/3.9.16/lib/python3.9/site-packages/pants/engine/internals/selectors.py", line 623, in native_engine_generator_send
    res = rule.send(arg) if err is None else rule.throw(throw or err)
  File "/Users/nick.dellosa/Projects/data-platform/dist/export/python/virtualenvs/pants-plugins/3.9.16/lib/python3.9/site-packages/pants/option/subsystem.py", line 311, in _construct_subsytem
    scoped_options = await Get(ScopedOptions, Scope(str(subsystem_typ.options_scope)))
  File "/Users/nick.dellosa/Projects/data-platform/dist/export/python/virtualenvs/pants-plugins/3.9.16/lib/python3.9/site-packages/pants/engine/internals/selectors.py", line 118, in __await__
    result = yield self
pants.base.exceptions.BuildConfigurationError: Version mismatch: Requested version was 2.16.0rc3, our version is 2.16.0rc2.

Traceback (most recent call last):
  File "/Users/nick.dellosa/Projects/data-platform/dist/export/python/virtualenvs/pants-plugins/3.9.16/lib/python3.9/site-packages/pants/bin/daemon_pants_runner.py", line 130, in single_daemonized_run
    scheduler, options_initializer = self._core.prepare(options_bootstrapper, complete_env)
  File "/Users/nick.dellosa/Projects/data-platform/dist/export/python/virtualenvs/pants-plugins/3.9.16/lib/python3.9/site-packages/pants/pantsd/pants_daemon_core.py", line 130, in prepare
    build_config = self._options_initializer.build_config(options_bootstrapper, env)
  File "/Users/nick.dellosa/Projects/data-platform/dist/export/python/virtualenvs/pants-plugins/3.9.16/lib/python3.9/site-packages/pants/init/options_initializer.py", line 111, in build_config
    return _initialize_build_configuration(self._plugin_resolver, options_bootstrapper, env)
  File "/Users/nick.dellosa/Projects/data-platform/dist/export/python/virtualenvs/pants-plugins/3.9.16/lib/python3.9/site-packages/pants/init/options_initializer.py", line 48, in _initialize_build_configuration
    working_set = plugin_resolver.resolve(options_bootstrapper, env)
  File "/Users/nick.dellosa/Projects/data-platform/dist/export/python/virtualenvs/pants-plugins/3.9.16/lib/python3.9/site-packages/pants/init/plugin_resolver.py", line 137, in resolve
    for resolved_plugin_location in self._resolve_plugins(
  File "/Users/nick.dellosa/Projects/data-platform/dist/export/python/virtualenvs/pants-plugins/3.9.16/lib/python3.9/site-packages/pants/init/plugin_resolver.py", line 161, in _resolve_plugins
    params = Params(request, determine_bootstrap_environment(session))
  File "/Users/nick.dellosa/Projects/data-platform/dist/export/python/virtualenvs/pants-plugins/3.9.16/lib/python3.9/site-packages/pants/core/util_rules/environments.py", line 443, in determine_bootstrap_environment
    session.product_request(ChosenLocalEnvironmentName, [Params()])[0],
  File "/Users/nick.dellosa/Projects/data-platform/dist/export/python/virtualenvs/pants-plugins/3.9.16/lib/python3.9/site-packages/pants/engine/internals/scheduler.py", line 569, in product_request
    return self.execute(request)
  File "/Users/nick.dellosa/Projects/data-platform/dist/export/python/virtualenvs/pants-plugins/3.9.16/lib/python3.9/site-packages/pants/engine/internals/scheduler.py", line 513, in execute
    self._raise_on_error([t for _, t in throws])
  File "/Users/nick.dellosa/Projects/data-platform/dist/export/python/virtualenvs/pants-plugins/3.9.16/lib/python3.9/site-packages/pants/engine/internals/scheduler.py", line 497, in _raise_on_error
    raise ExecutionError(
pants.engine.internals.scheduler.ExecutionError: 1 Exception encountered:

Engine traceback:
  in select
    ..
  in pants.core.util_rules.environments.determine_local_environment
    ..
  in pants.core.util_rules.environments.determine_all_environments
    ..
  in construct_scope_environments_preview
    ..

Traceback (most recent call last):
  File "/Users/nick.dellosa/Projects/data-platform/dist/export/python/virtualenvs/pants-plugins/3.9.16/lib/python3.9/site-packages/pants/engine/internals/selectors.py", line 623, in native_engine_generator_send
    res = rule.send(arg) if err is None else rule.throw(throw or err)
  File "/Users/nick.dellosa/Projects/data-platform/dist/export/python/virtualenvs/pants-plugins/3.9.16/lib/python3.9/site-packages/pants/option/subsystem.py", line 311, in _construct_subsytem
    scoped_options = await Get(ScopedOptions, Scope(str(subsystem_typ.options_scope)))
  File "/Users/nick.dellosa/Projects/data-platform/dist/export/python/virtualenvs/pants-plugins/3.9.16/lib/python3.9/site-packages/pants/engine/internals/selectors.py", line 118, in __await__
    result = yield self
pants.base.exceptions.BuildConfigurationError: Version mismatch: Requested version was 2.16.0rc3, our version is 2.16.0rc2.




See <https://www.pantsbuild.org/v2.16/docs/troubleshooting> for common issues.
Consider reaching out for help: <https://www.pantsbuild.org/v2.16/docs/getting-help>
h
Whoa
The VERSION in the whl file is right AFAICT
You upgraded by editing
version
in your
pants.toml
, the usual way?
And are you using the
pants
launcher binary?
r
Yes to the first one, unsure on the last one
I upgraded the pants cask with brew - I'm assuming that's the launcher binary - but the issue persists.
h
When you run Pants, is it via
pants
(the new launcher binary) or
./pants
(the old launcher script)?
r
the former
h
Great, so that is the new launcher
I couldn't reproduce this
hmmm
Just throwing stuff at the wall now, but try killing
pantsd
(via
pkill -f pantsd
for example)
r
oh I just figured it out - this only occurs when I have a virtualenv activated
specifically, a virtualenv that was created with the previous version of pants
h
Oh, you should never do that
Pants isn't intended to be installed in a virtualenv
(well, unless you're developing a Pants plugin, in which case pantsbuild.pants is a dependency of your code, but you never execute pants from this virtualenv)
r
Yeah, I had a virtualenv I exported activated and didn't realize that was interfering
h
Now back to the lockfile update 🙂
😅 1