It never ends... Now I'm getting `ImportError: /tm...
# development
It never ends... Now I'm getting
ImportError: /tmp/pants-sandbox-577g1M/src/python/pants/engine/internals/ undefined symbol: PyObject_VectorcallMethod
in a test, on linux.
Full stack trace:
Copy code
____________________________________________________________________________ ERROR collecting src/python/pants/option/ ____________________________________________________________________________
ImportError while importing test module '/tmp/pants-sandbox-577g1M/src/python/pants/option/'.
Hint: make sure your test modules/packages have valid Python names.
/data/home/benjy/.pyenv/versions/3.7.13/lib/python3.7/importlib/ in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
src/python/pants/option/ in <module>
    from pants.base.build_environment import get_buildroot
src/python/pants/base/ in <module>
    from pants.engine.internals import native_engine
E   ImportError: /tmp/pants-sandbox-577g1M/src/python/pants/engine/internals/ undefined symbol: PyObject_VectorcallMethod
So this is happening at test collection time, due to some file importing the native_engine
This works on other machines, including both macos and another linux machine
is installed and up to date on this machine
Ironically the test doesn't actually care about that native_engine import, it just happens to be imported by for use by some other function
But nonetheless this is weird
I can reproduce outside of the test, in a repl:
Copy code
$ ./pants repl src/python/pants/base/
>>> from pants.base.build_environment import get_buildroot
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/tmp/pants-sandbox-VjVHcE/src/python/pants/base/", line 11, in <module>
    from pants.engine.internals import native_engine
ImportError: /tmp/pants-sandbox-VjVHcE/src/python/pants/engine/internals/ undefined symbol: PyObject_VectorcallMethod
Or even
./pants run src/python/pants/base/
So the 1st backtrace is running under 3.7.13 - expected?
IE is the for 3.7?
So the is definitely 3.9
So, that's the proximal issue.
Fortunately this doesn't hit users, this is a pants-running-pants thing
I assume anyway
will dig for the root cause
objdump is helpful
Yeah, should be a pants-running-pants thing.
Yep, Pants runs on 3.9 with a 3.9 engine, selects 3.7 at runtime, that code copies the outer pants' engine into the sandbox and boom