s3rius / FastAPI-template

Feature rich robust FastAPI template.
MIT License
1.83k stars 161 forks source link

generate template error: Stopping generation because post_gen_project hook script didn't exit successfully #134

Closed liqiujiong closed 1 year ago

liqiujiong commented 1 year ago

Image

image

Error Info

E:\Code>fastapi_template Project name: fastapi_template_test Project description: Removing resources for disabled feature GraphQL API... Removing resources for disabled feature Kafka support... Removing resources for disabled feature Kubernetes... Removing resources for disabled feature Migrations... Removing resources for disabled feature Gitlab CI... Removing resources for disabled feature Dummy model... Removing resources for disabled feature Self-hosted swagger... Removing resources for disabled feature Tortoise ORM... Removing resources for disabled feature Ormar ORM... Removing resources for disabled feature PsycoPG... Removing resources for disabled feature Piccolo... Removing resources for disabled feature Postgresql DB... Removing resources for disabled feature Opentelemetry support... Removing resources for disabled feature SQLite DB... cleanup complete! ⭐ Placing resources nicely in your new project ⭐ Resources are happy to be where they are needed the most. Git repository initialized. warning: in the working copy of 'fastapi_template_test/static/docs/redoc.standalone.js', LF will be replaced by CRLF the next time Git touches it warning: in the working copy of 'fastapi_template_test/static/docs/swagger-ui-bundle.js', LF will be replaced by CRLF the next time Git touches it warning: in the working copy of 'fastapi_template_test/static/docs/swagger-ui.css', LF will be replaced by CRLF the next time Git touches it Added files to index. Traceback (most recent call last): File "C:\Users\pc\AppData\Local\Temp\tmpo5ko_okk.py", line 74, in <module> init_repo() File "C:\Users\pc\AppData\Local\Temp\tmpo5ko_okk.py", line 64, in init_repo subprocess.run(["poetry", "install", "-n"]) File "C:\Python311\Lib\subprocess.py", line 546, in run with Popen(*popenargs, **kwargs) as process: ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python311\Lib\subprocess.py", line 1022, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "C:\Python311\Lib\subprocess.py", line 1491, in _execute_child hp, ht, pid, tid = _winapi.CreateProcess(executable, args, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FileNotFoundError: [WinError 2] 系统找不到指定的文件。 Stopping generation because post_gen_project hook script didn't exit successfully

Context Info

Python: 3.11.0 (main, Oct 24 2022, 18:26:48) [MSC v.1933 64 bit (AMD64)] on win32 Pip Package: `C:\Users\pc>pip list Package Version


arrow 1.2.3 binaryornot 0.4.4 certifi 2022.9.24 cfgv 3.3.1 chardet 5.0.0 charset-normalizer 2.1.1 click 8.1.3 colorama 0.4.6 cookiecutter 1.7.3 distlib 0.3.6 fastapi-template 3.3.10 filelock 3.8.0 identify 2.5.8 idna 3.4 Jinja2 3.1.2 jinja2-time 0.2.0 MarkupSafe 2.1.1 nodeenv 1.7.0 pip 22.3 platformdirs 2.5.3 poyo 0.5.0 pre-commit 2.20.0 prompt-toolkit 3.0.32 pydantic 1.10.2 python-dateutil 2.8.2 python-slugify 6.1.2 PyYAML 6.0 requests 2.28.1 setuptools 65.5.0 six 1.16.0 termcolor 1.1.0 text-unidecode 1.3 toml 0.10.2 typing_extensions 4.4.0 urllib3 1.26.12 virtualenv 20.16.6 wcwidth 0.2.5`

s3rius commented 1 year ago

@liqiujiong Hi! It seems like you don't have poetry in your PATH. Check if you can run poetry from your command line.

liqiujiong commented 1 year ago

@liqiujiong Hi! It seems like you don't have poetry in your PATH. Check if you can run poetry from your command line.

Thank you. I installed poetry and was able to generate templates normally. But there are some anomalies in my network now, and I'm not sure if it has been affected.

E:\Code>fastapi_template
Project name: fastapi_template_test
Project description:
Removing resources for disabled feature GraphQL API...
Removing resources for disabled feature Kafka support...
Removing resources for disabled feature Kubernetes...
Removing resources for disabled feature Migrations...
Removing resources for disabled feature Gitlab CI...
Removing resources for disabled feature Github CI...
Removing resources for disabled feature Routers...
Removing resources for disabled feature Dummy model...
Removing resources for disabled feature Self-hosted swagger...
Removing resources for disabled feature Tortoise ORM...
Removing resources for disabled feature Ormar ORM...
Removing resources for disabled feature PsycoPG...
Removing resources for disabled feature Piccolo...
Removing resources for disabled feature Postgresql DB...
Removing resources for disabled feature Opentelemetry support...
Removing resources for disabled feature SQLite DB...
cleanup complete!
⭐ Placing resources nicely in your new project ⭐
Resources are happy to be where they are needed the most.
Git repository initialized.
warning: in the working copy of 'fastapi_template_test/static/docs/redoc.standalone.js', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'fastapi_template_test/static/docs/swagger-ui-bundle.js', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'fastapi_template_test/static/docs/swagger-ui.css', LF will be replaced by CRLF the next time Git touches it
Added files to index.
Updating dependencies
Resolving dependencies...

Writing lock file

Package operations: 83 installs, 1 update, 0 removals

  • Installing multidict (6.0.2)

  CalledProcessError

  Command 'C:\Users\pc\AppData\Local\pypoetry\Cache\virtualenvs\fastapi-template-test-zILJTmz6-py3.11\Scripts\python.exe -m pip install --use-pep517 --disable-pip-version-check --prefix C:\Users\pc\AppData\Local\pypoetry\Cache\virtualenvs\fastapi-template-test-zILJTmz6-py3.11 --no-deps C:\Users\pc\AppData\Local\pypoetry\Cache\artifacts\be\9c\5d\1397c5296e183f4b274c054f1dff0d7869c56acdab6218de9b9a89e09e\multidict-6.0.2.tar.gz' returned non-zero exit status 1.

  at C:\Python311\Lib\subprocess.py:569 in run
       565│             # We don't call process.wait() as .__exit__ does that for us.
       566│             raise
       567│         retcode = process.poll()
       568│         if check and retcode:
    →  569│             raise CalledProcessError(retcode, process.args,
       570│                                      output=stdout, stderr=stderr)
       571│     return CompletedProcess(process.args, retcode, stdout, stderr)
       572│
       573│

The following error occurred when trying to handle this error:

  EnvCommandError

  Command C:\Users\pc\AppData\Local\pypoetry\Cache\virtualenvs\fastapi-template-test-zILJTmz6-py3.11\Scripts\python.exe -m pip install --use-pep517 --disable-pip-version-check --prefix C:\Users\pc\AppData\Local\pypoetry\Cache\virtualenvs\fastapi-template-test-zILJTmz6-py3.11 --no-deps C:\Users\pc\AppData\Local\pypoetry\Cache\artifacts\be\9c\5d\1397c5296e183f4b274c054f1dff0d7869c56acdab6218de9b9a89e09e\multidict-6.0.2.tar.gz errored with the following return code 1, and output:
  Processing c:\users\pc\appdata\local\pypoetry\cache\artifacts\be\9c\5d\1397c5296e183f4b274c054f1dff0d7869c56acdab6218de9b9a89e09e\multidict-6.0.2.tar.gz
    Installing build dependencies: started
    Installing build dependencies: finished with status 'error'
    error: subprocess-exited-with-error

    pip subprocess to install build dependencies did not run successfully.
    exit code: 1

    [10 lines of output]
    WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x000002BA6256A650>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))': /simple/setuptools/
    WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x000002BA624A0510>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))': /simple/setuptools/
    WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x000002BA625D6F10>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))': /simple/setuptools/
    WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x000002BA5F26FA50>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))': /simple/setuptools/
    WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x000002BA625E2250>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))': /simple/setuptools/
    ERROR: Could not find a version that satisfies the requirement setuptools>=40 (from versions: none)
    ERROR: No matching distribution found for setuptools>=40

    [notice] A new release of pip available: 22.3 -> 22.3.1
    [notice] To update, run: python.exe -m pip install --upgrade pip
    [end of output]

    note: This error originates from a subprocess, and is likely not a problem with pip.
  error: subprocess-exited-with-error

  pip subprocess to install build dependencies did not run successfully.
  exit code: 1

  See above for output.

  note: This error originates from a subprocess, and is likely not a problem with pip.

  at ~\AppData\Roaming\pypoetry\venv\Lib\site-packages\poetry\utils\env.py:1476 in _run
      1472│                 output = subprocess.check_output(
      1473│                     command, stderr=subprocess.STDOUT, env=env, **kwargs
      1474│                 )
      1475│         except CalledProcessError as e:
    → 1476│             raise EnvCommandError(e, input=input_)
      1477│
      1478│         return decode(output)
      1479│
      1480│     def execute(self, bin: str, *args: str, **kwargs: Any) -> int:

The following error occurred when trying to handle this error:

  PoetryException

  Failed to install C:/Users/pc/AppData/Local/pypoetry/Cache/artifacts/be/9c/5d/1397c5296e183f4b274c054f1dff0d7869c56acdab6218de9b9a89e09e/multidict-6.0.2.tar.gz

  at ~\AppData\Roaming\pypoetry\venv\Lib\site-packages\poetry\utils\pip.py:51 in pip_install
       47│
       48│     try:
       49│         return environment.run_pip(*args)
       50│     except EnvCommandError as e:
    →  51│         raise PoetryException(f"Failed to install {path.as_posix()}") from e
       52│

pre-commit installed at .git\hooks\pre-commit
pre-commit installed.
[INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks.
An unexpected error has occurred: CalledProcessError: command: ('D:\\Program Files\\Git\\cmd\\git.EXE', 'fetch', 'origin', '--tags')
return code: 128
expected return code: 0
stdout: (none)
stderr:
    fatal: unable to access 'https://github.com/pre-commit/pre-commit-hooks/': Unsupported proxy syntax in '127.0.0.1:7890"'

Check the log at C:\Users\pc\.cache\pre-commit\pre-commit.log
warning: in the working copy of 'fastapi_template_test/static/docs/redoc.standalone.js', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'fastapi_template_test/static/docs/swagger-ui-bundle.js', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'fastapi_template_test/static/docs/swagger-ui.css', LF will be replaced by CRLF the next time Git touches it
[INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks.
An unexpected error has occurred: CalledProcessError: command: ('D:/Program Files/Git/mingw64/libexec/git-core\\git.EXE', 'fetch', 'origin', '--tags')
return code: 128
expected return code: 0
stdout: (none)
stderr:
    fatal: unable to access 'https://github.com/pre-commit/pre-commit-hooks/': Unsupported proxy syntax in '127.0.0.1:7890"'

Check the log at C:\Users\pc\.cache\pre-commit\pre-commit.log
Project successfully generated. You can read information about usage in README.md

E:\Code>
s3rius commented 1 year ago

That ok. It happens sometime. Maybe PyPi is under heavy load. Anyway, You can run commands from post-script by yourself.

poetry install
poetry run pre-commit install
poetry run pre-commit run -a
poetry run pre-commit run -a # We run it twice to check that previous run fixed everything.
git add .
git commit -m "Initial commit"