horilla
horilla copied to clipboard
python manage.py makemigrations give error: ModuleNotFoundError: No module named 'environ'
/opt/horilla/horillaenv/bin/python manage.py makemigrations
Traceback (most recent call last):
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/core/management/base.py", line 412, in run_from_argv
self.execute(*args, **cmd_options)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/core/management/base.py", line 453, in execute
self.check()
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/core/management/base.py", line 485, in check
all_issues = checks.run_checks(
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/core/checks/registry.py", line 88, in run_checks
new_errors = check(app_configs=app_configs, databases=databases)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/core/checks/translation.py", line 43, in check_setting_languages
for tag, _ in settings.LANGUAGES
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/conf/__init__.py", line 102, in __getattr__
self._setup(name)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/conf/__init__.py", line 89, in _setup
self._wrapped = Settings(settings_module)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/conf/__init__.py", line 217, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/opt/horilla/horilla/horilla/__init__.py", line 5, in <module>
from horilla import (
File "/opt/horilla/horilla/horilla/haystack_configuration.py", line 3, in <module>
from horilla import settings
File "/opt/horilla/horilla/horilla/settings.py", line 17, in <module>
import environ
ModuleNotFoundError: No module named 'environ'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/horilla/horilla/manage.py", line 22, in <module>
main()
File "/opt/horilla/horilla/manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
utility.execute()
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/core/management/__init__.py", line 436, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/core/management/base.py", line 425, in run_from_argv
connections.close_all()
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/utils/connection.py", line 84, in close_all
for conn in self.all(initialized_only=True):
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/utils/connection.py", line 76, in all
return [
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/utils/connection.py", line 73, in __iter__
return iter(self.settings)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/utils/functional.py", line 57, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/utils/connection.py", line 45, in settings
self._settings = self.configure_settings(self._settings)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/utils.py", line 148, in configure_settings
databases = super().configure_settings(databases)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/utils/connection.py", line 50, in configure_settings
settings = getattr(django_settings, self.settings_name)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/conf/__init__.py", line 102, in __getattr__
self._setup(name)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/conf/__init__.py", line 89, in _setup
self._wrapped = Settings(settings_module)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/conf/__init__.py", line 217, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/opt/horilla/horilla/horilla/__init__.py", line 5, in <module>
from horilla import (
File "/opt/horilla/horilla/horilla/haystack_configuration.py", line 3, in <module>
from horilla import settings
File "/opt/horilla/horilla/horilla/settings.py", line 17, in <module>
import environ
ModuleNotFoundError: No module named 'environ'
Hi @borishinzer ,
Please install django-environ python package using : pip3 install django-environ
With Regards, Team Horilla
Did already, but this leads to more errors:
Traceback (most recent call last):
File "/opt/horilla/horilla/manage.py", line 22, in <module>
main()
File "/opt/horilla/horilla/manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
utility.execute()
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/core/management/__init__.py", line 382, in execute
settings.INSTALLED_APPS
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/conf/__init__.py", line 102, in __getattr__
self._setup(name)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/conf/__init__.py", line 89, in _setup
self._wrapped = Settings(settings_module)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/conf/__init__.py", line 217, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/opt/horilla/horilla/horilla/__init__.py", line 5, in <module>
from horilla import (
File "/opt/horilla/horilla/horilla/haystack_configuration.py", line 3, in <module>
from horilla import settings
File "/opt/horilla/horilla/horilla/settings.py", line 17, in <module>
import environ
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/environ.py", line 114
raise ValueError, "No frame marked with %s." % fname
^
SyntaxError: invalid syntax
Hi @borishinzer , Can you please send the screenshot of the errors ? The above errors when formatted in github seems to be all clustered and difficult to understand.
I think the issue is that you have installed environ instead of django-environ .
Can you try by removing environ and reinstalling django-environ ?
Did uninstall environ and installed django-environ
/opt/horilla/horillaenv/bin/python manage.py makemigrations
Traceback (most recent call last):
File "/opt/horilla/horilla/manage.py", line 22, in <module>
main()
File "/opt/horilla/horilla/manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
utility.execute()
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/core/management/__init__.py", line 436, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/core/management/base.py", line 412, in run_from_argv
self.execute(*args, **cmd_options)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/core/management/base.py", line 458, in execute
output = self.handle(*args, **options)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/core/management/base.py", line 106, in wrapper
res = handle_func(*args, **kwargs)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/core/management/commands/makemigrations.py", line 156, in handle
loader.check_consistent_history(connection)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/migrations/loader.py", line 327, in check_consistent_history
raise InconsistentMigrationHistory(
django.db.migrations.exceptions.InconsistentMigrationHistory: Migration onboarding.0003_alter_candidatestage_options_and_more is applied before its dependency recruitment.0004_alter_candidate_job_position_id_and_more on database 'default'.
Was the migrations files somehow removed from the apps?
no. I just did a git pulland git rebase
Can you try running the makemigrations command again followed by migrate again once more?
/opt/horilla/horillaenv/bin/python manage.py makemigrations
Traceback (most recent call last):
File "/opt/horilla/horilla/manage.py", line 22, in <module>
main()
File "/opt/horilla/horilla/manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
utility.execute()
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/core/management/__init__.py", line 436, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/core/management/base.py", line 412, in run_from_argv
self.execute(*args, **cmd_options)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/core/management/base.py", line 458, in execute
output = self.handle(*args, **options)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/core/management/base.py", line 106, in wrapper
res = handle_func(*args, **kwargs)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/core/management/commands/makemigrations.py", line 156, in handle
loader.check_consistent_history(connection)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/migrations/loader.py", line 327, in check_consistent_history
raise InconsistentMigrationHistory(
django.db.migrations.exceptions.InconsistentMigrationHistory: Migration onboarding.0003_alter_candidatestage_options_and_more is applied before its dependency recruitment.0004_alter_candidate_job_position_id_and_more on database 'default'.
/opt/horilla/horillaenv/bin/python manage.py migrate
Traceback (most recent call last):
File "/opt/horilla/horilla/manage.py", line 22, in <module>
main()
File "/opt/horilla/horilla/manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
utility.execute()
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/core/management/__init__.py", line 436, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/core/management/base.py", line 412, in run_from_argv
self.execute(*args, **cmd_options)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/core/management/base.py", line 458, in execute
output = self.handle(*args, **options)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/core/management/base.py", line 106, in wrapper
res = handle_func(*args, **kwargs)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/core/management/commands/migrate.py", line 120, in handle
executor.loader.check_consistent_history(connection)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/migrations/loader.py", line 327, in check_consistent_history
raise InconsistentMigrationHistory(
django.db.migrations.exceptions.InconsistentMigrationHistory: Migration onboarding.0003_alter_candidatestage_options_and_more is applied before its dependency recruitment.0004_alter_candidate_job_position_id_and_more on database 'default'.
Hi @borishinzer , Are you using your production database or the test database in this migrations?
With Regards, Team Horilla
How to find that out? I didn't change any database.
Hi @borishinzer , This is not a generic issue and we need to look into the migration files to have a better understanding of it. Can we have a meeting with our team to assist you in fixing this ?
With Regards, Team Horilla
Hi @borishinzer , Any updates on the above case?
With Regards, Team Horilla
We are closing this issue due to inactivity. It seems that there hasn't been any recent activity or discussion, and we believe it may have been resolved or is no longer relevant. If you feel this issue is still important and should be addressed, please feel free to reopen it or create a new issue with updated details.
With Regards, Team Horilla