Was trying to get together the code for a potentia...
# general
Was trying to get together the code for a potential
WSDL -> Java
codegen backend and I’m getting an import error when doing
./pants test src/python/pants/backend/codegen/soap::
on a fresh pull of the
repo (well, in fact it happens when I try running any Python test using the
script). The error looks like the following:
Copy code
_ ERROR collecting src/python/pants/backend/codegen/soap/target_types_test.py __
ImportError while importing test module '/private/var/folders/c9/5v4gbjh17w9_vy73fc90fnch0000gn/T/process-executionF88I01/src/python/pants/backend/codegen/soap/target_types_test.py'.
Hint: make sure your test modules/packages have valid Python names.
/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
src/python/pants/backend/codegen/soap/target_types_test.py:9: in <module>
    from pants.backend.codegen.soap import target_types
src/python/pants/backend/codegen/soap/target_types.py:4: in <module>
    from pants.engine.rules import collect_rules, rule
src/python/pants/engine/rules.py:28: in <module>
    from pants.engine.engine_aware import SideEffecting
src/python/pants/engine/engine_aware.py:9: in <module>
    from pants.engine.internals import native_engine
E   ImportError: dlopen(/private/var/folders/c9/5v4gbjh17w9_vy73fc90fnch0000gn/T/process-executionF88I01/src/python/pants/engine/internals/native_engine.so, 0x0002): symbol not found in flat namespace '_PyObject_VectorcallMethod'
I did a
./cargo build
./cargo test
separately and those commands succeed … does any of know what I may be missing that causes that error?
Hi, No idea. A hunch I’m getting is if it could be related to
files missing, or some such, maybe.. do you see the same issue on a clean checkout from
as well?
yeah, that’s the odd thing, it happens in all packages…
I’d try a clean checkout, and wiping
in case there’s some flunky data in there.. That will start you over from scratch. (N.b. that if you have any pantsd processes running, you need to kill them too..)
(in lack of better suggestions/troubleshooting tips)
unfortunately it still happens …
processes, removed
folders, wiped cache at
and fresh cloned the repo again, then just run
./pants test src/python::
in the
branch and got the same errors
I believe that I had this working at some point and I’m looking at the GH workflow to see if I’m missing any setup step… but it doesn’t seem to be the case …
anyway, thanks for the help 😅
I think this may be because you're using the MacOS system python, which is known to have all sorts of quirks and flaws
I recommend installing an interpreter using
And making sure that is on your PATH ahead of the system interpreter
Worth a try anyway
👍 1
pants seems to still prefer using my system-wide Python instead of the one installed by pyenv, even though the latter is before is in the
is there a way I can tell pants to prefer my pyenv setup? some sort of
file or similar I could drop in my $HOME?
Or just to verify that this solves things, try
That will tell Pants to not even try to use interpreters from PATH and instead only use pyenv interpreters
that works! I’ll drop that setting in a ~/.pants.rc file. Many thanks! 🙂
💯 1