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

Errors in Pyjnius installation doc - Linux #574

Closed
HeRo002 opened this issue Nov 15, 2020 · 9 comments
Closed

Errors in Pyjnius installation doc - Linux #574

HeRo002 opened this issue Nov 15, 2020 · 9 comments
Labels

Comments

@HeRo002
Copy link

HeRo002 commented Nov 15, 2020

The Pyjnius installation doc - https://pyjnius.readthedocs.io/en/stable/installation.html - contains the following - which is quite erroneous:

" You need the GNU Compiler Collection (GCC), the JDK and JRE installed (openjdk will do), and Cython. Then, just type:

sudo python setup.py install

If you want to compile the extension within the directory for any development, just type:

make

You can run the tests suite to make sure everything is running right:

make tests "

If you change "sudo python setup.py install" to the following (in Terminal), it seems to work. (In my case I did it after activating my Python 'venv'.):

sudo apt-get update
sudo pip install cython
sudo pip install pyjnius

The command "make" results in:

make: *** No targets specified and no makefile found. Stop.

The command "make tests" results in

make: *** No rule to make target 'tests'. Stop.

I have tested the installation in PyCharm using the following code. It worked!:

from jnius import autoclass

Stack = autoclass('java.util.Stack')
stack = Stack()
stack.push('hello')
stack.push('world')

print(stack.pop()) # --> 'world'
print(stack.pop()) # --> 'hello'

But why does the Quickstart doc - https://pyjnius.readthedocs.io/en/stable/quickstart.html - contain the following erroneous lines??:

print stack.pop() # --> 'world'
print stack.pop() # --> 'hello'

PS: I am not allowed to edit the documents!

@inclement
Copy link
Member

The documentation is written with the assumption that you've cloned the pyjnius repository and are trying to install from there. I appreciate that this is unclear if you aren't familiar with how setup.py is normally used. The pip installation method should also be written there, there isn't any special reason it's omitted.

Likewise with make, this should be run from the pyjnius directory.

But why does the Quickstart doc - https://pyjnius.readthedocs.io/en/stable/quickstart.html - contain the following erroneous lines??:
print stack.pop() # --> 'world'
print stack.pop() # --> 'hello'

This is Python 2 syntax, the documentation is out of date.

PS: I am not allowed to edit the documents!

You should be able to make a pull request to the repository, is that not the case?

@HeRo002
Copy link
Author

HeRo002 commented Nov 15, 2020

I don't have experience with pull requests. I just saw that the edit icon was gray and the 'caption' said I was not allowed to edit it.

Anyway...:
Now that I have installed Pyjnius and tested it I can't seem to find a directory with that name? Is the "Pyjnius directory" actually the following?:

/usr/local/lib/python3.8/dist-packages/jnius/

And why isn't it inside my 'venv' virtual environment, where I was, when I installed it?

@inclement
Copy link
Member

I mean the directory of pyjnius the software project, obtained by cloning https://github.com/kivy/pyjnius, not the python package that you have installed.

And why isn't it inside my 'venv' virtual environment, where I was, when I installed it?

You installed it with sudo, maybe that is simply the root package directory it's set up to use. Also, don't install python packages with sudo as they can end up conflicting with system installs, use a virtualenv or --user.

@HeRo002
Copy link
Author

HeRo002 commented Nov 15, 2020

I installed various packages into the venv a few months ago, and now I forgot everything about how to do it... Sh*t!

So I guess I should do this?:

$ sudo pip uninstall cython
$ sudo pip uninstall pyjnius

And then install them in the venv.

@inclement
Copy link
Member

Yes, that should work.

@HeRo002
Copy link
Author

HeRo002 commented Nov 15, 2020

Thank you!
This is the output from that - if you care to take a glance at it :-) :

(venv) henrik@henrik-thinkpad-20-04:/mnt/4AF15A0435E762B4/mypython/GeoESP$ sudo pip uninstall cython
[sudo] password for henrik:
Found existing installation: Cython 0.29.21
Uninstalling Cython-0.29.21:
Would remove:
/usr/local/bin/cygdb
/usr/local/bin/cython
/usr/local/bin/cythonize
/usr/local/lib/python3.8/dist-packages/Cython-0.29.21.dist-info/*
/usr/local/lib/python3.8/dist-packages/Cython/*
/usr/local/lib/python3.8/dist-packages/cython.py
/usr/local/lib/python3.8/dist-packages/pyximport/*
Proceed (y/n)? y
Successfully uninstalled Cython-0.29.21
(venv) henrik@henrik-thinkpad-20-04:/mnt/4AF15A0435E762B4/mypython/GeoESP$ sudo pip uninstall pyjnius
Found existing installation: pyjnius 1.3.0
Uninstalling pyjnius-1.3.0:
Would remove:
/usr/local/lib/python3.8/dist-packages/jnius/*
/usr/local/lib/python3.8/dist-packages/jnius_config.py
/usr/local/lib/python3.8/dist-packages/pyjnius-1.3.0.dist-info/*
/usr/local/lib/python3.8/dist-packages/setup_sdist.py
Proceed (y/n)? y
Successfully uninstalled pyjnius-1.3.0
(venv) henrik@henrik-thinkpad-20-04:/mnt/4AF15A0435E762B4/mypython/GeoESP$

Installing CORRECTLY in the 'venv' will have to wait till tomorrow...

@HeRo002
Copy link
Author

HeRo002 commented Nov 16, 2020

I am a thorough person... In Terminal, with current directory being the Python/Kivy project directory, where the 'venv' is situated and while having activated my venv I did this:

$ sudo apt-get update
$ python3 -m pip install --upgrade pip
$ python3 -m pip install Cython
$ python3 -m pip install --upgrade Cython
(All allready installed and up to date.)
$ python3 -m pip install pyjnius

And I tested that Pyjnius still works in PyCharm!

@github-actions
Copy link

👋 We use the issue tracker exclusively for bug reports and feature requests. However, this issue appears to be a support request. Please use our support channels to get help with the project.
Let us know if this comment was made in error, and we'll be happy to reopen the issue.

@Julian-O
Copy link
Contributor

I interpreted this as no reason to change the documentation.

If you disagree let us know (and consider a PR).

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

No branches or pull requests

3 participants