cortex-lab / alyx

Database for experimental neuroscience laboratories
44 stars 11 forks source link

Travis build fails - support for polymorphism and Django > 3.0 #645

Closed oliche closed 4 years ago

oliche commented 4 years ago

Alyx integration is failing on the latest Django. It comes from a third-party package that is not up to date.

There is a PR to fix the third-party package here: https://github.com/django-polymorphic/django-polymorphic/pull/451 We can wait a few days to see if the PR gets merged. If it doesn't, we'll have to force django 3.0 until it gets fixed or rely on a fork of this toolbox.

oliche commented 4 years ago

Still under review here: https://github.com/django-polymorphic/django-polymorphic/pull/452

chrisglass commented 4 years ago

This is now fixed in polymorphic master.

Could you please confirm it works for you in master?

maxhoheiser commented 4 years ago

Hi I sadly I still get the same issue:

Configuration files successfully created from templates
Traceback (most recent call last):
  File "alyx/manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/root/alyx/alyxvenv/lib/python3.6/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "/root/alyx/alyxvenv/lib/python3.6/site-packages/django/core/management/__init__.py", line 377, in execute
    django.setup()
  File "/root/alyx/alyxvenv/lib/python3.6/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/root/alyx/alyxvenv/lib/python3.6/site-packages/django/apps/registry.py", line 114, in populate
    app_config.import_models()
  File "/root/alyx/alyxvenv/lib/python3.6/site-packages/django/apps/config.py", line 211, in import_models
    self.models_module = import_module(models_module_name)
  File "/root/alyx/alyxvenv/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/root/alyx/alyxvenv/lib/python3.6/site-packages/polymorphic/models.py", line 17, in <module>
    from .base import PolymorphicModelBase
  File "/root/alyx/alyxvenv/lib/python3.6/site-packages/polymorphic/base.py", line 18, in <module>
    from .managers import PolymorphicManager
  File "/root/alyx/alyxvenv/lib/python3.6/site-packages/polymorphic/managers.py", line 10, in <module>
    from polymorphic.query import PolymorphicQuerySet
  File "/root/alyx/alyxvenv/lib/python3.6/site-packages/polymorphic/query.py", line 11, in <module>
    from django.db.models import FieldDoesNotExist
ImportError: cannot import name 'FieldDoesNotExist'
Traceback (most recent call last):
  File "alyx/manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/root/alyx/alyxvenv/lib/python3.6/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "/root/alyx/alyxvenv/lib/python3.6/site-packages/django/core/management/__init__.py", line 377, in execute
    django.setup()
  File "/root/alyx/alyxvenv/lib/python3.6/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/root/alyx/alyxvenv/lib/python3.6/site-packages/django/apps/registry.py", line 114, in populate
    app_config.import_models()
  File "/root/alyx/alyxvenv/lib/python3.6/site-packages/django/apps/config.py", line 211, in import_models
    self.models_module = import_module(models_module_name)
  File "/root/alyx/alyxvenv/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/root/alyx/alyxvenv/lib/python3.6/site-packages/polymorphic/models.py", line 17, in <module>
    from .base import PolymorphicModelBase
  File "/root/alyx/alyxvenv/lib/python3.6/site-packages/polymorphic/base.py", line 18, in <module>
    from .managers import PolymorphicManager
  File "/root/alyx/alyxvenv/lib/python3.6/site-packages/polymorphic/managers.py", line 10, in <module>
    from polymorphic.query import PolymorphicQuerySet
  File "/root/alyx/alyxvenv/lib/python3.6/site-packages/polymorphic/query.py", line 11, in <module>
    from django.db.models import FieldDoesNotExist
ImportError: cannot import name 'FieldDoesNotExist'
Traceback (most recent call last):
  File "alyx/manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/root/alyx/alyxvenv/lib/python3.6/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "/root/alyx/alyxvenv/lib/python3.6/site-packages/django/core/management/__init__.py", line 377, in execute
    django.setup()
  File "/root/alyx/alyxvenv/lib/python3.6/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/root/alyx/alyxvenv/lib/python3.6/site-packages/django/apps/registry.py", line 114, in populate
    app_config.import_models()
  File "/root/alyx/alyxvenv/lib/python3.6/site-packages/django/apps/config.py", line 211, in import_models
    self.models_module = import_module(models_module_name)
  File "/root/alyx/alyxvenv/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/root/alyx/alyxvenv/lib/python3.6/site-packages/polymorphic/models.py", line 17, in <module>
    from .base import PolymorphicModelBase
  File "/root/alyx/alyxvenv/lib/python3.6/site-packages/polymorphic/base.py", line 18, in <module>
    from .managers import PolymorphicManager
  File "/root/alyx/alyxvenv/lib/python3.6/site-packages/polymorphic/managers.py", line 10, in <module>
    from polymorphic.query import PolymorphicQuerySet
  File "/root/alyx/alyxvenv/lib/python3.6/site-packages/polymorphic/query.py", line 11, in <module>
    from django.db.models import FieldDoesNotExist
ImportError: cannot import name 'FieldDoesNotExist'
chrisglass commented 4 years ago

On the master branch the import line is: https://github.com/django-polymorphic/django-polymorphic/blob/master/polymorphic/query.py#L9 .

Your stacktrace mentions another import, on line 11.

Ergo: you are not running polymorphic from master.

maxhoheiser commented 4 years ago

a-ok interesting, because I pulled the latest version from Github of django-polymorphic, do you know if I have to manually delete the package first so I get the updates?

for people who run into the same issue:

pip remove django-polymorphic
pip install git+https://github.com/django-polymorphic/django-polymorphic.git

and make sure to use the same user and pw for the database since it has already been set up the rest time

chrisglass commented 4 years ago

django-polymorphic 3.0.0 has been released to pypi, which should hopefully solve your problem.

I suspect this issue can be closed.

oliche commented 4 years ago

Yes it did. Thanks.