I’ve been trying to build and run karrot-backend to debug the program in an IDE. Installing the prerequisites and following the steps in this README works for me until I run ./sync.py; during the “★ Installing python dependencies” step, this error stops execution:
Traceback (most recent call last):
File “/home/char/karrot/karrot-backend/./sync.py”, line 45, in
subprocess.run([“pip-sync”, “requirements.txt”], env=environ, check=True)
File “/usr/lib/python3.11/subprocess.py”, line 548, in run
with Popen(*popenargs, **kwargs) as process:
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3.11/subprocess.py”, line 1026, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File “/usr/lib/python3.11/subprocess.py”, line 1950, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'pip-s
Is there any dependencies not listed in the README, or does the above error suggest I didn’t install a dependency listed in the README?
Hmm, you have your virtualenv activated? And pip is available? (pointing to somewhere in your venv?).
It should have installed pip-tools (which provides pip-sync) when it ran this step:
if "piptools" not in [m.name for m in pkgutil.iter_modules()]:
header("Installing pip-tools")
subprocess.run(["pip", "install", "pip-tools"], env=environ, check=True)
I didn’t have pip installed it looks like; I reinstalled the virtualenv after installing python-is-python3 and pip, and the ./sync.py command works now. Thanks for the easy solution, not sure how I missed that.
I’m not sure if I should start another thread for this since it’s not related much to my original question, but how do you all step-debug karrot-backend (from the entry point) in an IDE since the server is started with a bash script?
Great that worked! I guess we could add an instruction to make sure pip is installed, I sort of assume it comes with python, but I think that’s not always the case.
I suspect it would be best to run the app directly from your IDE, so it can add whatever debugging options it wants, and you can exclude running the app from the script (but still run everything else):
./scripts/dev - runs everything ./scripts/dev db - runs only the db ./scripts/dev huey mjml redis db maildev pgweb - runs everything except “web”
Then you need to run ./manage.py runserver in your IDE debugger, however that works.
(you can check scripts/Procfile to see if these different things that ./scripts/dev runs… in your case it would be more convenient to have a syntax like ./scripts/dev -web or something to say “run everything except web”, but that doesn’t exist).
I use lowly print statements for my debugging needs so haven’t encountered this need so far, but would be happy to accept any modifications that make it work better with an IDE debugger.