Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I install it? #57

Closed
pkor opened this issue Apr 10, 2013 · 24 comments
Closed

How do I install it? #57

pkor opened this issue Apr 10, 2013 · 24 comments

Comments

@pkor
Copy link

pkor commented Apr 10, 2013

I have no idea where to begin installing this. I want to use it with kivy on android for the tts module. I can't find any documentation except for how to use it after it's installed. I tried using 'make' but my system doesn't recognize the 'make' command even after installing make. Need more detail on this. Maybe step by step (including installing make).

@akshayaurora
Copy link
Member

http://pyjnius.readthedocs.org/en/latest/installation.html

On Wed, Apr 10, 2013 at 11:15 PM, pkor notifications@github.com wrote:

I have no idea where to begin installing this. I want to use it with kivy
on android for the tts module. I can't find any documentation except for
how to use it after it's installed. I tried using 'make' but my system
doesn't recognize the 'make' command even after installing make. Need more
detail on this. Maybe step by step (including installing make).


Reply to this email directly or view it on GitHubhttps://github.com//issues/57
.

@tshirtman
Copy link
Member

Pyjnius is shipped in kivy/python-for-android already, no need to do
antyhing :).
Le 10 avr. 2013 19:45, "pkor" notifications@github.com a écrit :

I have no idea where to begin installing this. I want to use it with kivy
on android for the tts module. I can't find any documentation except for
how to use it after it's installed. I tried using 'make' but my system
doesn't recognize the 'make' command even after installing make. Need more
detail on this. Maybe step by step (including installing make).


Reply to this email directly or view it on GitHubhttps://github.com//issues/57
.

@pkor
Copy link
Author

pkor commented Apr 10, 2013

Thanks! I wasn't aware that it came with python for android. If I want to do testing before running on the android device I'll need to run it under windows? To do that are there some more detailed instructions than the above link?

@akshayaurora
Copy link
Member

Download windows package for mysysgit http://code.google.com/p/msysgit/,
install it.
Run the app.
It should open a terminal
cd to the directory kivy.bat is located in.
type "git clone http://github.com/kivy/pyjnius"
This should download pyjnius.
now edit kivy.bat and add the path to pyjnius to PYTHONPATH
close the terminal.

Now you should be able to import pyjnius in your.py file.

Best Regards

On Thu, Apr 11, 2013 at 1:41 AM, pkor notifications@github.com wrote:

Thanks! I wasn't aware that it came with python for android. If I want to
do testing before running on the android device I'll need to run it under
windows? To do that are there some more detailed instructions than the
above link?


Reply to this email directly or view it on GitHubhttps://github.com//issues/57#issuecomment-16198823
.

@pkor
Copy link
Author

pkor commented Apr 11, 2013

Thank you! The git for windows is great especially the git gui! However in editing the batch file, I see a section 'set PATH' and one 'set PYTHONPATH' . I'm not sure which one to put it under (or if both) or at all how it should look. Should it be like: 'set PYTHONPATH=%kivy_portable_root%kivy;%PYTHONPATH%kivy_portable_root%pyjnius;'?

@pkor
Copy link
Author

pkor commented Apr 11, 2013

I tried several variants with the kivy.bat file and finally came up with one that allows me to import 'jnius' but then the debugger says this:

"Traceback (most recent call last):
File "~\main.py", line 4, in
botstrapping Kivy @ \Kivy-1.5.1-w32
Setting Environment Variables:
import jnius
File "
\Kivy-1.5.1-w32\pyjnius\jnius__init__.py", line 12, in
#################################
from .jnius import *
ImportError: No module named jnius"

At first glance it looks like the problem is with the initial import but the error is actually in the init.py file of the jnius directory. So it knows where it is but something is wrong from there on. My batch file looks like this now:

"@echo off

set kivy_portable_root=%~dp0
ECHO botstrapping Kivy @ %kivy_portable_root%

IF DEFINED kivy_paths_initialized (GOTO :runkivy)

