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

installation of poetry gives an error.

negmatov opened this issue · comments

Good afternoon. I wanted to ask about full-stack-fastapi-postgresql for several weeks now I can’t deploy, I went through several steps in windows 10 and docker is the latest version and stuck in the installation of poetry gives an error. (
Building backend
[+] Building 321.5s (7/11)
=> [internal] load build definition from backend.dockerfile 0.0s
=> => transferring dockerfile: 40B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/tiangolo/uvicorn-gunicorn-fastapi:python3.7 11.4s
=> [internal] load build context 0.1s
=> => transferring context: 4.37kB 0.1s
=> [1/7] FROM docker.io/tiangolo/uvicorn-gunicorn-fastapi:python3.7@sha256:f5770422a8875fe3d677e1bda724eeba332b53b0a348a9cdde854ba7136c66be 0.0s
=> CACHED [2/7] WORKDIR /app/ 0.0s
=> ERROR [3/7] RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | POETRY_HOME=/opt/poetry python && cd /usr/local/bin && ln -s /opt/poetry/bin/poetry && poetry config 309.9s

[3/7] RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | POETRY_HOME=/opt/poetry python && cd /usr/local/bin && ln -s /opt/poetry/bin/poetry && poetry config virtualenvs.crea
te false:
#6 309.8 Retrieving Poetry metadata
#6 309.8 Traceback (most recent call last):
#6 309.8 File "/usr/local/lib/python3.7/urllib/request.py", line 1350, in do_open
#6 309.8 encode_chunked=req.has_header('Transfer-encoding'))
#6 309.8 File "/usr/local/lib/python3.7/http/client.py", line 1281, in request
#6 309.8 self._send_request(method, url, body, headers, encode_chunked)
#6 309.8 File "/usr/local/lib/python3.7/http/client.py", line 1327, in _send_request
#6 309.8 self.endheaders(body, encode_chunked=encode_chunked)
#6 309.8 File "/usr/local/lib/python3.7/http/client.py", line 1276, in endheaders
#6 309.8 self._send_output(message_body, encode_chunked=encode_chunked)
#6 309.8 File "/usr/local/lib/python3.7/http/client.py", line 1036, in _send_output
#6 309.8 self.send(msg)
#6 309.8 File "/usr/local/lib/python3.7/http/client.py", line 976, in send
#6 309.8 self.connect()
#6 309.8 File "/usr/local/lib/python3.7/http/client.py", line 1451, in connect
#6 309.8 server_hostname=server_hostname)
#6 309.8 File "/usr/local/lib/python3.7/ssl.py", line 423, in wrap_socket
#6 309.8 session=session
#6 309.8 File "/usr/local/lib/python3.7/ssl.py", line 870, in _create
#6 309.8 self.do_handshake()
#6 309.8 File "/usr/local/lib/python3.7/ssl.py", line 1139, in do_handshake
#6 309.8 self._sslobj.do_handshake()
#6 309.8 OSError: [Errno 0] Error
#6 309.8
#6 309.8 During handling of the above exception, another exception occurred:
#6 309.8
#6 309.8 Traceback (most recent call last):
#6 309.8 File "", line 1118, in
#6 309.8 File "", line 1114, in main
#6 309.8 File "", line 352, in run
#6 309.8 File "", line 415, in get_version
#6 309.8 File "", line 1029, in _get
#6 309.8 File "/usr/local/lib/python3.7/urllib/request.py", line 222, in urlopen
#6 309.8 return opener.open(url, data, timeout)
#6 309.8 File "/usr/local/lib/python3.7/urllib/request.py", line 525, in open
#6 309.8 response = self._open(req, data)
#6 309.8 File "/usr/local/lib/python3.7/urllib/request.py", line 543, in _open
#6 309.8 '_open', req)
#6 309.8 File "/usr/local/lib/python3.7/urllib/request.py", line 503, in _call_chain
#6 309.8 result = func(*args)
#6 309.8 File "/usr/local/lib/python3.7/urllib/request.py", line 1393, in https_open
#6 309.8 context=self._context, check_hostname=self._check_hostname)
#6 309.8 File "/usr/local/lib/python3.7/urllib/request.py", line 1352, in do_open
#6 309.8 raise URLError(err)
#6 309.8 urllib.error.URLError: <urlopen error [Errno 0] Error>


executor failed running [/bin/sh -c curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | POETRY_HOME=/opt/poetry python && cd /usr/local/bin && ln -s /opt/poetry/bin/poetry && poetry
config virtualenvs.create false]: exit code: 1
ERROR: Service 'backend' failed to build : Build failed

I searched for an answer on the Internet and unfortunately did not find similar solutions to problems. In parallel, in macbookpro macOS 10.12.6, it also fails to deploy, it gives an error (

Bahrom-MacBook-Pro:edoru negmatov$ docker-compose up -d
ERROR: Invalid interpolation format for "networks" option in service "flower": "${TRAEFIK_PUBLIC_NETWORK?Variable not set}"
)
Docker 17.03.1 is installed in macOS. I ask you to direct me to the correct solution of the error.
Visual Studio Code Version: 1.65.2 (Universal)
Thanks for the help

They had some breaking changes so you can try an old version:
https://raw.githubusercontent.com/python-poetry/poetry/1.1/get-poetry.py |

The poetry install process should be updated.

Files backend.dockerfile and celeryworker.dockerfile:

# Install Poetry RUN curl -sSL https://install.python-poetry.org | POETRY_HOME=/opt/poetry python3 - ENV PATH="/opt/poetry/bin:$PATH" RUN poetry config virtualenvs.create false

To add some clarity to @robertop23's answer (which worked for me):

In both backend/backend.dockerfile and backend/celeryworker.dockerfile replace the following code blocks:

# Install Poetry
RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | POETRY_HOME=/opt/poetry python3 && \
    cd /usr/local/bin && \
    ln -s /opt/poetry/bin/poetry && \
    poetry config virtualenvs.create false

With the following:

# Install Poetry 
RUN curl -sSL https://install.python-poetry.org | POETRY_HOME=/opt/poetry python3
ENV PATH="/opt/poetry/bin:$PATH"
RUN poetry config virtualenvs.create false

@rlziii 's solution works, the following snippet looks even cleaner.
Replace

# Install Poetry
RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | POETRY_HOME=/opt/poetry python && \
    cd /usr/local/bin && \
    ln -s /opt/poetry/bin/poetry && \
    poetry config virtualenvs.create false

in /backend.dockerfile and celeryworker.dockerfile to

# Install Poetry
RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | POETRY_HOME=/opt/poetry python && \
    cd /usr/local/bin && \
    ln -s /opt/poetry/bin/poetry && \
    poetry config virtualenvs.create false

@rlziii 's solution works, the following snippet looks even cleaner. Replace

# Install Poetry
RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | POETRY_HOME=/opt/poetry python && \
    cd /usr/local/bin && \
    ln -s /opt/poetry/bin/poetry && \
    poetry config virtualenvs.create false

in /backend.dockerfile and celeryworker.dockerfile to

# Install Poetry
RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | POETRY_HOME=/opt/poetry python && \
    cd /usr/local/bin && \
    ln -s /opt/poetry/bin/poetry && \
    poetry config virtualenvs.create false

This is not working currently

The latest Poetry version (1.6.1) drops support for python 3.7, so if we want to use tiangolo/uvicorn-gunicorn-fastapi:python3.7, we need to edit

# Install Poetry
    RUN curl -sSL https://install.python-poetry.org | POETRY_HOME=/opt/poetry POETRY_VERSION=1.5.1 python  && \
    cd /usr/local/bin && \
    ln -s /opt/poetry/bin/poetry && \
    poetry config virtualenvs.create false

-Getting Peotry error for using https://github.com/tiangolo/full-stack-fastapi-postgresql

So, check VPN(for connection from Iran) and then replace below code to backend.dockerfile and celeryworker.dockerfile:

#Install Poetry
RUN curl -sSL https://install.python-poetry.org | POETRY_HOME=/opt/poetry POETRY_VERSION=1.5.1 python &&
cd /usr/local/bin &&
ln -s /opt/poetry/bin/poetry &&
poetry config virtualenvs.create false