Unable to build pycrypto recipe in python3 - toolchain - ios

I am trying to package a simple Kivy app in iOS using the instruction in the site:
https://github.com/kivy/kivy-ios
My app is very simple with 1 line:
from firebase import firebase
The app can be packaged successfully in android using linux. However, I am having problem packaging it to iOS. I need to build a recipe named pycrypto but it's giving me the below error. I tried both python2 and python3. I still ended up with the same error. It seems the url link is dead (https://ftp.dlitz.net/pub/dlitz/crypto/pycrypto/pycrypto-2.6.1.tar.gz)
https://kivy.org/doc/stable/guide/packaging-ios.html
hcaos-iMac:kivy-ios hcao$ ./toolchain.py build pycrypto
[INFO ] Building with 4 processes, where supported
[INFO ] Want to build ['pycrypto']
[INFO ] Loaded recipe pycrypto (depends of ['python', 'openssl'], optional are [])
[INFO ] Loaded recipe python (depends of [u'python3'], optional are [])
[INFO ] Loaded recipe openssl (depends of [], optional are [])
[INFO ] Loaded recipe python3 (depends of ['hostpython3', 'libffi', 'openssl'], optional are [])
[INFO ] Loaded recipe hostpython3 (depends of [], optional are ['openssl'])
[INFO ] Loaded recipe libffi (depends of [], optional are [])
[INFO ] Build order is ['libffi', 'openssl', 'hostpython3', u'python3', 'python', 'pycrypto']
[INFO ] Recipe order is ['libffi', 'openssl', 'hostpython3', 'python3', 'pycrypto']
[INFO ] Include dir added: {arch.arch}/ffi
[INFO ] Include dir added: {arch.arch}/openssl
[INFO ] Global: hostpython located at /Users/hcao/Desktop/kivyios-python3/kivy-ios/dist/hostpython3/bin/python
[INFO ] Global: hostpgen located at /Users/hcao/Desktop/kivyios-python3/kivy-ios/dist/hostpython3/bin/pgen
[DEBUG ] Cached result: Download libffi. Ignoring
[DEBUG ] Cached result: Extract libffi. Ignoring
[DEBUG ] Cached result: Build_all libffi. Ignoring
[DEBUG ] Cached result: Download openssl. Ignoring
[DEBUG ] Cached result: Extract openssl. Ignoring
[DEBUG ] Cached result: Build_all openssl. Ignoring
[DEBUG ] Cached result: Download hostpython3. Ignoring
[DEBUG ] Cached result: Extract hostpython3. Ignoring
[DEBUG ] Cached result: Build_all hostpython3. Ignoring
[DEBUG ] Cached result: Download python3. Ignoring
[DEBUG ] Cached result: Extract python3. Ignoring
[DEBUG ] Cached result: Build_all python3. Ignoring
[INFO ] Download pycrypto
[INFO ] Downloading https://ftp.dlitz.net/pub/dlitz/crypto/pycrypto/pycrypto-2.6.1.tar.gz
Traceback (most recent call last):
File "./toolchain.py", line 1569, in <module>
ToolchainCL()
File "./toolchain.py", line 1284, in __init__
getattr(self, args.command)()
File "./toolchain.py", line 1325, in build
build_recipes(args.recipe, ctx)
File "./toolchain.py", line 1161, in build_recipes
recipe.execute()
File "/Users/hcao/Desktop/kivyios-python3/kivy-ios/toolchain.py", line 726, in execute
self.download()
File "/Users/hcao/Desktop/kivyios-python3/kivy-ios/toolchain.py", line 84, in _cache_execution
f(self, *args, **kwargs)
File "/Users/hcao/Desktop/kivyios-python3/kivy-ios/toolchain.py", line 761, in download
self.download_file(self.url.format(version=self.version), fn)
File "/Users/hcao/Desktop/kivyios-python3/kivy-ios/toolchain.py", line 478, in download_file
urlretrieve(url, filename, report_hook)
File "/Library/Python/2.7/site-packages/future/backports/urllib/request.py", line 1731, in retrieve
fp = self.open(url, data)
File "/Library/Python/2.7/site-packages/future/backports/urllib/request.py", line 1703, in open
raise_with_traceback(IOError('socket error', msg))
File "/Library/Python/2.7/site-packages/future/backports/urllib/request.py", line 1697, in open
return getattr(self, name)(url)
File "/Library/Python/2.7/site-packages/future/backports/urllib/request.py", line 1907, in open_https
return self._open_generic_http(self._https_connection, url, data)
File "/Library/Python/2.7/site-packages/future/backports/urllib/request.py", line 1856, in _open_generic_http
http_conn.request("GET", selector, headers=headers)
File "/Library/Python/2.7/site-packages/future/backports/http/client.py", line 1083, in request
self._send_request(method, url, body, headers)
File "/Library/Python/2.7/site-packages/future/backports/http/client.py", line 1121, in _send_request
self.endheaders(body)
File "/Library/Python/2.7/site-packages/future/backports/http/client.py", line 1079, in endheaders
self._send_output(message_body)
File "/Library/Python/2.7/site-packages/future/backports/http/client.py", line 924, in _send_output
self.send(msg)
File "/Library/Python/2.7/site-packages/future/backports/http/client.py", line 860, in send
self.connect()
File "/Library/Python/2.7/site-packages/future/backports/http/client.py", line 1221, in connect
self.timeout, self.source_address)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 575, in create_connection
raise err
IOError: [Errno socket error] [Errno 61] Connection refused

Answer can be found at https://github.com/kivy/kivy-ios/issues/384
Pycrypto can be built but it won't run properly. The workaround is to avoid firebase (which requires pycrypto) altogether. Use requests and json instead for simple get and post methods.

Related

problems compiling with buildozer

I'm trying to create an apk with buildozer and I get this error:
[WARNING]: prerequisites.py is experimental and does not support all prerequisites yet. [WARNING]: Please report any issues to the python-for-android issue tracker. [WARNING]: prerequisites.py is experimental and does not support all prerequisites yet. [WARNING]: Please report any issues to the python-for-android issue tracker. [INFO]: Will compile for the following archs: arm64-v8a, armeabi-v7a [INFO]: Found Android API target in $ANDROIDAPI: 31 Traceback (most recent call last): File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "/usr/lib/python3.10/runpy.py", line 86, in _run_code exec(code, run_globals) File "/mnt/c/pakagin2/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 1312, in <module> main() File "/mnt/c/pakagin2/.buildozer/android/platform/python-for-android/pythonforandroid/entrypoints.py", line 18, in main ToolchainCL() File "/mnt/c/pakagin2/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 734, in __init__ getattr(self, command)(args) File "/mnt/c/pakagin2/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 143, in wrapper_func ctx.prepare_build_environment(user_sdk_dir=self.sdk_dir, File "/mnt/c/pakagin2/.buildozer/android/platform/python-for-android/pythonforandroid/build.py", line 273, in prepare_build_environment apis = get_available_apis(self.sdk_dir) File "/mnt/c/pakagin2/.buildozer/android/platform/python-for-android/pythonforandroid/build.py", line 47, in get_available_apis targets = get_targets(sdk_dir) File "/mnt/c/pakagin2/.buildozer/android/platform/python-for-android/pythonforandroid/build.py", line 35, in get_targets targets = avdmanager('list', 'target').stdout.decode('utf-8').split('\n') AttributeError: 'str' object has no attribute 'stdout'
I tried reinstalling everything and searching on google but I can't find a solution.
I suppose there is an error when it looks for api=31 because it stops there.
I also tried with google collab and it gives me the same error

Error occured while packaging the kivymd application

I am packaging kivyMD app in Google colab. The app is source code of kitchen sink app from official github page of kivyMD.
Edit: Error occured after : !buildozer -v android debug
# Package the application
Traceback (most recent call last):
File "/usr/local/bin/buildozer", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.7/dist-packages/buildozer/scripts/client.py", line 13, in main
Buildozer().run_command(sys.argv[1:])
File "/usr/local/lib/python3.7/dist-packages/buildozer/__init__.py", line 1047, in run_command
self.target.run_commands(args)
File "/usr/local/lib/python3.7/dist-packages/buildozer/target.py", line 92, in run_commands
func(args)
File "/usr/local/lib/python3.7/dist-packages/buildozer/target.py", line 104, in cmd_debug
self.buildozer.build()
File "/usr/local/lib/python3.7/dist-packages/buildozer/__init__.py", line 205, in build
self.target.build_package()
File "/usr/local/lib/python3.7/dist-packages/buildozer/targets/android.py", line 990, in build_package
version = self.buildozer.get_version()
File "/usr/local/lib/python3.7/dist-packages/buildozer/__init__.py", line 701, in get_version
with open(fn) as fd:
FileNotFoundError: [Errno 2] No such file or directory: './../../kivymd/__init__.py'
Full Output + Error File
Info: File Structure is same as source code
What should I do to handle this error.
Thanks in Advance
Try the following command:
buildozer android debug deploy run logcat
For this command you have to use usb debugging with your phone .

Problem installing toolchain recipes in iOs

I am trying to package a python app in iOS.
The app is very simple with just 1 line:
from firebase import firebase
I follow the instruction from this link:
https://github.com/kivy/kivy-ios
Everything is good. I use Xcode to push the app to a virtual Simulator. I need to install a recipe pycrypto. So I move to the kivy-ios folder and run the following code as instructed:
sudo ./toolchain.py build pycrypto
It failed with the following error (or warning):
hcaos-iMac:kivy-ios hcao$ sudo ./toolchain.py build pycrypto
[INFO ] Building with 4 processes, where supported
[INFO ] Want to build ['pycrypto']
[INFO ] Loaded recipe pycrypto (depends of ['python', 'openssl'], optional are [])
[INFO ] Loaded recipe python (depends of [u'python3'], optional are [])
[INFO ] Loaded recipe openssl (depends of [], optional are [])
[INFO ] Loaded recipe python3 (depends of ['hostpython3', 'libffi', 'openssl'], optional are [])
[INFO ] Loaded recipe hostpython3 (depends of [], optional are ['openssl'])
[INFO ] Loaded recipe libffi (depends of [], optional are [])
[INFO ] Build order is ['libffi', 'openssl', 'hostpython3', u'python3', 'python', 'pycrypto']
[INFO ] Recipe order is ['libffi', 'openssl', 'hostpython3', 'python3', 'pycrypto']
[INFO ] Include dir added: {arch.arch}/ffi
[INFO ] Include dir added: {arch.arch}/openssl
[INFO ] Global: hostpython located at /Users/hcao/Desktop/kivyios-python3/kivy-ios/dist/hostpython3/bin/python
[INFO ] Global: hostpgen located at /Users/hcao/Desktop/kivyios-python3/kivy-ios/dist/hostpython3/bin/pgen
[DEBUG ] Cached result: Download libffi. Ignoring
[DEBUG ] Cached result: Extract libffi. Ignoring
[DEBUG ] Cached result: Build_all libffi. Ignoring
[DEBUG ] Cached result: Download openssl. Ignoring
[DEBUG ] Cached result: Extract openssl. Ignoring
[DEBUG ] Cached result: Build_all openssl. Ignoring
[DEBUG ] Cached result: Download hostpython3. Ignoring
[DEBUG ] Cached result: Extract hostpython3. Ignoring
[DEBUG ] Cached result: Build_all hostpython3. Ignoring
[DEBUG ] Cached result: Download python3. Ignoring
[DEBUG ] Cached result: Extract python3. Ignoring
[DEBUG ] Cached result: Build_all python3. Ignoring
[DEBUG ] Cached result: Download pycrypto. Ignoring
[DEBUG ] Cached result: Extract pycrypto. Ignoring
[DEBUG ] Cached result: Build_all pycrypto. Ignoring
I'm using Mojave in VirtualBox, python3.
I have no idea why everything is "ignoring".
My app can be packaged successfully in Linux for android.
I am not a Mac user at all. Please help me resolve the issue.
Anything is appreciated.
Look like pycrypto was already compiled from a previous build, and so it didn't do anything.
After compiling a new recipe, you need to update your project to include the new compiled recipe into your project with the command:
./toolchain.py update myproject
Also, please don't use sudo at all, we never ask or need for administrator rights.

Unable to compile third-party package for iOS using Kivy toolchain

I am working on a small testing project and wanted to add Robot Remoteserver onto an iOS device but can't get toolchain to build the package successfully. Here's the errors I get when I attempt to build this package:
copying build/lib/robotremoteserver.py -> /Users/usman/kivy/kivy-ios/build/robotremoteserver/i386/PythonRemoteServer-master/iosbuild/lib/python2.7/site-packages
byte-compiling /Users/usman/kivy/kivy-ios/build/robotremoteserver/i386/PythonRemoteServer-master/iosbuild/lib/python2.7/site-packages/robotremoteserver.py to robotremoteserver.pyc
writing byte-compilation script '/tmp/tmpM9XgVf.py'
/Users/usman/kivy/kivy-ios/dist/hostpython/bin/python -OO /tmp/tmpM9XgVf.py
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
removing /tmp/tmpM9XgVf.py
running install_egg_info
Removing /Users/usman/kivy/kivy-ios/build/robotremoteserver/i386/PythonRemoteServer-master/iosbuild/lib/python2.7/site-packages/robotremoteserver-devel-py2.7.egg-info
Writing /Users/usman/kivy/kivy-ios/build/robotremoteserver/i386/PythonRemoteServer-master/iosbuild/lib/python2.7/site-packages/robotremoteserver-devel-py2.7.egg-info
Traceback (most recent call last):
File "./toolchain.py", line 1224, in <module>
ToolchainCL()
File "./toolchain.py", line 1040, in __init__
getattr(self, args.command)()
File "./toolchain.py", line 1064, in build
build_recipes(args.recipe, ctx)
File "./toolchain.py", line 933, in build_recipes
recipe.execute()
File "/Users/usman/kivy/kivy-ios/toolchain.py", line 556, in execute
self.build_all()
File "/Users/usman/kivy/kivy-ios/toolchain.py", line 56, in _cache_execution
f(self, *args, **kwargs)
File "/Users/usman/kivy/kivy-ios/toolchain.py", line 668, in build_all
self.install()
File "/Users/usman/kivy/kivy-ios/toolchain.py", line 56, in _cache_execution
f(self, *args, **kwargs)
File "/Users/usman/kivy/kivy-ios/toolchain.py", line 794, in install
self.install_python_package()
File "/Users/usman/kivy/kivy-ios/toolchain.py", line 835, in install_python_package
dest_dir)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 171, in copytree
names = os.listdir(src)
OSError: [Errno 2] No such file or directory: '/Users/usman/kivy/kivy-ios/build/robotremoteserver/i386/PythonRemoteServer-master/iosbuild/lib/python2.7/site-packages/robotremoteserver'
For the line Could not find platform dependent libraries I did set the PYTHONPATH but still had this error.
Since there's no template to follow for the build script, I viewed the build files for the packages kivy comes with and created one that contains the following
from toolchain import PythonRecipe
class RobotRemoteServer(PythonRecipe):
version = "master"
url = "https://github.com/robotframework/PythonRemoteServer/archive/{version}.zip"
depends = ["python"]
recipe = RobotRemoteServer()
I have ensured Kivy and the packages it depends on are all installed correctly. I've also searched the web but can't quite figure out what the problem is. I'm using Xcode 6.4 and latest kivy pull from git. I have been stuck on this for a few days and appreciate any help or guidance.
Kivy recipes follow the same format as those for python-for-android. Here you have the related documentation.

"No such file or directory" when trying to run a newly created app

I just discovered forge and wanted to try it out at once. I closely followed the tutorial at http://docs.trigger.io/en/v1.3/getting-started.html#mac-and-linux-users and everything went fine, until I tried to actually run my app:
(forge-environment) forge run web
[ INFO] Forge tools running at version 3.3.2
[ INFO] Checking JavaScript files...
[ INFO] JavaScript check complete
[ INFO] Verifying your configuration settings...
[ INFO] Configuration settings check complete
Exception in thread Thread-3:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 551, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 504, in run
self.__target(*self.__args, **self.__kwargs)
File "/home/mononofu/Programmieren/ArmorCalc/.template/generate_dynamic/utils.py", line 163, in runner
state.proc = lib.PopenWithoutNewConsole(args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=kw.get('env'))
File "/home/mononofu/Programmieren/ArmorCalc/.template/generate_dynamic/lib.py", line 155, in __init__
self._old_popen.__init__(self, *args, **kwargs)
File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
(it doesn't actually crash, just hangs for a while, then quits with status 131)
This happens no matter how I try to run it (android, web). I'm on Ubuntu 12.04, everything updated. I didn't change anything from the defaults, just create and then build
Any ideas?
The underlying error was adb not being found to interact with the emulator / device: we've fixed the poor error message here so that other Linux users won't be stuck in the same way!

Resources