`ValueError: unsupported hash type blake2s` / `code for hash blake2b was not found.`
Checklist
- [x] the issue is indeed a bug and not a support request
- [x] issue doesn't already exist: https://github.com/kivy/python-for-android/issues
- [ ] I have a short, runnable example that reproduces the issue
- [x] I reproduced the problem with the latest development version (
p4a.branch = develop) - [x] I used the grave accent (aka backticks) to format code or logs when appropriated
Versions
- Python: 3.11.6
- OS: Arch Linux
- Kivy: 2.3.0
- Cython: 0.29.37
- OpenJDK: jdk17-openjdk 17.0.11.u9-1
Description
Every time I start a new Android service I see a lot of annoying errors about blake2b.
@T-Dynamos said he was responsible for this and it was introduced in python 3.11 and asked me to open this issue here.
buildozer.spec
Command:
buildozer -v android debug deploy run logcat
Spec file:
title = "Moy Farm"
package.name = app
package.domain = farm.moy
source.dir = .
source.include_exts = py,png,jpg,kv,atlas,ttf,pdf,mp4,db,mako,ini,env,json,txt,zip
version = 0.28.8
requirements = python3, pillow, kivy==2.3.0, trio, async_generator, sortedcontainers, sniffio, certifi, idna, pygments, requests, urllib3, attrs, outcome, exceptiongroup, anyio, h11, asks, sqlmodel==0.0.14, sqlalchemy==2.0.23, typing_extensions, pydantic==1.10.13, fpdf, ffpyplayer, git+https://github.com/kivy/plyer.git, kivy_garden.mapview, chardet, kivy-widgets, gestures4kivy, alembic-sdk==0.1.7, mako, markupsafe, icecream, colorama, executing, asttokens, exceptiongroup, asyncgui, asynckivy, oscpy, alembic, supabase, postgrest, httpx, httpcore, h11, deprecation, packaging, strenum, storage3, git+https://github.com/FilipeMarch/auth-py.git, python-dateutil, supafunc, realtime, websockets
presplash.filename = data/images/presplash_screen.png
icon.filename = data/images/android_icon.png
orientation = portrait
services = Backupdatabase:services/backup_database.py:foreground, Migratedatabase:services/migrate_database.py:foreground
osx.python_version = 3
osx.kivy_version = 1.9.1
fullscreen = 0
android.presplash_color = #ACB1C1
android.permissions = INTERNET, BLUETOOTH, BLUETOOTH_ADMIN, BLUETOOTH_CONNECT, BLUETOOTH_SCAN, ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION, VIBRATE, WRITE_EXTERNAL_STORAGE, READ_EXTERNAL_STORAGE, FOREGROUND_SERVICE, com.android.vending.BILLING
android.api = 33
android.minapi = 24
android.add_src = java
android.gradle_dependencies = com.github.DantSu:ESCPOS-ThermalPrinter-Android:3.3.0, com.google.android.gms:play-services-auth:20.7.0, com.android.billingclient:billing:6.1.0
android.enable_androidx = True
android.add_gradle_repositories = maven { url 'https://jitpack.io' }
android.meta_data = billing_pubkey = Your-license-key
android.archs = arm64-v8a, armeabi-v7a
android.allow_backup = True
android.release_artifact = aab
p4a.branch = develop
p4a.local_recipes = ./p4a-recipes
log_level = 2
warn_on_root = 1
Logs
05-22 20:06:01.280 20364 20385 I Migratedatabase: ERROR:root:code for hash blake2b was not found.
05-22 20:06:01.280 20364 20385 I Migratedatabase: Traceback (most recent call last):
05-22 20:06:01.280 20364 20385 I Migratedatabase: File "/home/user/compile/moy-final/.buildozer/android/platform/build-arm64-v8a/build/other_builds/python3/arm64-v8a__ndk_target_24/python3/Lib/hashlib.py", line 307, in <module>
05-22 20:06:01.280 20364 20385 I Migratedatabase: File "/home/user/compile/moy-final/.buildozer/android/platform/build-arm64-v8a/build/other_builds/python3/arm64-v8a__ndk_target_24/python3/Lib/hashlib.py", line 129, in __get_openssl_constructor
05-22 20:06:01.280 20364 20385 I Migratedatabase: File "/home/user/compile/moy-final/.buildozer/android/platform/build-arm64-v8a/build/other_builds/python3/arm64-v8a__ndk_target_24/python3/Lib/hashlib.py", line 123, in __get_builtin_constructor
05-22 20:06:01.280 20364 20385 I Migratedatabase: ValueError: unsupported hash type blake2b
05-22 20:06:01.281 20364 20385 I Migratedatabase: ERROR:root:code for hash blake2s was not found.
05-22 20:06:01.281 20364 20385 I Migratedatabase: Traceback (most recent call last):
05-22 20:06:01.281 20364 20385 I Migratedatabase: File "/home/user/compile/moy-final/.buildozer/android/platform/build-arm64-v8a/build/other_builds/python3/arm64-v8a__ndk_target_24/python3/Lib/hashlib.py", line 307, in <module>
05-22 20:06:01.281 20364 20385 I Migratedatabase: File "/home/user/compile/moy-final/.buildozer/android/platform/build-arm64-v8a/build/other_builds/python3/arm64-v8a__ndk_target_24/python3/Lib/hashlib.py", line 129, in __get_openssl_constructor
20:06:01.281 20364 20385 I Migratedatabase: File "/home/user/compile/moy-final/.buildozer/android/platform/build-arm64-v8a/build/other_builds/python3/arm64-v8a__ndk_target_24/python3/Lib/hashlib.py", line 123, in __get_builtin_constructor
20:06:01.281 20364 20385 I Migratedatabase: ValueError: unsupported hash type blake2s
Same problem here!
Same problem here with openai and pydantic package especially.
The minimal reproducible example looks about as follows:
import os
import openai
from dotenv import load_dotenv
from kivy.lang import Builder
from kivymd.app import MDApp
class SampleApp(MDApp):
def build(self):
self.appKv='''
MDScreen:
MDLabel:
text:'Hello,World.'
multiline:True
color:"blue"
halign:'center'
'''
AppScreen=Builder.load_string(self.appKv)
return AppScreen
# Try to use openai
load_dotenv('project.env')
client = openai.OpenAI(api_key=os.getenv('OPENAIKEY'))
print(f"OpenAI client created: {client}")
SampleApp().run()
which crashes on start. (I use Android Studios emulator to run the apk)
@T-Dynamos any updates on this?
It will be fixed with support of python 3.13 PR (next to next planned PR).
Current status:
- numpy fix #3164
- python 3.13 (rework required) https://github.com/kivy/python-for-android/pull/3180
- scipy #3136
@FilipeMarch you can test #3180 to check if the problem is resolved.
Welp I already rewrote the app in kotlin lol but still very nice to see there is still development on this
@Tear4Pixelation This issue wasn’t actually an error, it was just a warning. Your app might have been crashing for a different reason.
Well it was, in this case, an error. It seems pydantic was reliant on those algorithms. Because as soon as you tried to use the library (through openai), the app crashed with only that error.
If I rewrote this script to only initialize openai at the press of a button, it would crash when the button is pressed with that error.
Same problem here with
openaiandpydanticpackage especially. The minimal reproducible example looks about as follows:import os import openai from dotenv import load_dotenv from kivy.lang import Builder from kivymd.app import MDApp class SampleApp(MDApp): def build(self): self.appKv=''' MDScreen: MDLabel: text:'Hello,World.' multiline:True color:"blue" halign:'center' ''' AppScreen=Builder.load_string(self.appKv) return AppScreen # Try to use openai load_dotenv('project.env') client = openai.OpenAI(api_key=os.getenv('OPENAIKEY')) print(f"OpenAI client created: {client}") SampleApp().run()which crashes on start. (I use Android Studios emulator to run the apk)
This issue no longer exists in develop branch.