https://pantsbuild.org/ logo
#general
Title
# general
s

swift-river-73520

03/22/2023, 6:18 PM
Hi there, I'm just getting started with splitting up a single-project monorepo into multiple projects, which each subproject defining its requirements using a
pyproject.toml
file & the
poetry_requirements
target. Right now I'm just trying to get tests to run (via
pants test src/python/subproject1::
) for one of the subprojects, but I'm getting the following error on an import from a third-party library (
dropbox
, but I think this is likely to happen with a number of third-party dependencies):
Copy code
ModuleNotFoundError: No module named 'pkg_resources'
I see this resolved issue in the pantsbuild github which seems very similar, but specific to gunicorn. I tried adding
setuptools
to the pyproject.toml file for the subproject and re-ran
generate_lockfiles
before trying the tests again but didn't notice any change. I also tried adding
Copy code
python_sources(
    dependencies=["3rdparty/python#setuptools"]
)
to the BUILD file for the
subproject1
folder (not sure this even makes sense), and also didn't see any changes. Would anyone be able to point me in the right direction?
1
I also tried installing / updating
setuptools
in the base interpreter that seems to be getting used by Pants (some other stackoverflow threads suggested this), to no avail
r

refined-addition-53644

03/22/2023, 6:26 PM
You need to override dependencies for dropbox. For example
Copy code
poetry_requirements(
    name="reqs",
    overrides={
        "dropbox": {"dependencies": [":reqs#setuptools"]},
    },
)
https://www.pantsbuild.org/docs/python-third-party-dependencies#requirements-with-undeclared-dependencies
❤️ 1
s

swift-river-73520

03/22/2023, 6:26 PM
ah cool, I was just stumbling into that!
f

future-dream-25165

10/26/2023, 1:35 PM
I'm still stuck on this issue 😞 we're on v2,12 of pants due to a plugin constraint currently. Have come across this trying to add some new tests and I think the error is due to
pulumi-aws
module. I've added the overrides for
setuptools
as per above but when I add to the
requirements.txt
then generating the lockfiles seems to take forever and not end. Any thoughts?
c

curved-television-6568

10/26/2023, 3:11 PM
there’re plenty of threads about troubleshooting lockfile generation taking a long time. it usually involves getting into the lockfile generation sandbox, and running with
PEX_VERBOSE=9
and looking at the pip logs.
f

future-dream-25165

10/26/2023, 3:54 PM
thanks I'll take a look!