Issue #5869
closedCannot import name Model
Description
I am trying to install pulp3 with rpm_plugin on Centos 7 using the ansible installer and am unable to get a working install. The first issue I hit was the libcomps error referenced here https://pulp.plan.io/issues/5853 and here https://github.com/pulp/pulp_rpm_prerequisites/pull/19/files
I eventually managed to get past that by manually adding the copr repo from mikedep333.
Now it seems I have hit another error and am at a complete loss. Can someone advise how to install the rpm plugin successfully?
I have tested installing without the plugin and this was successful though we need to be able to host rpms.
RUNNING HANDLER [pulp : Collect static content] *****************************************************************************************************************************************************************************************
fatal: [10.15.0.122]: FAILED! => {"changed": true, "cmd": ["/usr/local/lib/pulp/bin/django-admin", "collectstatic", "--noinput", "--link"], "delta": "0:00:01.325170", "end": "2019-12-11 17:15:38.058083", "msg": "non-zero return code", "rc": 1, "start": "2019-12-11 17:15:36.732913", "stderr": "Traceback (most recent call last):\n File \"/usr/local/lib/pulp/bin/django-admin\", line 11, in <module>\n sys.exit(execute_from_command_line())\n File \"/usr/local/lib/pulp/lib64/python3.6/site-packages/django/core/management/__init__.py\", line 381, in execute_from_command_line\n utility.execute()\n File \"/usr/local/lib/pulp/lib64/python3.6/site-packages/django/core/management/__init__.py\", line 357, in execute\n django.setup()\n File \"/usr/local/lib/pulp/lib64/python3.6/site-packages/django/__init__.py\", line 24, in setup\n apps.populate(settings.INSTALLED_APPS)\n File \"/usr/local/lib/pulp/lib64/python3.6/site-packages/django/apps/registry.py\", line 114, in populate\n app_config.import_models()\n File \"/usr/local/lib/pulp/lib64/python3.6/site-packages/django/apps/config.py\", line 211, in import_models\n self.models_module = import_module(models_module_name)\n File \"/usr/lib64/python3.6/importlib/__init__.py\", line 126, in import_module\n return _bootstrap._gcd_import(name[level:], package, level)\n File \"<frozen importlib._bootstrap>\", line 994, in _gcd_import\n File \"<frozen importlib._bootstrap>\", line 971, in _find_and_load\n File \"<frozen importlib._bootstrap>\", line 955, in _find_and_load_unlocked\n File \"<frozen importlib._bootstrap>\", line 665, in _load_unlocked\n File \"<frozen importlib._bootstrap_external>\", line 678, in exec_module\n File \"<frozen importlib._bootstrap>\", line 219, in _call_with_frames_removed\n File \"/usr/local/lib/pulp/lib64/python3.6/site-packages/pulp_rpm/app/models.py\", line 14, in <module>\n from pulpcore.plugin.models import (\nImportError: cannot import name 'Model'", "stderr_lines": ["Traceback (most recent call last):", " File \"/usr/local/lib/pulp/bin/django-admin\", line 11, in <module>", " sys.exit(execute_from_command_line())", " File \"/usr/local/lib/pulp/lib64/python3.6/site-packages/django/core/management/__init__.py\", line 381, in execute_from_command_line", " utility.execute()", " File \"/usr/local/lib/pulp/lib64/python3.6/site-packages/django/core/management/__init__.py\", line 357, in execute", " django.setup()", " File \"/usr/local/lib/pulp/lib64/python3.6/site-packages/django/__init__.py\", line 24, in setup", " apps.populate(settings.INSTALLED_APPS)", " File \"/usr/local/lib/pulp/lib64/python3.6/site-packages/django/apps/registry.py\", line 114, in populate", " app_config.import_models()", " File \"/usr/local/lib/pulp/lib64/python3.6/site-packages/django/apps/config.py\", line 211, in import_models", " self.models_module = import_module(models_module_name)", " File \"/usr/lib64/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 \"/usr/local/lib/pulp/lib64/python3.6/site-packages/pulp_rpm/app/models.py\", line 14, in <module>", " from pulpcore.plugin.models import (", "ImportError: cannot import name 'Model'"], "stdout": "", "stdout_lines": []}
This is my playbook vars.
---
pulp_use_system_wide_pkgs: true
pulp_install_plugins:
pulp-file: {}
pulp-rpm:
prereq_role: "ae.pulp_rpm_prerequisites"
pulp_settings:
secret_key: secret
content_origin: "http://pulp.actual-experience.com:24816"
default_file_storage: "storages.backends.s3boto3.S3Boto3Storage"
aws_storage_bucket_name: "bucketname"
pulp_default_admin_password: PASSWORD
Updated by rust84 over 3 years ago
For an experiment I thought I'd try this on a Fedora 30 AMI using the rpm_plugin role without any changes. Same issue there.
RUNNING HANDLER [pulp : Collect static content] *****************************************************************************************************************************************************************************************
fatal: [10.15.0.104]: FAILED! => {"changed": true, "cmd": ["/usr/local/lib/pulp/bin/django-admin", "collectstatic", "--noinput", "--link"], "delta": "0:00:01.055663", "end": "2019-12-11 17:57:00.690798", "msg": "non-zero return code", "rc": 1, "start": "2019-12-11 17:56:59.635135", "stderr": "Traceback (most recent call last):\n File \"/usr/local/lib/pulp/bin/django-admin\", line 10, in <module>\n sys.exit(execute_from_command_line())\n File \"/usr/local/lib/pulp/lib64/python3.7/site-packages/django/core/management/__init__.py\", line 381, in execute_from_command_line\n utility.execute()\n File \"/usr/local/lib/pulp/lib64/python3.7/site-packages/django/core/management/__init__.py\", line 357, in execute\n django.setup()\n File \"/usr/local/lib/pulp/lib64/python3.7/site-packages/django/__init__.py\", line 24, in setup\n apps.populate(settings.INSTALLED_APPS)\n File \"/usr/local/lib/pulp/lib64/python3.7/site-packages/django/apps/registry.py\", line 114, in populate\n app_config.import_models()\n File \"/usr/local/lib/pulp/lib64/python3.7/site-packages/django/apps/config.py\", line 211, in import_models\n self.models_module = import_module(models_module_name)\n File \"/usr/lib64/python3.7/importlib/__init__.py\", line 127, in import_module\n return _bootstrap._gcd_import(name[level:], package, level)\n File \"<frozen importlib._bootstrap>\", line 1006, in _gcd_import\n File \"<frozen importlib._bootstrap>\", line 983, in _find_and_load\n File \"<frozen importlib._bootstrap>\", line 967, in _find_and_load_unlocked\n File \"<frozen importlib._bootstrap>\", line 677, in _load_unlocked\n File \"<frozen importlib._bootstrap_external>\", line 728, in exec_module\n File \"<frozen importlib._bootstrap>\", line 219, in _call_with_frames_removed\n File \"/usr/local/lib/pulp/lib64/python3.7/site-packages/pulp_rpm/app/models.py\", line 14, in <module>\n from pulpcore.plugin.models import (\nImportError: cannot import name 'Model' from 'pulpcore.plugin.models' (/usr/local/lib/pulp/lib64/python3.7/site-packages/pulpcore/plugin/models/__init__.py)", "stderr_lines": ["Traceback (most recent call last):", " File \"/usr/local/lib/pulp/bin/django-admin\", line 10, in <module>", " sys.exit(execute_from_command_line())", " File \"/usr/local/lib/pulp/lib64/python3.7/site-packages/django/core/management/__init__.py\", line 381, in execute_from_command_line", " utility.execute()", " File \"/usr/local/lib/pulp/lib64/python3.7/site-packages/django/core/management/__init__.py\", line 357, in execute", " django.setup()", " File \"/usr/local/lib/pulp/lib64/python3.7/site-packages/django/__init__.py\", line 24, in setup", " apps.populate(settings.INSTALLED_APPS)", " File \"/usr/local/lib/pulp/lib64/python3.7/site-packages/django/apps/registry.py\", line 114, in populate", " app_config.import_models()", " File \"/usr/local/lib/pulp/lib64/python3.7/site-packages/django/apps/config.py\", line 211, in import_models", " self.models_module = import_module(models_module_name)", " File \"/usr/lib64/python3.7/importlib/__init__.py\", line 127, in import_module", " return _bootstrap._gcd_import(name[level:], package, level)", " File \"<frozen importlib._bootstrap>\", line 1006, in _gcd_import", " File \"<frozen importlib._bootstrap>\", line 983, in _find_and_load", " File \"<frozen importlib._bootstrap>\", line 967, in _find_and_load_unlocked", " File \"<frozen importlib._bootstrap>\", line 677, in _load_unlocked", " File \"<frozen importlib._bootstrap_external>\", line 728, in exec_module", " File \"<frozen importlib._bootstrap>\", line 219, in _call_with_frames_removed", " File \"/usr/local/lib/pulp/lib64/python3.7/site-packages/pulp_rpm/app/models.py\", line 14, in <module>", " from pulpcore.plugin.models import (", "ImportError: cannot import name 'Model' from 'pulpcore.plugin.models' (/usr/local/lib/pulp/lib64/python3.7/site-packages/pulpcore/plugin/models/__init__.py)"], "stdout": "", "stdout_lines": []}
Updated by ttereshc over 3 years ago
It's probably a version discrepancy between pulpcore and pulp_rpm.
We are about to release 3.0.0 GA. Please try this out when it's out.
Updated by rust84 over 3 years ago
Tested this again today and installed GA without issues on Centos 7. Also noted that the dependency on libcomps was resolved automatically. Please close :)