stale-twilight-79248
12/16/2025, 5:26 PMssh-python which isn't inferred). I've manually added the dependency to the test, and when I run pants dependencies --transitive <my-test.py> i can see the package listed in the output, but when i run pants test <my-test.py> the test fails with a ModuleNotFoundError: No module named 'ssh.channel'
oddly enough, if i export my pants resolve to a venv and run pytest within it, the same test succeeds.
I suspect what's happening here is that another transitive dependency in my closure is exposing a ssh package which doesn't include a ssh.channel module, and during export of the venv, the correct ssh package including ssh.channel is overwriting the incorrect ssh package.
I also suspect that the reason ssh-python isn't being inferred is because pants is identifying this other theoretical ssh-exposing package as a dependency instead of ssh-python
My question is: how to i get pants to tell me which python import symbols map to which dependencies/targets?thankful-stone-5860
12/16/2025, 5:38 PMssh, or is it another inferred third-party dependency?stale-twilight-79248
12/16/2025, 5:46 PMimport ssh and run pants dependencies --transitive <my-file.py> but this has led to an even bigger mystery: the output is blank!
according to pants, this file which imports ssh has no dependencies!?stale-twilight-79248
12/16/2025, 5:51 PMpython_source target. once i added a target for it and re-ran the pants dependencies command, i got
12:49:47.13 [WARN] Pants cannot infer owners for the following imports in the target src:abc:
* ssh (line: 1)
If you do not expect an import to be inferable, add `# pants: no-infer-dep` to the import line. Otherwise, see <https://www.pantsbuild.org/2.29/docs/using-pants/troubleshooting-common-issues#import-errors-and-missing-dependencies> for common problems.stale-twilight-79248
12/16/2025, 5:51 PMstale-twilight-79248
12/16/2025, 6:01 PMssh-python: ['ssh'] to the module_mappings of my 3rdparty requirements target, and the ssh inference error from before is now gone. I can run my temp python file and it's able to import ssh.channel from the ssh-python package, but my regression test from above is still failing. i don't understand what's going on here.
Can anyone give me any ideas for how to troubleshoot this?thankful-stone-5860
12/17/2025, 8:37 PMbrief-scientist-13682
12/17/2025, 9:20 PMI suspect what's happening here is that another transitive dependency in my closure is exposing aWhy surmise? How about just https://www.pantsbuild.org/2.29/docs/using-pants/troubleshooting-common-issues#debug-tip-inspect-the-sandbox-with---keep-sandboxes and actually look in the venv and see what's in there?package which doesn't include asshmodule, and during export of the venv, the correctssh.channelpackage includingsshis overwriting the incorrectssh.channelpackage.ssh
stale-twilight-79248
12/18/2025, 9:48 PM__run.sh script, i get the ssh.channel import error, but if i directly run <sandbox dir>/.cache/pex_root/venvs/1/<hash>/<other hash>/bin/python, I'm able to import ssh.channel without error...stale-twilight-79248
12/18/2025, 9:50 PMpants test src/uoft/core/tests/regression_tests.pystale-twilight-79248
12/18/2025, 10:22 PMssh in my repo. I don't, but i do have a src root containing a pep420-namespace uoft with a uoft.ssh package in it. while in pdb, if i import and look at sys.path, the very first entry is '/tmp/pants-sandbox-CMZ3Nd/src/uoft'stale-twilight-79248
12/18/2025, 10:24 PMuoft.ssh package as a ssh package and importing that.
What i can't figure out is what the heck that path is doing there... it's not a source root, and i have no code in my codebase doing any kind of silly sys.path manipulation...brief-scientist-13682
12/18/2025, 11:14 PM:; pants test src/uoft/core/tests/regression_tests.py
...
=========================== short test summary info ============================
FAILED src/uoft/core/tests/regression_tests.py::test_module_imports - ModuleNotFoundError: No module named 'ssh.channel'
======================== 1 failed, 2 warnings in 0.67s =========================
So, just touch src/uoft/__init__.py and:
:; pants test src/uoft/core/tests/regression_tests.py
...
=========================== short test summary info ============================
FAILED src/uoft/core/tests/regression_tests.py::test_module_imports - ModuleNotFoundError: No module named 'uoft.scripts.stg_ipam_dev.__main__'
========================= 1 failed, 1 warning in 0.75s =========================
And, FWICT that is a legitimate error pointing out a stale test.stale-twilight-79248
12/19/2025, 3:26 PMstale-twilight-79248
12/19/2025, 3:26 PM