tiangolo / full-stack-fastapi-template

Full stack, modern web application template. Using FastAPI, React, SQLModel, PostgreSQL, Docker, GitHub Actions, automatic HTTPS and more.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Running task 1 of 1: python .copier/update_dotenv.py /bin/sh: 1: python: not found

semiprogarlic opened this issue · comments

I have python3 installed and have configured an alias python="python3" in my .bash_aliases file, so both python and python3 cmdlets are available.

DESKTOP-0U5S399:~$ python --version
Python 3.8.10

DESKTOP-0U5S399:~$ python3 --version
Python 3.8.10

However, copier is unable to find the python module in /bin/sh. Can we update the copier.yml file to use python3 .copier/update_dotenv.py instead of python .copier/update_dotenv.py?

> Running task 1 of 1: python .copier/update_dotenv.py /bin/sh: 1: python: not found Traceback (most recent call last): File "/home/dathuku/.local/bin/copier", line 8, in <module> sys.exit(copier_app_run()) File "/home/dathuku/.local/lib/python3.8/site-packages/plumbum/cli/application.py", line 638, in run inst, retcode = subapp.run(argv, exit=False) File "/home/dathuku/.local/lib/python3.8/site-packages/plumbum/cli/application.py", line 633, in run retcode = inst.main(*tailargs) File "/home/dathuku/.local/lib/python3.8/site-packages/decorator.py", line 232, in fun return caller(func, *(extras + args), **kw) File "/home/dathuku/.local/lib/python3.8/site-packages/copier/cli.py", line 71, in handle_exceptions return method(*args, **kwargs) File "/home/dathuku/.local/lib/python3.8/site-packages/copier/cli.py", line 270, in main worker.run_copy() File "/home/dathuku/.local/lib/python3.8/site-packages/copier/main.py", line 205, in __exit__ raise value File "/home/dathuku/.local/lib/python3.8/site-packages/copier/cli.py", line 270, in main worker.run_copy() File "/home/dathuku/.local/lib/python3.8/site-packages/copier/main.py", line 759, in run_copy self._execute_tasks(self.template.tasks) File "/home/dathuku/.local/lib/python3.8/site-packages/copier/main.py", line 284, in _execute_tasks subprocess.run(task_cmd, shell=use_shell, check=True, env=local.env) File "/usr/lib/python3.8/subprocess.py", line 516, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command 'python .copier/update_dotenv.py' returned non-zero exit status 127

Same Issue with My Window WSL

  > Running task 1 of 1: python .copier/update_dotenv.py
/bin/sh: 1: python: not found
Traceback (most recent call last):
  File "/home/username/.local/bin/copier", line 8, in <module>
    sys.exit(copier_app_run())
  File "/home/username/.local/lib/python3.10/site-packages/plumbum/cli/application.py", line 638, in run
    inst, retcode = subapp.run(argv, exit=False)
  File "/home/username/.local/lib/python3.10/site-packages/plumbum/cli/application.py", line 633, in run
    retcode = inst.main(*tailargs)
  File "/home/username/.local/lib/python3.10/site-packages/decorator.py", line 232, in fun
    return caller(func, *(extras + args), **kw)
  File "/home/username/.local/lib/python3.10/site-packages/copier/cli.py", line 71, in handle_exceptions
    return method(*args, **kwargs)
  File "/home/username/.local/lib/python3.10/site-packages/copier/cli.py", line 263, in main
    with self._worker(
  File "/home/username/.local/lib/python3.10/site-packages/copier/main.py", line 205, in __exit__
    raise value
  File "/home/username/.local/lib/python3.10/site-packages/copier/cli.py", line 270, in main
    worker.run_copy()
  File "/home/username/.local/lib/python3.10/site-packages/copier/main.py", line 759, in run_copy
    self._execute_tasks(self.template.tasks)
  File "/home/username/.local/lib/python3.10/site-packages/copier/main.py", line 284, in _execute_tasks
    subprocess.run(task_cmd, shell=use_shell, check=True, env=local.env)
  File "/usr/lib/python3.10/subprocess.py", line 526, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command 'python .copier/update_dotenv.py' returned non-zero exit status 127.

I got the same Issue with both my armbian and debian12.
I have set alias python="python3" in ~/.bashrc file, but it didn't work.
Maybe it's not a project issue, but a Python issue.
Finally, I tried apt install python-is-python3, and then it worked

Thanks @frank2016ma that actually solves the issue

It's highly advisable you use virtual environments. It'll not only solve said problem, but it'll also save you the headaches that will arise from dependency management, such as conflicting global package installations.

This issue can now be closed in my opinion.