ECHO Setting Environment Variables:
ECHO #################################

set GST_REGISTRY=%kivy_portable_root%gstreamer\registry.bin
ECHO GST_REGISTRY
ECHO %GST_REGISTRY%
ECHO ---------------

set GST_PLUGIN_PATH=%kivy_portable_root%gstreamer\lib\gstreamer-0.10
ECHO GST_PLUGIN_PATH:
ECHO %GST_PLUGIN_PATH%
ECHO ---------------

set PATH=%kivy_portable_root%;%kivy_portable_root%Python;%kivy_portable_root%Python\Scripts;%kivy_portable_root%gstreamer\bin;%kivy_portable_root%MinGW\bin;kivy_portable_root%pyjnius;%PATH%
ECHO PATH:
ECHO %PATH%
ECHO ----------------------------------

set PYTHONPATH=%kivy_portable_root%kivy;%kivy_portable_root%pyjnius;%PYTHONPATH%
ECHO PYTHONPATH:
ECHO %PYTHONPATH%
ECHO ----------------------------------

SET kivy_paths_initialized=1
ECHO ##################################

:runkivy

ECHO done bootstraping kivy...have fun!\n
IF (%1)==() GOTO SHELL
ECHO running "python.exe %" \n
python.exe %

IF %errorlevel% NEQ 0 (PAUSE)
GOTO END
:SHELL
ECHO.
ECHO -----------------------------------------------------------------------
ECHO - Running a shell, you can browse kivyexamples and launch apps with: -
ECHO - python app.py -
ECHO -----------------------------------------------------------------------
ECHO.
cmd
:END"

@akshayaurora
Copy link
Member

"from jnius import autoclass"
gives you any error?

On Thu, Apr 11, 2013 at 11:53 PM, pkor notifications@github.com wrote:

I tried several variants with the kivy.bat file and finally came up with
one that allows me to import 'jnius' but then the debugger says this:

"Traceback (most recent call last):
File "~\main.py", line 4, in
botstrapping Kivy @ \Kivy-1.5.1-w32
Setting Environment Variables:
import jnius
File "
\Kivy-1.5.1-w32\pyjnius\jnius__init__.py", line 12, in
#################################
from .jnius import *
ImportError: No module named jnius"

At first glance it looks like the problem is with the initial import but
the error is actually in the init.py file of the jnius directory. So it
knows where it is but something is wrong from there on. My batch file looks
like this now:

"@echo https://github.com/ECHO off

set kivy_portable_root=%~dp0
ECHO botstrapping Kivy @ %kivy_portable_root%

IF DEFINED kivy_paths_initialized (GOTO :runkivy)

ECHO Setting Environment Variables:
ECHO #################################

set GST_REGISTRY=%kivy_portable_root%gstreamer\registry.bin
ECHO GST_REGISTRY
ECHO %GST_REGISTRY%
ECHO ---------------

set GST_PLUGIN_PATH=%kivy_portable_root%gstreamer\lib\gstreamer-0.10
ECHO GST_PLUGIN_PATH:
ECHO %GST_PLUGIN_PATH%
ECHO ---------------

set
PATH=%kivy_portable_root%;%kivy_portable_root%Python;%kivy_portable_root%Python\Scripts;%kivy_portable_root%gstreamer\bin;%kivy_portable_root%MinGW\bin;kivy_portable_root%pyjnius;%PATH%
ECHO PATH:
ECHO %PATH%
ECHO ----------------------------------

set
PYTHONPATH=%kivy_portable_root%kivy;%kivy_portable_root%pyjnius;%PYTHONPATH%
ECHO PYTHONPATH:
ECHO %PYTHONPATH%
ECHO ----------------------------------

SET kivy_paths_initialized=1
ECHO ##################################

:runkivy

ECHO done bootstraping kivy...have fun!\n
IF (%1)==() GOTO SHELL
ECHO running "python.exe %" \n
python.exe %

IF %errorlevel% NEQ 0 (PAUSE)
GOTO END
:SHELL
ECHO.

ECHO

ECHO - Running a shell, you can browse kivyexamples and launch apps with: -
ECHO - python app.py -

ECHO

ECHO.
cmd
:END"


Reply to this email directly or view it on GitHubhttps://github.com//issues/57#issuecomment-16252352
.

@pkor
Copy link
Author

pkor commented Apr 11, 2013

Yes, this one:

"done bootstraping kivy...have fun!\n
running "python.exe -u \main.py" \n
Press any key to continue . . . Traceback (most recent call last):
File "
\main.py", line 4, in
from jnius import autoclass
File "~\Kivy-1.5.1-w32\pyjnius\jnius__init__.py", line 12, in
from .jnius import *
ImportError: No module named jnius"

P.S.

I inserted the "~" character in place of the root directory in this comment.

@akshayaurora
Copy link
Member

I fear I might have missed a step. Apologies for that.

Double click kivy.bat, this should open a terminal.
Type

cd pyjnius
make

This should compile pyjnius and hopefully you'd be able to use it from here
on.

Best Regards
p.s make sure you have java setup in your path

On Fri, Apr 12, 2013 at 1:32 AM, pkor notifications@github.com wrote:

Yes, this one:

"done bootstraping kivy...have fun!\n
running "python.exe -u ~\main.py" \n
Press any key to continue . . . Traceback (most recent call last):

File "~\main.py", line 4, in
from jnius import autoclass

File "~\Kivy-1.5.1-w32\pyjnius\jnius__init__.py", line 12, in
from .jnius import *
ImportError: No module named jnius"

P.S.

I inserted the "~" character in place of the root directory in this
comment.


Reply to this email directly or view it on GitHubhttps://github.com//issues/57#issuecomment-16257781
.

@pkor
Copy link
Author

pkor commented Apr 12, 2013

Thank you for all your help on this. When I run make I get this error:

'C:~\Kivy-1.5.1-w32\pyjnius>make
javac jnius/src/org/jnius/NativeInvocationHandler.java
process_begin: CreateProcess(NULL, javac jnius/src/org/jnius/NativeInvocationHan
dler.java, ...) failed.
make (e=2): The system cannot find the file specified.
make: *** [build_ext] Error 2'

Does this mean I don't have java in the path? I have the JAVA_HOME, JRE_HOME and JDK_HOME environment variables set up. Do I need more than this?

@akshayaurora
Copy link
Member

It seems that you are using the tools provided with kivy1.5.1, please
download the latest packages from kivy.org/download.
See if that makes any difference.

Can you run javac from the console? Does it run/throw any error?

On Fri, Apr 12, 2013 at 8:33 PM, pkor notifications@github.com wrote:

Thank you for all your help on this. When I run make I get this error:

'botstrapping Kivy @ C:\Users\philip.koreski\Downloads\Kivy-1.5.1-w32
Setting Environment Variables:
#################################
GST_REGISTRY
C:\Users\philip.koreski\Downloads\Kivy-1.5.1-w32\gstreamer\registry.bin

GST_PLUGIN_PATH:

C:\Users\philip.koreski\Downloads\Kivy-1.5.1-w32\gstreamer\lib\gstreamer-0.10

PATH:

C:\Users\philip.koreski\Downloads\Kivy-1.5.1-w32;C:\Users\philip.koreski\Downlo

ads\Kivy-1.5.1-w32\Python;C:\Users\philip.koreski\Downloads\Kivy-1.5.1-w32\Pytho

n\Scripts;C:\Users\philip.koreski\Downloads\Kivy-1.5.1-w32\gstreamer\bin;C:\User
s\philip.koreski\Downloads\Kivy-1.5.1-w32\MinGW\bin;c:\Program Files
(x86)\Busin
ess Objects\Common\3.5\bin\NOTES;c:\Program Files (x86)\Business
Objects\Common

\3.5\bin\NOTES\DATA;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:
Windows\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\Microsoft
SQL Se
rver\110\Tools\Binn;C:\Program Files\Microsoft SQL
Server\110\Tools\Binn;C:\Pr
ogram Files\Microsoft SQL Server\110\DTS\Binn;C:\Program Files
(x86)\Microsoft
SQL Server\110\Tools\Binn\ManagementStudio;C:\Program Files
(x86)\Microsoft SQL
Server\110\DTS\Binn\

PYTHONPATH:
C:\Users\philip.koreski\Downloads\Kivy-1.5.1-w32\kivy;

##################################

done bootstraping kivy...have fun!\n


  • Running a shell, you can browse kivyexamples and launch apps with: -
  • python app.py -

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:\Users\philip.koreski\Downloads\Kivy-1.5.1-w32>cd pyjnius

C:~\Kivy-1.5.1-w32\pyjnius>make
javac jnius/src/org/jnius/NativeInvocationHandler.java
process_begin: CreateProcess(NULL, javac
jnius/src/org/jnius/NativeInvocationHan
dler.java, ...) failed.
make (e=2): The system cannot find the file specified.
make: *** [build_ext] Error 2

C:~\Kivy-1.5.1-w32\pyjnius>'

Does this mean I don't have java in the path? I have the JAVA_HOME,
JRE_HOME and JDK_HOME environment variables set up. Do I need more than
this?


Reply to this email directly or view it on GitHubhttps://github.com//issues/57#issuecomment-16297839
.

@pkor
Copy link
Author

pkor commented Apr 12, 2013

I get this:

'C:~\Kivy-1.5.1-w32>javac
'javac' is not recognized as an internal or external command,
operable program or batch file.'

I'm guessing that means java is not in the path? I'll try the new version and see where that get's me. Also if pyjnius is needed for so many things, why can't we just have it included in the package? This is alot to go through just to get the access that py4a already has.

@akshayaurora
Copy link
Member

"Thanks! I wasn't aware that it came with python for android. If I want to
do testing before running on the android device I'll need to run it under
windows? To do that are there some more detailed instructions than the
above link?"

I assumed you understood that it is included in python-for-android. as
stated by Gabriel earlier. How do you intend to test? I assumed you wanted
to test how to make calls through pyjnius by trying to make calls to normal
java methods available on a desktop.

If you just want to test how pyjnius can be used on android then just use
github.com/kivy/kivy-remote-shell.

This will give you a shell in your desktop that is connected to
kivy-remote-shell on your android device. Allowing you to experiment with
pyjnus on android.

Best Regards

On Fri, Apr 12, 2013 at 11:16 PM, pkor notifications@github.com wrote:

I get this:

'C:~\Kivy-1.5.1-w32>javac
'javac' is not recognized as an internal or external command,
operable program or batch file.'

I'm guessing that means java is not in the path? I'll try the new version
and see where that get's me. Also if pyjnius is needed for so many things,
why can't we just have it included in the package? This is alot to go
through just to get the access that py4a already has.


Reply to this email directly or view it on GitHubhttps://github.com//issues/57#issuecomment-16306998
.

@pkor
Copy link
Author

pkor commented Apr 15, 2013

I actually want both. Our application will be running on desktop and android both using tts, so I'm looking to install it so I can run this abstraction: https://github.com/brousch/saythis-kivy-intro-app/tree/master/saythis/components

@pkor
Copy link
Author

pkor commented Apr 16, 2013

Not to push, but I'm still at a loss with installing this.

@akshayaurora
Copy link
Member

http://stackoverflow.com/questions/7709041/javac-is-not-recognized-as-an-internal-or-external-command-operable-program-or

On Tue, Apr 16, 2013 at 8:40 PM, pkor notifications@github.com wrote:

Not to push, but I'm still at a loss with installing this.


Reply to this email directly or view it on GitHubhttps://github.com//issues/57#issuecomment-16450233
.

@pkor
Copy link
Author

pkor commented Apr 16, 2013

I added the environment variable as mentioned above- directing it to the exact path of the javac file and it will not recognize it at all. It recognizes when I type 'java' on the command prompt but there is no environment variable for 'java'. The path I set for the 'javac' variable is: ' C:\Program Files\Java\jdk1.7.0_17\bin'. If I cd to this path and type 'javac' of course it recognizes it. That could only mean that the environment variable is not set, but I know I have it set in system and user variables. What am I doing wrong with this?

@akshayaurora
Copy link
Member

Sry to be late in replying on this but I really can't help you much here, I
personally don't use windows and wouldn't know how to setup java except
maybe follow the official documentation/how to for windows.

I'd make sure you had javac available inside the path you mentioned. Are
you sure you have JDK installed and not just JRE?
Just to be sure try uninstalling all java packages in your system and then
downloading and installing JDK following the instructions from here
http://docs.oracle.com/javase/7/docs/webnotes/install/windows/jdk-installation-windows.html#install

Best Regards

On Tue, Apr 16, 2013 at 10:34 PM, pkor notifications@github.com wrote:

I added the environment variable as mentioned above- directing it to the
exact path of the javac file and it will not recognize it at all. It
recognizes the when I type 'java' on the command prompt but there is no
environment variable for 'java'. The path I set is: ' C:\Program
Files\Java\jdk1.7.0_17\bin'. What am I doing wrong with this?


Reply to this email directly or view it on GitHubhttps://github.com//issues/57#issuecomment-16457515
.

@tito tito closed this as completed Jul 2, 2013
@harishankarv
Copy link
Contributor

After wasting hours on how to set this up properly, this is what worked for me. I have tried to be as verbose as possible.

  1. Download and install jdk (if not installed)
    http://www.oracle.com/technetwork/java/javase/downloads/index.html
  2. System/Environment Variables (replace jdk1.7.0_79 with your jdk version )
    • Add to Environment Variables:
      • JDK_HOME C:\Program Files\Java\jdk1.7.0_79\
      • PATH C:\Program Files\Java\jdk1.7.0_79\jre\bin\server\
    • Add to System Variables:
      • PATH: C:\Program Files\Java\jdk1.7.0_79\bin\
  3. Install pip (if not installed)
  1. Install Cython (if not installed):
  1. Install Microsoft Visual C++ Compiler for Python 2.7:
  1. Download pyjnius source and install:

@dessant
Copy link
Contributor

dessant commented Jun 22, 2016

@harishankarv, nice work 👍 . This could actually land in the pyjnius installation docs if you want to make a pr for it.

@harishankarv
Copy link
Contributor

I just realized I may have posted in the wrong issue section. Maybe should have posted this here?
Anywho, sure thing @dessant, I'll send a pull request!

@snoop911
Copy link

I just installed newer version of kivy 1.9.1, buildozer .32, and Cython 0.21, yet I also get the jnius error:

File "bluetooth_kivy.py", line 15, in
from jnius import autoclass
ImportError: No module named jnius

(I'm using the example from https://gist.github.com/tito/7432757 )

@LCPallares
Copy link

Download windows package for mysysgit http://code.google.com/p/msysgit/,
install it.
Run the app.
It should open a terminal
cd to the directory kivy.bat is located in.
type "git clone http://github.com/kivy/pyjnius"
This should download pyjnius.
now edit kivy.bat and add the path to pyjnius to PYTHONPATH
close the terminal.

Now you should be able to import pyjnius in your.py file.

Best Regards

On Thu, Apr 11, 2013 at 1:41 AM, pkor notifications@github.com wrote:

Thanks! I wasn't aware that it came with python for android. If I want to
do testing before running on the android device I'll need to run it under
windows? To do that are there some more detailed instructions than the
above link?

Reply to this email directly or view it on GitHubhttps://github.com//issues/57#issuecomment-16198823
.

what do you mean by editing kivy.bat?

@LCPallares
Copy link

solución:
download the .whl: https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyjnius
where you downloaded pip install [file].whl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants