Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple errors #11

Open
workphone-002 opened this issue Feb 26, 2024 · 1 comment
Open

Multiple errors #11

workphone-002 opened this issue Feb 26, 2024 · 1 comment

Comments

@workphone-002
Copy link

It is the first time that I use docker and honestly, I have no idea how it works, I have limited myself to following the installation instructions that you indicate but I cannot in any way get the app to work. In the installation instructions, step 3 states Important: Then, put the necessary environment files (.env) in this folder. Since I don't really know what to do in this step, I have limited myself to renaming the .env-template file to .env:

CREDENTIAL_JSON_FILE_NAME=example
STORAGE_BUCKET_NAME=example
SECRET_KEY=example

DATABASE_ENGINE=example
DATABASE_NAME=example
DATABASE_USER=example
DATABASE_PASSWORD=example
DATABASE_HOST=example
DATABASE_PORT=example

I am using a Windows 11 machine and Docker-desktop configured on wsl2

  1. The first error I got was during the process [backend 6/7] RUN pip install -r requirements.txt:
    9.809 ERROR: Package 'networkx' requires a different Python: 3.8.10 not in '>=3.9'
    This bug was fixed by adding 'networkx==3.1' in the requirements.txt file

  2. The second error I ran into took place in [+] Running 4/3

translation-app-frontend  | yarn run v1.22.19
translation-app-frontend  | $ next dev
translation-app-frontend  | /bin/sh: 1: next: not found
translation-app-frontend  | error Command failed with exit code 127.
translation-app-frontend  | info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
translation-app-frontend exited with code 127

As I said at the beginning, I have no idea about docker (or next), but by consulting some related problems I was able to solve it (or so I think) by modifying the volume configuration in the services docker-compose.yml. I'm not sure if this is correct but it apparently solved the problem:

    volumes:
      - ./Frontend:/translation-app-frontend
      - /translation-app-frontend/node_modules
  1. The third error also occurs in [+] Running 4/3:
[+] Running 4/3
 ✔ Container translation-app-backend                                   Recreated                                     0.1s
 ! backend Published ports are discarded when using host network mode                                   0.0s
 ✔ Container translation-app-frontend                                  Recreated                                      0.1s
 ! frontend Published ports are discarded when using host network mode                                   0.0s

I guess this is why when I access http://localhost:3000/ the page doesn't load, but although I have searched for information and it seems that using host.docker.internal instead of localhost:xxxx could be a solution as suggested in this related issue ([](https://stackoverflow.com/questions/55851632/docker-compose-network-mode -host-not-working)), I don't know where to make the modifications and therefore I haven't been able to solve it:
image

  1. Finally, in addition to the previous error that I don't know how to solve, an error message always appears in [+] Running 4/3 after Successfully installed translation-app. I also don't know how to fix this error:
translation-app-backend   | django.core.exceptions.ImproperlyConfigured: 'example' isn't an available database backend or couldn't be imported. Check the above exception. To use one of the built-in backends, use 'django.db.backends.XXX', where XXX is one of:
translation-app-backend   |     'mysql', 'oracle', 'postgresql', 'sqlite3'
translation-app-backend exited with code 1
  • Full log:
