stale-nightfall-29801
11/12/2021, 4:21 PMNo module named 'pkg_resources'
error when I include mongomock
in my thirdparty/python_test/requirements.txt
and depending on it from another BUILD file like so:
python_tests(
name="tests",
sources = ["test/test_*.py", "test/conftest.py"],
dependencies=[":fixtures", "thirdparty/python:pymongo", "thirdparty/python_test:mongomock"]
)
The usual fix for this error from what I can see is updating setuptools... But I'm not having this error outside of Pants/Pex so not sure how to fix this in Pants. Any ideas?enough-analyst-54434
11/12/2021, 4:42 PMinstall_requires
. You get away with this outside of Pants beacuse either by default, or by sheer dint of its popularity / use by other distributions you installed in your venv, you happen to have setuptools already.enough-analyst-54434
11/12/2021, 4:42 PMenough-analyst-54434
11/12/2021, 4:42 PMstale-nightfall-29801
11/12/2021, 4:45 PMenough-analyst-54434
11/12/2021, 4:46 PMenough-analyst-54434
11/12/2021, 4:47 PMstale-nightfall-29801
11/12/2021, 4:48 PMenough-analyst-54434
11/12/2021, 4:49 PMstale-nightfall-29801
11/12/2021, 4:49 PMenough-analyst-54434
11/12/2021, 4:53 PMpython_requirement_library(
name="mongomock",
requirements=["mongomock", "setuptools"],
)
If you slready had a version of setuptools defined in the requirements file, you'd instead do the following for 2.:
python_requirement_library(
name="mongomock",
requirements=["mongomock"],
dependencies=[":setuptools"]
)
hundreds-father-404
11/12/2021, 4:54 PMsetuptools
to your requirements.txt
2. Update python_requirements
to this
python_requirements(
overrides={"mongomock": {"dependencies": ":setuptools"}},
)
I personally like this approach because you get to still have all your deps in requirements.txt
like beforeenough-analyst-54434
11/12/2021, 4:59 PMenough-analyst-54434
11/12/2021, 5:00 PMstale-nightfall-29801
11/12/2021, 5:02 PMhundreds-father-404
11/12/2021, 7:16 PMhundreds-father-404
11/12/2021, 7:17 PMstale-nightfall-29801
11/15/2021, 9:26 AMstale-nightfall-29801
11/15/2021, 12:06 PMpython_distribution
I've not got time to read up on right now.