Exact icon indicating copy to clipboard operation
Exact copied to clipboard

Docker build not feasible

Open nik85 opened this issue 1 year ago • 7 comments

Hi Christian,

the docker build does not work, there seem to be version missmatches. How could that be fixed? I guess it is super easy :)

3.319 ERROR: Could not find a version that satisfies the requirement django-filter==23.2 (from versions: 0.1.0, 0.2.0, 0.5.0, 0.5.1, 0.5.2, 0.5.3, 0.5.4, 0.6a1, 0.6, 0.7, 0.8, 0.9.0, 0.9.1, 0.9.2, 0.10.0, 0.11.0, 0.12.0, 0.13.0, 0.14.0, 0.15.0, 0.15.1, 0.15.2, 0.15.3, 1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.1.0, 2.0.0.dev1, 2.0.0, 2.1.0, 2.2.0, 2.3.0, 2.4.0, 21.1) 3.319 ERROR: No matching distribution found for django-filter==23.2

Best regards, CJ

nik85 avatar Oct 12 '23 09:10 nik85

Dear @nik85,

The branch Bugfix106Ubuntu22.04 should contain a fix for your bug report. Please check it out and provide feedback if it fixed your issue.

With kind regards, Christian

ChristianMarzahl avatar Oct 16 '23 08:10 ChristianMarzahl

Hi Christian,

it builds, with the following errors.

ERROR;2023-10-16 13:57:07,189;urls;17;139690660884480;No module named 'debug_toolbar'
SystemCheckError: System check identified some issues:

ERRORS:
images.FrameDescription.description: (fields.E120) CharFields must define a 'max_length' attribute.
images.FrameDescription.file_path: (fields.E120) CharFields must define a 'max_length' attribute.

Still i tried to run and access the WebUI - However it does not run correctly. I am able to put in the credentials on the login page - like exact / exact (have not touched the settings files apart from renaming them as described in the manual).

However this leads to the following - not showing the UI but an error:

Environment:


Request Method: POST
Request URL: http://localhost/accounts/login/

Django Version: 3.2.11
Python Version: 3.10.12
Installed Applications:
['exact.annotations',
 'exact.base',
 'exact.images',
 'exact.users',
 'exact.tools',
 'exact.datasets',
 'exact.processing',
 'exact.administration',
 'django.contrib.admin',
 'exact.tagger_messages',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'rest_framework',
 'djoser',
 'rest_framework.authtoken',
 'django_filters',
 'widget_tweaks',
 'friendlytagloader',
 'plugins',
 'util',
 'django_registration',
 'djversion']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.auth.middleware.RemoteUserMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'django.middleware.locale.LocaleMiddleware']



Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)

The above exception (relation "users_user" does not exist
LINE 1: ...s_user"."date_joined", "users_user"."points" FROM "users_use...
                                                             ^
) was the direct cause of the following exception:
  File "/usr/local/lib/python3.10/dist-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/usr/local/lib/python3.10/dist-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/local/lib/python3.10/dist-packages/django/views/generic/base.py", line 70, in view
    return self.dispatch(request, *args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/django/utils/decorators.py", line 43, in _wrapper
    return bound_method(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/django/views/decorators/debug.py", line 89, in sensitive_post_parameters_wrapper
    return view(request, *args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/django/utils/decorators.py", line 43, in _wrapper
    return bound_method(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/django/utils/decorators.py", line 130, in _wrapped_view
    response = view_func(request, *args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/django/utils/decorators.py", line 43, in _wrapper
    return bound_method(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/django/views/decorators/cache.py", line 44, in _wrapped_view_func
    response = view_func(request, *args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/django/contrib/auth/views.py", line 63, in dispatch
    return super().dispatch(request, *args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/django/views/generic/base.py", line 98, in dispatch
    return handler(request, *args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/django/views/generic/edit.py", line 141, in post
    if form.is_valid():
  File "/usr/local/lib/python3.10/dist-packages/django/forms/forms.py", line 175, in is_valid
    return self.is_bound and not self.errors
  File "/usr/local/lib/python3.10/dist-packages/django/forms/forms.py", line 170, in errors
    self.full_clean()
  File "/usr/local/lib/python3.10/dist-packages/django/forms/forms.py", line 373, in full_clean
    self._clean_form()
  File "/usr/local/lib/python3.10/dist-packages/django/forms/forms.py", line 400, in _clean_form
    cleaned_data = self.clean()
  File "/usr/local/lib/python3.10/dist-packages/django/contrib/auth/forms.py", line 202, in clean
    self.user_cache = authenticate(self.request, username=username, password=password)
  File "/usr/local/lib/python3.10/dist-packages/django/views/decorators/debug.py", line 42, in sensitive_variables_wrapper
    return func(*func_args, **func_kwargs)
  File "/usr/local/lib/python3.10/dist-packages/django/contrib/auth/__init__.py", line 76, in authenticate
    user = backend.authenticate(request, **credentials)
  File "/usr/local/lib/python3.10/dist-packages/django/contrib/auth/backends.py", line 42, in authenticate
    user = UserModel._default_manager.get_by_natural_key(username)
  File "/usr/local/lib/python3.10/dist-packages/django/contrib/auth/base_user.py", line 45, in get_by_natural_key
    return self.get(**{self.model.USERNAME_FIELD: username})
  File "/usr/local/lib/python3.10/dist-packages/django/db/models/manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/django/db/models/query.py", line 431, in get
    num = len(clone)
  File "/usr/local/lib/python3.10/dist-packages/django/db/models/query.py", line 262, in __len__
    self._fetch_all()
  File "/usr/local/lib/python3.10/dist-packages/django/db/models/query.py", line 1324, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
  File "/usr/local/lib/python3.10/dist-packages/django/db/models/query.py", line 51, in __iter__
    results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
  File "/usr/local/lib/python3.10/dist-packages/django/db/models/sql/compiler.py", line 1175, in execute_sql
    cursor.execute(sql, params)
  File "/usr/local/lib/python3.10/dist-packages/django/db/backends/utils.py", line 98, in execute
    return super().execute(sql, params)
  File "/usr/local/lib/python3.10/dist-packages/django/db/backends/utils.py", line 66, in execute
    return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
  File "/usr/local/lib/python3.10/dist-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/usr/local/lib/python3.10/dist-packages/django/db/backends/utils.py", line 79, in _execute
    with self.db.wrap_database_errors:
  File "/usr/local/lib/python3.10/dist-packages/django/db/utils.py", line 90, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/usr/local/lib/python3.10/dist-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)

Exception Type: ProgrammingError at /accounts/login/
Exception Value: relation "users_user" does not exist
LINE 1: ...s_user"."date_joined", "users_user"."points" FROM "users_use...
                                                             ^

nik85 avatar Oct 16 '23 12:10 nik85

I share how to resolve this issue.

Problem: The Ubuntu version set for the build was 18.04, which prevented the installation of the latest version of packages.

Solution: Change the Ubuntu image version used during the build from 18.04 to 22.04. Change the numpy version from 1.19.4 to 1.26.0. Then, build the docker

How to Change: For the files under the \Exact\exact path, change:

“FROM ubuntu:18.04 as builder” to “FROM ubuntu:22.04 as builder” “RUN pip3 install numpy==1.19.4” to “RUN pip3 install numpy==1.26.0”

The files to change are: Dockerfile Dockerfile.iSyntax Dockerfile.iSyntax.prod Dockerfile.prod Dockerfile.prod.aws-db

lullulalal avatar Dec 15 '23 14:12 lullulalal

Dear @lullulalal,

I will test your suggested changes and merge them into the master.

With kind regards, Christian

ChristianMarzahl avatar Dec 19 '23 08:12 ChristianMarzahl

Merged: https://github.com/ChristianMarzahl/Exact/pull/107

ChristianMarzahl avatar Dec 19 '23 10:12 ChristianMarzahl

Dear @ChristianMarzahl ,

I checked the latest master branch on GitHub. But in my environment, the following error occurred when start the server.

images.FrameDescription.description: (fields.E120) CharFields must define a 'max_length' attribute. images.FrameDescription.file_path: (fields.E120) CharFields must define a 'max_length' attribute.

After deleting the line 'Django==3.2.11' in the 'requirements.txt' file, I built the Docker image, and Django version 4.2.8 was automatically installed. The server started successfully.

Is there a specific reason for adding 'Django==3.2.11' to the 'requirements.txt' file?

lullulalal avatar Dec 19 '23 16:12 lullulalal

Dear @lullulalal,

Here are multiple variables at play, for example, your Python version? I developed under 3.6 and 3.8. Is it working within docker?

With kind regards, Christian

ChristianMarzahl avatar Dec 20 '23 13:12 ChristianMarzahl

Dear @lullulalal,

I ran across the same problem which seems to be related to some fields now requiring default values. I think it should be fixed with the latest merge in master.

Best,

Marc

maubreville avatar May 29 '24 13:05 maubreville