[+] Building 48.8s (11/12)                                                                                                                          docker:default
[+] Building 48.9s (12/12)                                                                                                                          docker:default
[+] Building 55.9s (23/23) FINISHED                                                                                                                 docker:default
 => [backend internal] load build definition from Dockerfile.backend                                                                                          0.3s
 => => transferring dockerfile: 496B                                                                                                                          0.2s
 => [backend internal] load metadata for docker.io/nvidia/cuda:11.1.1-cudnn8-devel-ubuntu20.04                                                                2.1s
 => [backend internal] load .dockerignore                                                                                                                     0.1s
 => => transferring context: 61B                                                                                                                              0.1s
 => [backend 1/7] FROM docker.io/nvidia/cuda:11.1.1-cudnn8-devel-ubuntu20.04@sha256:83e4b2841034cdf45ea5b9a5b472eb2c07b1b23d4836d32666a881db29a8dceb          0.0s
 => [backend internal] load build context                                                                                                                    45.2s
 => => transferring context: 410.64MB                                                                                                                        45.2s
 => CACHED [backend 2/7] RUN apt-get update && apt-get install -y python3 python3-pip cmake wget llvm                                                         0.0s
 => CACHED [backend 3/7] RUN apt-get install -y libglib2.0-0 libsm6 ffmpeg libxext6 libxrender-dev                                                            0.0s
 => CACHED [backend 4/7] WORKDIR /translation-app-backend/Backend/                                                                                            0.0s
 => CACHED [backend 5/7] COPY ./Backend/requirements.txt requirements.txt                                                                                     0.0s
 => CACHED [backend 6/7] RUN pip install -r requirements.txt                                                                                                  0.0s
 => [backend 7/7] COPY . .                                                                                                                                    0.5s
 => [backend] exporting to image                                                                                                                              0.6s
 => => exporting layers                                                                                                                                       0.6s
 => => writing image sha256:07882e1572e76b15b00cbc9d13cf2cabbf19e549e42b5958115f068bc7056ef3                                                                  0.0s
 => => naming to docker.io/library/translation_layoutrecovery-backend                                                                                         0.0s
 => [frontend internal] load build definition from Dockerfile.frontend                                                                                        0.0s
 => => transferring dockerfile: 685B                                                                                                                          0.0s
 => [frontend internal] load metadata for docker.io/library/node:20.5.1                                                                                       0.7s
 => [frontend internal] load .dockerignore                                                                                                                    0.0s
 => => transferring context: 61B                                                                                                                              0.0s
 => [frontend internal] load build context                                                                                                                    0.1s
 => => transferring context: 5.36kB                                                                                                                           0.0s
 => [frontend 1/6] FROM docker.io/library/node:20.5.1@sha256:8d9887b3b05d2e65598a18616c37cfc271346d12248dfcbeadd7b7bf4da1e827                                 0.0s
 => CACHED [frontend 2/6] WORKDIR /translation-app-frontend/                                                                                                  0.0s
 => CACHED [frontend 3/6] RUN apt-get -y update && apt-get install -y nmh                                                                                     0.0s
 => CACHED [frontend 4/6] COPY ./Frontend/package.json ./Frontend/yarn.lock .                                                                                 0.0s
 => CACHED [frontend 5/6] RUN yarn install && yarn start                                                                                                      0.0s
 => [frontend 6/6] COPY ./Frontend/ .                                                                                                                         0.1s
 => [frontend] exporting to image                                                                                                                             0.3s
 => => exporting layers                                                                                                                                       0.2s
 => => writing image sha256:361f9517a95837f680c87c9fc28125acd2a1a5cd14c9c3be235eb4430ec51691                                                                  0.0s
 => => naming to docker.io/library/translation_layoutrecovery-frontend                                                                                        0.0s
[+] Running 4/4
 ✔ Container translation-app-backend                                   Recreated                                                                              1.2s
 ! backend Published ports are discarded when using host network mode                                                                                         0.0s
 ✔ Container translation-app-frontend                                  Recreated                                                                              1.1s
 ! frontend Published ports are discarded when using host network mode                                                                                        0.0s
Attaching to translation-app-backend, translation-app-frontend
translation-app-backend   |
translation-app-backend   | ==========
translation-app-backend   | == CUDA ==
translation-app-backend   | ==========
translation-app-backend   |
translation-app-backend   | CUDA Version 11.1.1
translation-app-backend   |
translation-app-backend   | Container image Copyright (c) 2016-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
translation-app-backend   |
translation-app-backend   | This container image and its contents are governed by the NVIDIA Deep Learning Container License.
translation-app-backend   | By pulling and using the container, you accept the terms and conditions of this license:
translation-app-backend   | https://developer.nvidia.com/ngc/nvidia-deep-learning-container-license
translation-app-backend   |
translation-app-backend   | A copy of this license is made available in this container at /NGC-DL-CONTAINER-LICENSE for your convenience.
translation-app-backend   |
translation-app-frontend  | yarn run v1.22.19
translation-app-frontend  | $ next dev
translation-app-backend   | /usr/local/lib/python3.8/dist-packages/gdown/__main__.py:132: FutureWarning: Option `--id` was deprecated in version 4.3.1 and will be removed in 5.0. You don't need to pass it anymore to use a file ID.
translation-app-backend   |   warnings.warn(
translation-app-backend   | Downloading...
translation-app-backend   | From (original): https://drive.google.com/uc?id=1Jx2m_2I1d9PYzFRQ4gl82xQa-G7Vsnsl
translation-app-backend   | From (redirected): https://drive.google.com/uc?id=1Jx2m_2I1d9PYzFRQ4gl82xQa-G7Vsnsl&confirm=t&uuid=e803f44b-b923-4895-b646-04a56c7409b9
translation-app-backend   | To: /translation-app-backend/Backend/model_196000.pth
translation-app-frontend  | - ready started server on 0.0.0.0:3000, url: http://localhost:3000
translation-app-frontend  | - event compiled client and server successfully in 4.2s (20 modules)
translation-app-frontend  | - wait compiling...
translation-app-frontend  | - event compiled client and server successfully in 119 ms (20 modules)
100%|██████████| 351M/351M [00:37<00:00, 9.37MB/s]
translation-app-backend   | Obtaining file:///translation-app-backend
translation-app-backend   | Installing collected packages: translation-app
translation-app-backend   |   Running setup.py develop for translation-app
translation-app-backend   | Successfully installed translation-app
translation-app-backend   | Traceback (most recent call last):
translation-app-backend   |   File "/usr/local/lib/python3.8/dist-packages/django/db/utils.py", line 113, in load_backend
translation-app-backend   |     return import_module("%s.base" % backend_name)
translation-app-backend   |   File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
translation-app-backend   |     return _bootstrap._gcd_import(name[level:], package, level)
translation-app-backend   |   File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
translation-app-backend   |   File "<frozen importlib._bootstrap>", line 991, in _find_and_load
translation-app-backend   |   File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
translation-app-backend   |   File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
translation-app-backend   |   File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
translation-app-backend   |   File "<frozen importlib._bootstrap>", line 991, in _find_and_load
translation-app-backend   |   File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
translation-app-backend   | ModuleNotFoundError: No module named 'example'
translation-app-backend   |
translation-app-backend   | The above exception was the direct cause of the following exception:
translation-app-backend   |
translation-app-backend   | Traceback (most recent call last):
translation-app-backend   |   File "manage.py", line 22, in <module>
translation-app-backend   |     main()
translation-app-backend   |   File "manage.py", line 18, in main
translation-app-backend   |     execute_from_command_line(sys.argv)
translation-app-backend   |   File "/usr/local/lib/python3.8/dist-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
translation-app-backend   |     utility.execute()
translation-app-backend   |   File "/usr/local/lib/python3.8/dist-packages/django/core/management/__init__.py", line 416, in execute
translation-app-backend   |     django.setup()
translation-app-backend   |   File "/usr/local/lib/python3.8/dist-packages/django/__init__.py", line 24, in setup
translation-app-backend   |     apps.populate(settings.INSTALLED_APPS)
translation-app-backend   |   File "/usr/local/lib/python3.8/dist-packages/django/apps/registry.py", line 116, in populate
translation-app-backend   |     app_config.import_models()
translation-app-backend   |   File "/usr/local/lib/python3.8/dist-packages/django/apps/config.py", line 269, in import_models
translation-app-backend   |     self.models_module = import_module(models_module_name)
translation-app-backend   |   File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
translation-app-backend   |     return _bootstrap._gcd_import(name[level:], package, level)
translation-app-backend   |   File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
translation-app-backend   |   File "<frozen importlib._bootstrap>", line 991, in _find_and_load
translation-app-backend   |   File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
translation-app-backend   |   File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
translation-app-backend   |   File "<frozen importlib._bootstrap_external>", line 848, in exec_module
translation-app-backend   |   File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
translation-app-backend   |   File "/usr/local/lib/python3.8/dist-packages/django/contrib/auth/models.py", line 3, in <module>
translation-app-backend   |     from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
translation-app-backend   |   File "/usr/local/lib/python3.8/dist-packages/django/contrib/auth/base_user.py", line 57, in <module>
translation-app-backend   |     class AbstractBaseUser(models.Model):
translation-app-backend   |   File "/usr/local/lib/python3.8/dist-packages/django/db/models/base.py", line 143, in __new__
translation-app-backend   |     new_class.add_to_class("_meta", Options(meta, app_label))
translation-app-backend   |   File "/usr/local/lib/python3.8/dist-packages/django/db/models/base.py", line 371, in add_to_class
translation-app-backend   |     value.contribute_to_class(cls, name)
translation-app-backend   |   File "/usr/local/lib/python3.8/dist-packages/django/db/models/options.py", line 243, in contribute_to_class
translation-app-backend   |     self.db_table, connection.ops.max_name_length()
translation-app-backend   |   File "/usr/local/lib/python3.8/dist-packages/django/utils/connection.py", line 15, in __getattr__
translation-app-backend   |     return getattr(self._connections[self._alias], item)
translation-app-backend   |   File "/usr/local/lib/python3.8/dist-packages/django/utils/connection.py", line 62, in __getitem__
translation-app-backend   |     conn = self.create_connection(alias)
translation-app-backend   |   File "/usr/local/lib/python3.8/dist-packages/django/db/utils.py", line 193, in create_connection
translation-app-backend   |     backend = load_backend(db["ENGINE"])
translation-app-backend   |   File "/usr/local/lib/python3.8/dist-packages/django/db/utils.py", line 126, in load_backend
translation-app-backend   |     raise ImproperlyConfigured(
translation-app-backend   | django.core.exceptions.ImproperlyConfigured: 'example' isn't an available database backend or couldn't be imported. Check the above exception. To use one of the built-in backends, use 'django.db.backends.XXX', where XXX is one of:
translation-app-backend   |     'mysql', 'oracle', 'postgresql', 'sqlite3'
translation-app-backend exited with code 1
@dennisdebel
Copy link

Hi! You are having the same issues as I do, see here.
Disclamer, I have have minimal experience with all of this, especially the combination of node, django/python etc.

Error 2: This was fixed for me by manually install nvm, node, npm, yarn (globall), and in the Frontend folder install next, react, react-dom via npm and then add unmet peer dependencies in package.json (see below).

Error 3: I don't think your frontend is running since you cant visit the page... I had it running at some point but forgot how and now in more mess it seems.

Error 4: I hardcoded the credentials from .env into Backend/services/settings.py. I install and run postgres database locally (and make a database, user and password)
My DATABASES section in settings.py (some parts redacted...duh). The important thing seems to be the ENGINE definition which cannot be 'postgres' it seems but is another package.

DATABASES = {
    "default": {
        "ENGINE": "django.db.backends.postgresql_psycopg2",
        "NAME": "postgres",
        "USER": "postgres",
        "PASSWORD": "redacted",
        "HOST": "localhost",
        "PORT": "5432"
    }
}

My package.json:

{
  "name": "translation-app-frontend",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "@chakra-ui/next-js": "^2.1.5",
    "@chakra-ui/react": "2.8.2",
    "@emotion/react": "^11",
    "@emotion/styled": "^11.0.0",
    "@types/node": "20.5.0",
    "@types/react": "18.2.20",
    "@types/react-dom": "18.2.7",
    "autoprefixer": "10.4.15",
    "bcrypt": "^5.1.1",
    "bcryptjs": "^2.4.3",
    "eslint": "8.47.0",
    "eslint-config-next": "13.4.13",
    "framer-motion": "4.0.0",
    "js-cookie": "^3.0.5",
    "next": "^13.5.6",
    "postcss": "8.4.27",
    "prop-types": "^15.6.0",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-dropzone": "^14.2.3",
    "react-hook-form": "^7.45.4",
    "react-infinite-scroll-component": "^6.1.0",
    "react-loading": "^2.0.3",
    "react-pdf": "^7.3.3",
    "react-toastify": "^9.1.3",
    "tailwindcss": "3.3.3",
    "typescript": "5.1.6"
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants