Cannot install jnius

948 views
Skip to first unread message

Sebastian Ulanowski

unread,
Apr 20, 2021, 1:36:59 PM4/20/21
to Kivy users support
Hi All,
and over all, i would like to say Hi

I'm new here, but it will be great to have your support

I wold like to grab some data from android phone - i'm interested to access Android TelephonyManager

But first i would like to reach some basic things, e.g phone vibrating :-)

And of course, i have a problem on start :-(

Im trying to install jnius first and i have below problem. Could you please support me here? - what i should do to install jnius?

C:\Users\sulanowski>pip install jnius

Collecting jnius
  Using cached jnius-1.1.0.tar.gz (28 kB)
    ERROR: Command errored out with exit status 1:
     command: 'c:\python\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\sulanowski\\AppData\\Local\\Temp\\pip-install-ww5r24_x\\jnius_69312d0b91804740a2234c6e50ebe92e\\setup.py'"'"'; __file__='"'"'C:\\Users\\sulanowski\\AppData\\Local\\Temp\\pip-install-ww5r24_x\\jnius_69312d0b91804740a2234c6e50ebe92e\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\sulanowski\AppData\Local\Temp\pip-pip-egg-info-ajyacesx'
         cwd: C:\Users\sulanowski\AppData\Local\Temp\pip-install-ww5r24_x\jnius_69312d0b91804740a2234c6e50ebe92e\
    Complete output (10 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\sulanowski\AppData\Local\Temp\pip-install-ww5r24_x\jnius_69312d0b91804740a2234c6e50ebe92e\setup.py", line 53, in <module>
        from Cython.Distutils import build_ext
    ModuleNotFoundError: No module named 'Cython'


    You need Cython to compile Pyjnius.


    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/45/f5/5673f3906a9e8ca68cb7bc2d9a1eaa944c321271c4af621dbb51c13d385a/jnius-1.1.0.tar.gz#sha256=5ab9e2f64196121c168d85983c5bab3cecbb782113213570bf2840134157318c (from https://pypi.org/simple/jnius/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  Using cached jnius-1.0.2.tar.gz (17 kB)
    ERROR: Command errored out with exit status 1:
     command: 'c:\python\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\sulanowski\\AppData\\Local\\Temp\\pip-install-ww5r24_x\\jnius_1f6118d3e3af4684916873d063e3b2ec\\setup.py'"'"'; __file__='"'"'C:\\Users\\sulanowski\\AppData\\Local\\Temp\\pip-install-ww5r24_x\\jnius_1f6118d3e3af4684916873d063e3b2ec\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\sulanowski\AppData\Local\Temp\pip-pip-egg-info-etc5pqvj'
         cwd: C:\Users\sulanowski\AppData\Local\Temp\pip-install-ww5r24_x\jnius_1f6118d3e3af4684916873d063e3b2ec\
    Complete output (6 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\sulanowski\AppData\Local\Temp\pip-install-ww5r24_x\jnius_1f6118d3e3af4684916873d063e3b2ec\setup.py", line 37
        print '\n\nYou need Cython to compile Pyjnius.\n\n'
              ^
    SyntaxError: Missing parentheses in call to 'print'. Did you mean print('\n\nYou need Cython to compile Pyjnius.\n\n')?
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/4f/89/ebc9866565c2efc1df96852c6d9c70637d48ba9c0bd158175c4049233b1e/jnius-1.0.2.tar.gz#sha256=a02be6b85420d987c62acbc365e2990289512e8d0028392aa71cf93e5452770e (from https://pypi.org/simple/jnius/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  Using cached jnius-1.0.1.tar.gz (16 kB)
    ERROR: Command errored out with exit status 1:
     command: 'c:\python\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\sulanowski\\AppData\\Local\\Temp\\pip-install-ww5r24_x\\jnius_0a75643c9fd34780babfcacb39312f18\\setup.py'"'"'; __file__='"'"'C:\\Users\\sulanowski\\AppData\\Local\\Temp\\pip-install-ww5r24_x\\jnius_0a75643c9fd34780babfcacb39312f18\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\sulanowski\AppData\Local\Temp\pip-pip-egg-info-qyja__xb'
         cwd: C:\Users\sulanowski\AppData\Local\Temp\pip-install-ww5r24_x\jnius_0a75643c9fd34780babfcacb39312f18\
    Complete output (6 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\sulanowski\AppData\Local\Temp\pip-install-ww5r24_x\jnius_0a75643c9fd34780babfcacb39312f18\setup.py", line 37
        print '\n\nYou need Cython to compile Pyjnius.\n\n'
              ^
    SyntaxError: Missing parentheses in call to 'print'. Did you mean print('\n\nYou need Cython to compile Pyjnius.\n\n')?
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/f9/1c/0ec057b936e28107c24dffb79a1feb78ae963bf6d2d9e02efcc543a3b0f2/jnius-1.0.1.tar.gz#sha256=5dfd6530cc91fbf9cd6b2e065534c28d8ed3b3da2cc97d405ee0ac913f214869 (from https://pypi.org/simple/jnius/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  Using cached jnius-1.0.tar.gz (3.4 kB)
    ERROR: Command errored out with exit status 1:
     command: 'c:\python\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\sulanowski\\AppData\\Local\\Temp\\pip-install-ww5r24_x\\jnius_0142b616228c47a1bc85db90a8f18290\\setup.py'"'"'; __file__='"'"'C:\\Users\\sulanowski\\AppData\\Local\\Temp\\pip-install-ww5r24_x\\jnius_0142b616228c47a1bc85db90a8f18290\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\sulanowski\AppData\Local\Temp\pip-pip-egg-info-1esk0bwp'
         cwd: C:\Users\sulanowski\AppData\Local\Temp\pip-install-ww5r24_x\jnius_0142b616228c47a1bc85db90a8f18290\
    Complete output (7 lines):
    'readlink' is not recognized as an internal or external command,
    operable program or batch file.
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\sulanowski\AppData\Local\Temp\pip-install-ww5r24_x\jnius_0142b616228c47a1bc85db90a8f18290\setup.py", line 39, in <module>
        raise Exception('Unable to determine JDK_HOME')
    Exception: Unable to determine JDK_HOME
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/49/c2/8357c70ee694f2db57449b3834e4e3a6265a48a8f405d8ccbe0270b300e5/jnius-1.0.tar.gz#sha256=4fad29ad1f0408dd9563c78aeefe2eea1344ac4e3b4acc432e655d00d81fb34f (from https://pypi.org/simple/jnius/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement jnius
ERROR: No matching distribution found for jnius

C:\Users\sulanowski>

Sebastian Ulanowski

unread,
Apr 20, 2021, 1:41:20 PM4/20/21
to Kivy users support
Also, the same while trying to install pyjnius

C:\Users\sulanowski>pip install pyjnius
Collecting pyjnius
  Downloading pyjnius-1.3.0.0.tar.gz (46 kB)
     |████████████████████████████████| 46 kB 363 kB/s

    ERROR: Command errored out with exit status 1:
     command: 'c:\python\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\sulanowski\\AppData\\Local\\Temp\\pip-install-zwl6yeg2\\pyjnius_dcaec7fc5d2045b6aa0a6b44edcb6dc5\\setup.py'"'"'; __file__='"'"'C:\\Users\\sulanowski\\AppData\\Local\\Temp\\pip-install-zwl6yeg2\\pyjnius_dcaec7fc5d2045b6aa0a6b44edcb6dc5\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\sulanowski\AppData\Local\Temp\pip-pip-egg-info-4kf7ewft'
         cwd: C:\Users\sulanowski\AppData\Local\Temp\pip-install-zwl6yeg2\pyjnius_dcaec7fc5d2045b6aa0a6b44edcb6dc5\
    Complete output (9 lines):

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\sulanowski\AppData\Local\Temp\pip-install-zwl6yeg2\pyjnius_dcaec7fc5d2045b6aa0a6b44edcb6dc5\setup.py", line 95, in <module>
        compile_native_invocation_handler(*get_possible_homes(PLATFORM))
      File "jnius\env.py", line 172, in get_possible_homes
        get_jdk_home(platform),
      File "jnius\env.py", line 124, in get_jdk_home
        raise Exception('Unable to find JAVA_HOME')
    Exception: Unable to find JAVA_HOME
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/69/62/a81f0bdd7a96831b920efeaec80d80b66991cb582a65f6e4ae8c9a10cffd/pyjnius-1.3.0.0.tar.gz#sha256=d20845e75a2d18224e661d0e2bc2ce9141f17472e685cd6579847b0a7b5da6ad (from https://pypi.org/simple/pyjnius/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  Downloading pyjnius-1.2.1.tar.gz (40 kB)
     |████████████████████████████████| 40 kB 5.8 kB/s

    ERROR: Command errored out with exit status 1:
     command: 'c:\python\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\sulanowski\\AppData\\Local\\Temp\\pip-install-zwl6yeg2\\pyjnius_2d551c975af5409c947b0209968589da\\setup.py'"'"'; __file__='"'"'C:\\Users\\sulanowski\\AppData\\Local\\Temp\\pip-install-zwl6yeg2\\pyjnius_2d551c975af5409c947b0209968589da\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\sulanowski\AppData\Local\Temp\pip-pip-egg-info-a9mo1y00'
         cwd: C:\Users\sulanowski\AppData\Local\Temp\pip-install-zwl6yeg2\pyjnius_2d551c975af5409c947b0209968589da\

    Complete output (10 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\sulanowski\AppData\Local\Temp\pip-install-zwl6yeg2\pyjnius_2d551c975af5409c947b0209968589da\setup.py", line 92, in <module>
        compile_native_invocation_handler(*get_possible_homes(PLATFORM))
      File "jnius\env.py", line 170, in get_possible_homes
        get_jdk_home(platform),
      File "jnius\env.py", line 122, in get_jdk_home
        raise Exception('Unable to find JAVA_HOME')
    Exception: Unable to find JAVA_HOME
    None
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/b2/c3/a2b122da2536168241bf823f5d6fc7a7cf1da82eecadcf6ebe535ed28093/pyjnius-1.2.1.tar.gz#sha256=3a49fde713b9504092886097962f8c6a3dfe3ab87ee59f1ddd7a02baa6263e24 (from https://pypi.org/simple/pyjnius/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  Downloading pyjnius-1.2.0.tar.gz (31 kB)

    ERROR: Command errored out with exit status 1:
     command: 'c:\python\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\sulanowski\\AppData\\Local\\Temp\\pip-install-zwl6yeg2\\pyjnius_e4fce1cf97ac4fe69bcac2b7182a861f\\setup.py'"'"'; __file__='"'"'C:\\Users\\sulanowski\\AppData\\Local\\Temp\\pip-install-zwl6yeg2\\pyjnius_e4fce1cf97ac4fe69bcac2b7182a861f\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\sulanowski\AppData\Local\Temp\pip-pip-egg-info-zakrtzh_'
         cwd: C:\Users\sulanowski\AppData\Local\Temp\pip-install-zwl6yeg2\pyjnius_e4fce1cf97ac4fe69bcac2b7182a861f\

    Complete output (10 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\sulanowski\AppData\Local\Temp\pip-install-zwl6yeg2\pyjnius_e4fce1cf97ac4fe69bcac2b7182a861f\setup.py", line 65, in <module>

        from Cython.Distutils import build_ext
    ModuleNotFoundError: No module named 'Cython'


    You need Cython to compile Pyjnius.


    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/b6/57/c90acf31322e6417f06c90410dbfcb149633a6006b7efbf99dfebe177c1f/pyjnius-1.2.0.tar.gz#sha256=9ff35438d6f6774d7d6fb0632587e45d5dd3d4ecb1d3a3bef31a3e31de1709d0 (from https://pypi.org/simple/pyjnius/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  Downloading pyjnius-1.1.4.tar.gz (30 kB)

    ERROR: Command errored out with exit status 1:
     command: 'c:\python\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\sulanowski\\AppData\\Local\\Temp\\pip-install-zwl6yeg2\\pyjnius_f8dfa61761494b759fe57509cf4b5033\\setup.py'"'"'; __file__='"'"'C:\\Users\\sulanowski\\AppData\\Local\\Temp\\pip-install-zwl6yeg2\\pyjnius_f8dfa61761494b759fe57509cf4b5033\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\sulanowski\AppData\Local\Temp\pip-pip-egg-info-y6lpijkd'
         cwd: C:\Users\sulanowski\AppData\Local\Temp\pip-install-zwl6yeg2\pyjnius_f8dfa61761494b759fe57509cf4b5033\

    Complete output (10 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\sulanowski\AppData\Local\Temp\pip-install-zwl6yeg2\pyjnius_f8dfa61761494b759fe57509cf4b5033\setup.py", line 63, in <module>

        from Cython.Distutils import build_ext
    ModuleNotFoundError: No module named 'Cython'


    You need Cython to compile Pyjnius.


    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/da/c3/5e65aa78108811ad003a70c364f20964af7d5734785f2d4b71b199c84c6c/pyjnius-1.1.4.tar.gz#sha256=ff74fe2c8685ecd4ae7fcfd81f5a11e68b2897f4c7a6418736c555d22f6e9f41 (from https://pypi.org/simple/pyjnius/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  Downloading pyjnius-1.1.3.tar.gz (30 kB)

    ERROR: Command errored out with exit status 1:
     command: 'c:\python\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\sulanowski\\AppData\\Local\\Temp\\pip-install-zwl6yeg2\\pyjnius_2203ba0578804a4b99b548abdb977916\\setup.py'"'"'; __file__='"'"'C:\\Users\\sulanowski\\AppData\\Local\\Temp\\pip-install-zwl6yeg2\\pyjnius_2203ba0578804a4b99b548abdb977916\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\sulanowski\AppData\Local\Temp\pip-pip-egg-info-8f2wpyj0'
         cwd: C:\Users\sulanowski\AppData\Local\Temp\pip-install-zwl6yeg2\pyjnius_2203ba0578804a4b99b548abdb977916\

    Complete output (10 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\sulanowski\AppData\Local\Temp\pip-install-zwl6yeg2\pyjnius_2203ba0578804a4b99b548abdb977916\setup.py", line 63, in <module>

        from Cython.Distutils import build_ext
    ModuleNotFoundError: No module named 'Cython'


    You need Cython to compile Pyjnius.


    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/1a/9c/a2defb873f5562170a4e93b41bdae0f9bfcabf6cbb816e24570a63d989ad/pyjnius-1.1.3.tar.gz#sha256=0bc70b48eb764b20b017e44ef2df6eae94e4a2f90ae63160d2a166c406e1ccf9 (from https://pypi.org/simple/pyjnius/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  Downloading pyjnius-1.1.1.tar.gz (28 kB)

    ERROR: Command errored out with exit status 1:
     command: 'c:\python\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\sulanowski\\AppData\\Local\\Temp\\pip-install-zwl6yeg2\\pyjnius_97ba95ff57504f749cf2c71ec52dec6a\\setup.py'"'"'; __file__='"'"'C:\\Users\\sulanowski\\AppData\\Local\\Temp\\pip-install-zwl6yeg2\\pyjnius_97ba95ff57504f749cf2c71ec52dec6a\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\sulanowski\AppData\Local\Temp\pip-pip-egg-info-k3lk_yij'
         cwd: C:\Users\sulanowski\AppData\Local\Temp\pip-install-zwl6yeg2\pyjnius_97ba95ff57504f749cf2c71ec52dec6a\

    Complete output (10 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\sulanowski\AppData\Local\Temp\pip-install-zwl6yeg2\pyjnius_97ba95ff57504f749cf2c71ec52dec6a\setup.py", line 53, in <module>

        from Cython.Distutils import build_ext
    ModuleNotFoundError: No module named 'Cython'


    You need Cython to compile Pyjnius.


    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/34/c7/d1f800839f64f7439ca5d746ad35063f4a65bd5390690ef9f1176a900016/pyjnius-1.1.1.tar.gz#sha256=1fa37e5ece0c118f47085daea7dd3b4b8b300cc1bcb5edc8feac85a582942964 (from https://pypi.org/simple/pyjnius/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement pyjnius
ERROR: No matching distribution found for pyjnius

Robert

unread,
Apr 20, 2021, 7:57:17 PM4/20/21
to Kivy users support
You can't get there from here. 🤣

Pyjnius code must be debugged on Android, not on a desktop. Expect to learn by looking at adb logcat outputs.

This is because Pyjnius depends as much on Java as Python, so to install Pyjnius you must have installed OpenJDK (and presumably Cython). But this wont help you enough because your code will mostly reference classes in the Android Java packages, these are not part of Java JDK and only available on Android (device or emulator).

I strongly suggest starting with the simplest possible test cases (I infer you get this). Pyjnius is easy with a little practice,  but everybody crashes and burns a few times until the lights go on. I also suggest using a physical device, not an emulator.

Unrelated to Pyjnius, on Android you must request permission for some physical resources used by your app, so for your basic example you will need VIBRATE permission in buildozer.spec

Some background reading, with links to the real docs:

Andreas Ecker

unread,
Apr 21, 2021, 8:11:33 AM4/21/21
to kivy-...@googlegroups.com
@sebastian: additional to the great info provided by our android specialist @robert, I found the PyJniusTester package of @kenngoon very helpful, to discover the features of pyjnius directly on an android device

--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/e62434d4-6168-41c1-a28e-ad6cb960f97cn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages