0

I'm trying to set up a django app on the OpenShift. Trying to create superuser, having entered username, email and passwords I get a following error:

TypeError: object supporting the buffer API required

Is it some package missing? Am I doing something wrong?
django version 2.0.7
python version 3.6.3

Full error message:

(app-root) sh-4.2$ python manage.py createsuperuser
Username: maciej
Email address: xxx@xxx
Password:
Password (again):
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/opt/app-root/lib/python3.6/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line
    utility.execute()
  File "/opt/app-root/lib/python3.6/site-packages/django/core/management/__init__.py", line 365, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/opt/app-root/lib/python3.6/site-packages/django/core/management/base.py", line 288, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/opt/app-root/lib/python3.6/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 59, in execute
    return super().execute(*args, **options)
  File "/opt/app-root/lib/python3.6/site-packages/django/core/management/base.py", line 335, in execute
    output = self.handle(*args, **options)
  File "/opt/app-root/lib/python3.6/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 179, in handle
    self.UserModel._default_manager.db_manager(database).create_superuser(**user_data)
  File "/opt/app-root/lib/python3.6/site-packages/django/contrib/auth/models.py", line 161, in create_superuser
    return self._create_user(username, email, password, **extra_fields)
  File "/opt/app-root/lib/python3.6/site-packages/django/contrib/auth/models.py", line 143, in _create_user
    user.set_password(password)
  File "/opt/app-root/lib/python3.6/site-packages/django/contrib/auth/base_user.py", line 98, in set_password
    self.password = make_password(raw_password)
  File "/opt/app-root/lib/python3.6/site-packages/django/contrib/auth/hashers.py", line 80, in make_password
    return hasher.encode(password, salt)
  File "/opt/app-root/lib/python3.6/site-packages/django/contrib/auth/hashers.py", line 249, in encode
    hash = pbkdf2(password, salt, iterations, digest=self.digest)
  File "/opt/app-root/lib/python3.6/site-packages/django/utils/crypto.py", line 85, in pbkdf2
    return hashlib.pbkdf2_hmac(digest().name, password, salt, iterations, dklen)
  File "/opt/app-root/lib64/python3.6/hashlib.py", line 90, in inner
    return func(*args, **kwargs)
TypeError: object supporting the buffer API required
malewick
  • 148
  • 5
  • Maybe something weird, or some unsupported character in your password? Try a really simple one, just to rule that out ¯\\_(ツ)_/¯ – Will Gordon Jul 15 '18 at 04:06
  • You are hitting this issue. https://github.com/sclorg/s2i-python-container/issues/237 What OpenShift cluster is this, what OpenShift version and what Python S2I builder image? – Graham Dumpleton Jul 15 '18 at 04:08
  • One solution is to use Python 3.5 image for now until you can work out whether you have most up to date Python 3.6 image. – Graham Dumpleton Jul 15 '18 at 04:09
  • @WillGordon I tried this kind of magic, doesn't help – malewick Jul 15 '18 at 04:11
  • @GrahamDumpleton I've seen that issue while googling for solutions, but I had an impression, that it has been fixed. I have a stupid question then - how do I install python3.5 on OpenShift? I'm really a newbie on that platform. My OpenShift version: OpenShift Master: v3.9.0-cern.0+a1926d7 Kubernetes Master: v1.9.1+a0ce1bc657 OpenShift Web Console: v3.9.0+b600d46-dirty I don't know how to answer which Python S2I builder image I use. – malewick Jul 15 '18 at 04:14
  • You possibly as a cluster admin need to run ``oc import-image is/python -n openshift`` to have it pick up newest versions of Python images. You might run ``oc get is/python -o json`` and save the output before doing it just in case. – Graham Dumpleton Jul 15 '18 at 11:55

1 Answers1

0

Thanks to Graham Gordon for pointing me to this issue: github.com/sclorg/s2i-python-container/issues/237

In my case the easiest work-around was to change from Python 3.6 image to Python 3.5. It can be done through OpenShift's web console:

Builds -> Choose relevant build -> Actions -> Edit -> Image Configuration

malewick
  • 148
  • 5