You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My app uses django-pwned-passwords. After freshly deploying my app, I tried to create a superuser with python manage.py createsuperuser. I received the error message ModuleNotFoundError: No module named 'requests'.
What I Did
(env) root@thesis-server:/srv/thesis# python manage.py createsuperuser
Username (leave blank to use 'user'): root
Email address:
Password:
Password (again):
Traceback (most recent call last):
File "/srv/thesis/env/lib/python3.7/site-packages/django/contrib/auth/password_validation.py", line 26, in get_password_validators
klass = import_string(validator['NAME'])
File "/srv/thesis/env/lib/python3.7/site-packages/django/utils/module_loading.py", line 17, in import_string
module = import_module(module_path)
File "/usr/lib/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 "/srv/thesis/env/lib/python3.7/site-packages/django_pwned_passwords/password_validation.py", line 6, in <module>
import requests
ModuleNotFoundError: No module named 'requests'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "/srv/thesis/env/lib/python3.7/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
utility.execute()
File "/srv/thesis/env/lib/python3.7/site-packages/django/core/management/__init__.py", line 395, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/srv/thesis/env/lib/python3.7/site-packages/django/core/management/base.py", line 330, in run_from_argv
self.execute(*args, **cmd_options)
File "/srv/thesis/env/lib/python3.7/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 79, in execute
return super().execute(*args, **options)
File "/srv/thesis/env/lib/python3.7/site-packages/django/core/management/base.py", line 371, in execute
output = self.handle(*args, **options)
File "/srv/thesis/env/lib/python3.7/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 157, in handle
validate_password(password2, self.UserModel(**fake_user_data))
File "/srv/thesis/env/lib/python3.7/site-packages/django/contrib/auth/password_validation.py", line 44, in validate_password
password_validators = get_default_password_validators()
File "/srv/thesis/env/lib/python3.7/site-packages/django/contrib/auth/password_validation.py", line 19, in get_default_password_validators
return get_password_validators(settings.AUTH_PASSWORD_VALIDATORS)
File "/srv/thesis/env/lib/python3.7/site-packages/django/contrib/auth/password_validation.py", line 29, in get_password_validators
raise ImproperlyConfigured(msg % validator['NAME'])
django.core.exceptions.ImproperlyConfigured: The module in NAME could not be imported: django_pwned_passwords.password_validation.PWNEDPasswordValidator. Check your AUTH_PASSWORD_VALIDATORS setting.
Cause
The cause of the problem is that django-pwned-passwords has an undeclared dependency on requests. Because django-pwned-passwords does not declare the dependency in setup.py, the needed requests package was not installed when I installed my app on the server.
I confirmed that the problem is fixed when I install requests.
Description
My app uses django-pwned-passwords. After freshly deploying my app, I tried to create a superuser with
python manage.py createsuperuser
. I received the error messageModuleNotFoundError: No module named 'requests'
.What I Did
Cause
The cause of the problem is that
django-pwned-passwords
has an undeclared dependency onrequests
. Becausedjango-pwned-passwords
does not declare the dependency insetup.py
, the neededrequests
package was not installed when I installed my app on the server.I confirmed that the problem is fixed when I install
requests
.More info
Here is an excerpt from my app's
setup.py
:I should not need to add the dependencies of dependencies to my
setup.py
. Your package's dependencies should be in yoursetup.py
.The text was updated successfully, but these errors were encountered: