How can I debug a python requirement that should b...
# general
w
How can I debug a python requirement that should be inferred but isnt? For example:
Copy code
$ ./pants --no-pantsd dependencies integrate_ai_sdk/src/integrate_ai_sdk/base_class.py
09:49:13.34 [WARN] Pants cannot infer owners for the following imports in the target integrate_ai_sdk/src/integrate_ai_sdk/base_class.py:

  * opacus.validators.ModuleValidator (line: 17)
  * torch (line: 13)
  * torch.nn.Module (line: 14)
  * torch.utils.data.Dataset (line: 15)

If you do not expect an import to be inferrable, add `# pants: no-infer-dep` to the import line. Otherwise, see <https://www.pantsbuild.org/v2.14/docs/troubleshooting#import-errors-and-missing-dependencies> for common problems.
integrate_ai_sdk/setup_requirements.txt:reqs
integrate_ai_sdk/src/integrate_ai_sdk/exception.py
integrate_ai_sdk/src/integrate_ai_sdk/utils/class_util.py
integrate_ai_sdk/src/integrate_ai_sdk/utils/util.py
integrate_ai_sdk:reqs#boto3
integrate_ai_sdk:reqs#clkhash
integrate_ai_sdk:reqs#matplotlib
integrate_ai_sdk:reqs#numpy
integrate_ai_sdk:reqs#opacus
integrate_ai_sdk:reqs#pandas
integrate_ai_sdk:reqs#pillow
integrate_ai_sdk:reqs#pyarrow
integrate_ai_sdk:reqs#pyjwt
integrate_ai_sdk:reqs#pytorch-ignite
integrate_ai_sdk:reqs#s3fs
integrate_ai_sdk:reqs#scikit-learn
integrate_ai_sdk:reqs#setuptools
integrate_ai_sdk:reqs#smart-open
integrate_ai_sdk:reqs#torch
integrate_ai_sdk:reqs#torchvision
integrate_ai_sdk:reqs#wheel
note that
torch
and
opacus
are in the dependencies list. Its probably a module mapping thing, but i’m not sure how to determine the key, since in requirements it’s listed as
torch
and
opacus
as well.
h
Yeah, Pants should be able to map those without anything special in the module mappings, since the name of the dist is the same as its top-level import package. So that's odd.
c
are there any resolves involved?
c
Cross link in-case it has a clue with platform-y/arch stuff: https://github.com/pantsbuild/pants/issues/18293
w
No resolves - I’m deferring the pants locking mechanism to get things working with our existing poetry/pipenv lock files first.
Things are working - just the warnings are noisy.
@curved-manchester-66006 thanks that does seem possibly related, but can’t really tell.
e
@wonderful-boots-93625 just to ask the obvious - you don't have your own 1st party
opacus
or
torch
module or package do you?
And the only other ~obvious thing - do you have other requirements files in the repo that have
opacus
or
torch
requirements listed? It might be good to share the contents of the
BUILD
owning
integrate_ai_sdk/src/integrate_ai_sdk/base_class.py
.
w
Thanks will share soon
No first party opacus or torch