wide-zoo-86070
03/17/2022, 3:07 PMa.py
import x
import y
import z
......
......
when I do ./pants dependencies a.py
. I only see x
and y
, but not z
. Then I started to investigate more. First, If I do ./pants list :
, I do see //:z
, which suggests me that pants does know z
which is from requirements.txt
. Second, I add --no-process-execution-local-cleanup
flag to the ./pants dependencies
, then go to the cached folder. When I run __run.sh
in that folder, I do see z
in the output. It suggest me that z
should be treated as a dependency in a.py
. I am wondering why ./pants dependencies a.py
does not show z
. I took a look at https://www.pantsbuild.org/docs/troubleshooting#import-errors-and-missing-dependencies but i am not sure if any of them applies here.narrow-vegetable-37489
03/17/2022, 3:13 PMz
the same in requirements.txt as in the import? grpcio
, for example, you have to import as grpc
- so then a module_mapping
is needed for Pants to properly wire it into the dependency graph.wide-zoo-86070
03/17/2022, 3:13 PMhundreds-father-404
03/17/2022, 5:02 PM./pants dependencies --transitive
show that z is included, perhaps?hundreds-father-404
03/17/2022, 5:02 PMz
is defined by >1 python_requirement
target?wide-zoo-86070
03/17/2022, 8:05 PMwide-zoo-86070
03/17/2022, 9:07 PM./pants dependencies that-module.py
, will the new dependencies automatically shows up? or I have to something before it?hundreds-father-404
03/17/2022, 9:08 PMhundreds-father-404
03/17/2022, 9:09 PMwide-zoo-86070
03/22/2022, 5:22 PM./pants dependencies --type=3rdparty ::
. I can see other dependencies rather than z
. Note that z
is a new dependency just got added.hundreds-father-404
03/24/2022, 1:33 AM[GLOBAL].pantsd_invalidation_globs
wide-zoo-86070
03/24/2022, 3:55 AMhundreds-father-404
03/24/2022, 5:02 AM./pants list ::
?wide-zoo-86070
03/24/2022, 2:31 PMhundreds-father-404
03/24/2022, 4:45 PMwide-zoo-86070
03/24/2022, 5:39 PMcurved-electrician-64177
03/25/2022, 6:47 PMimport netCDF4
BUILD
python_tests(
name="tests",
dependencies=[
"//:root#netCDF4",
],
)
Let us know if helps to understand the bug better. Other dependencies were auto-detected as expected.hundreds-father-404
03/25/2022, 6:48 PMimport netcd4
for example?
2. Do you define netCD4
multiple times in your repository?curved-electrician-64177
03/25/2022, 6:49 PMhundreds-father-404
03/25/2022, 6:50 PMmodule_mapping
, but to double check, could you try adding module_mapping={'netCD4': ["netcd4"]}
to the python_requirements
target? Then remove the explicit dep for now and run ./pants dependencies
to see if it workedcurved-electrician-64177
03/25/2022, 6:56 PMpython_requirements(
name="root",
module_mapping={'netCDF4': ["netcdf4"]}
)
Some issue with case-sensitive module name?curved-electrician-64177
03/25/2022, 6:57 PMpython_requirements(
name="root",
module_mapping={'netcdf4': ["netCDF4"]}
)
hundreds-father-404
03/25/2022, 6:57 PMmodule_mapping
, but it's worth experimenting with! Note that you can list as many modules as you want also in that list
And to be crystal clear, no warning from Pants about ambiguous dependencies, right?curved-electrician-64177
03/25/2022, 6:58 PMhundreds-father-404
03/25/2022, 6:58 PMcurved-electrician-64177
03/25/2022, 6:58 PMAnd to be crystal clear, no warning from Pants about ambiguous dependencies, right?Have not seen any
hundreds-father-404
03/25/2022, 6:59 PMhundreds-father-404
03/25/2022, 6:59 PMimport netCD4
, not import netcd4
?curved-electrician-64177
03/25/2022, 7:00 PMimport netCDF4
hundreds-father-404
03/25/2022, 7:01 PMmodule_mapping={'netcd4': ['netCD4']},
should work and so should
module_mapping={'netCD4': ['netCD4']},
But you need the list to have the right capitilzation. Taht's intentionalhundreds-father-404
03/25/2022, 7:01 PMmodule_mapping
could be more clear with this? Wdyt?curved-electrician-64177
03/25/2022, 7:04 PMmodule_mapping={'netCD4': ['netCD4']},
map A to Ahundreds-father-404
03/25/2022, 7:27 PMDjango
, we assume the module is django
. Most of the time, that's the best default. Here, it is not