I ran on Mac M1, and it worked before :confused: B...
# general
e
I ran on Mac M1, and it worked before 😕 But I don’t know why now it can’t find setuptools. does this ring a bell to someone ?
e
It does not. What version of Pants is this? Can you narrow down
./pants test ::
to
./pants test some/specific/file.py
? The latter will help dig out a repro based on the specific problem file's dependencies.
âž• 1
e
I got this error because I tried to install setuptools with my python 😕 I’ve unsintalled it and it works now.
But now I have this error :
Copy code
==================================== ERRORS ====================================
_ ERROR collecting src/python/entrypoints/django_workera_profile/django_workera_profile/tests/test_api_goals.py _
ImportError while importing test module '/private/var/folders/97/y0tt83rx2cl6g0mktbfj4m3w0000gn/T/process-executionXeZnlt/src/python/entrypoints/django_workera_profile/django_workera_profile/tests/test_api_goals.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/Users/arth/.cache/pants/named_caches/pex_root/venvs/s/ed4b5ccc/venv/lib/python3.8/site-packages/_pytest/python.py:578: in _importtestmodule
    mod = import_path(self.fspath, mode=importmode)
/Users/arth/.cache/pants/named_caches/pex_root/venvs/s/ed4b5ccc/venv/lib/python3.8/site-packages/_pytest/pathlib.py:524: in import_path
    importlib.import_module(module_name)
/Users/arth/.pyenv/versions/3.8.10/lib/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1014: in _gcd_import
    ???
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:975: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:671: in _load_unlocked
    ???
/Users/arth/.cache/pants/named_caches/pex_root/venvs/s/ed4b5ccc/venv/lib/python3.8/site-packages/_pytest/assertion/rewrite.py:170: in exec_module
    exec(co, module.__dict__)
src/python/entrypoints/django_workera_profile/django_workera_profile/tests/test_api_goals.py:1: in <module>
    from django_workera_profile.api import api
src/python/entrypoints/django_workera_profile/django_workera_profile/api/__init__.py:2: in <module>
    from django_workera_shared.api.bootstrap import build_ninja_api_instance
src/python/entrypoints/django_workera_shared/django_workera_shared/api/bootstrap.py:10: in <module>
    from rest_framework_simplejwt.authentication import JWTAuthentication
/Users/arth/.cache/pants/named_caches/pex_root/venvs/s/ed4b5ccc/venv/lib/python3.8/site-packages/rest_framework_simplejwt/__init__.py:1: in <module>
    from pkg_resources import DistributionNotFound, get_distribution
E   ModuleNotFoundError: No module named 'pkg_resources'
- generated xml file: /private/var/folders/97/y0tt83rx2cl6g0mktbfj4m3w0000gn/T/process-executionXeZnlt/src.python.entrypoints.django_workera_profile.django_workera_profile.tests.test_api_goals.py.xml -
=========================== short test summary info ============================
ERROR src/python/entrypoints/django_workera_profile/django_workera_profile/tests/test_api_goals.py
!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
=============================== 1 error in 0.18s ===============================
By the way I run with pants 2.8.1rc1
e
@echoing-london-29138 what does
pants roots
report?
e
It gives me that :
Copy code
src/python
src/python/core/workera_enrollments
src/python/core/workera_goal_catalog
src/python/core/workera_item_bank
src/python/core/workera_profile
src/python/core/workera_shared
src/python/entrypoints/django_workera_profile
src/python/entrypoints/django_workera_shared
src/python/third_party
src/python/utils
The error is weird because it can find a package depending on third party
e
Oops - missed the critical line:
Copy code
/Users/arth/.cache/pants/named_caches/pex_root/venvs/s/ed4b5ccc/venv/lib/python3.8/site-packages/rest_framework_simplejwt/__init__.py:1: in <module>
    from pkg_resources import DistributionNotFound, get_distribution
E   ModuleNotFoundError: No module named 'pkg_resources'
What version of https://pypi.org/project/djangorestframework-simplejwt/ is this?
The issue, on master at least is they actually have a dependency on setuptools (which is what contains pkg_resources): https://github.com/jazzband/djangorestframework-simplejwt/blob/master/rest_framework_simplejwt/__init__.py#L1 but they do not declare that dependency: https://github.com/jazzband/djangorestframework-simplejwt/blob/master/setup.py#L54-L58 So there are 2 things to do: 1. Report a bug to them and maybe fix it too! 2. Work around the bug in Pants as shown here: https://www.pantsbuild.org/docs/python-third-party-dependencies#requirements-with-undeclared-dependencies
e
@enough-analyst-54434 Thanks a lot 🙂