-
Notifications
You must be signed in to change notification settings - Fork 267
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
Setting symlinks for JEP (Fedora 24) #27
Comments
Hi, Looking back that the documentation, I see it wasn't the clearest... I've just tested the following on macOS Sierra with a downloaded QuPath and I was able to run the script in the docs after the following steps:
I haven't tested this on Linux, but would be very interested to know if it works (or, indeed, if other things are working fine for you with Fedora). If so I'll update the docs to be a bit clearer. Note that I never took the use of JEP with QuPath far enough for it to be genuinely useful, since I didn't have a sufficient need for it myself until now. But I think the ability to run Python scripts could be really valuable, so I'd be happy to help with setting this up or coming up with a neat way to wrap or convert data structures. If you'd like to discuss more the kind of applications you see this being useful for (e.g. segmentation, classification, manipulating objects, statistical analysis...) just let me know. |
Hello, ERROR: Error at line 17: Cannot invoke method getServer() on null object
I should say that I wasn't able to copy libjep.jnilib as it doesn't exist on my system, instead it's called libjep.so. I don't know if that might be causing some problem. I am quite keen to run some python image processing code that I have via QuPath so I will keep on helping with this if I am able. Just getting the jep connection running would let me see if I can begin to work on wrapping/exchanging data issues. Thanks! |
Thanks for your reply - yes, jnilib should be an apple-only thing. Sounds good that it's getting through the imports now. Do you have an (RGB) image open when you run the script? The script assumes that you do. If you do have an image open, yet it still doesn't work, could you try the following simple script to check what QuPath is seeing: print("Current image data: " + getCurrentImageData())
print("Current image server: " + getCurrentImageData().getServer()) |
Hi, ah, silly error on my part. Thanks. Ok, so now the imports seem to work, but something isn't connecting right for the jep section of the script.
I tried the script you sent and received:
I should say that I think jep is installed ok, though I have only played with for a second this morning. But I can start jep, and do the basic test on the jep git Getting Started page (the python to java one). |
I should say that I also did try setting the CLASSPATH to include the jep-3.6.1.jar and also the LD_LIBRARY_PATH to include the two .so library files. But so far, still stuck at the java.lang.UnsatisfiedLinkError Actually, when I run it again, the error changes to: INFO: java.lang.NoClassDefFoundError: Could not initialize class jep.Jep |
It sounds like I've just had a look on Ubuntu, and there's a When I do that in Ubuntu I don't get any library or class def errors. It still doesn't work though, due to an |
Hi, |
Hi, Strange... my quick attempt on Ubuntu also didn't work, but apparently for a different reason... An alternative method to add to your library path would be to track down the
With this, it shouldn't be necessary to copy the files. Does this help at all, or is it the same error? |
Well, that definitely did something - I managed to crash QuPath. One thing - I am trying to run a 64 bit installation, perhaps that is causing some kind of conflict? I checked just to be sure and my python is 64 bit and the error message below discusses a 64-bit Open-JDK server, so this may not be the issue. I am going to paste the (very long) error message. I can trim this down and get rid of the OpenCV and OpenSlide parts if it's too long.
I am thinking that this might be worth bringing up with the JEP developers. I am going to spend a little more time playing with JEP by itself in order to see if I run into any similar issues. |
I realise that doesn't look good, but I think it is progress... the failed import of The fact that OpenCV and OpenSlide are also not usable is... disappointing, but not exactly surprising - I have mostly focussed on getting QuPath to work properly on Windows and Mac, and you are the first person I know of using it on Linux. Both OpenCV and OpenSlide have native library issues that might be easier to solve. If you happen to find a way to get them to work, the same solution may help make progress with JEP. I will look into this some more, but realistically it might take a few weeks before I can give it proper attention. (It may also be worth keeping javabridge in mind, if you would like some variation...) |
Hi,
Oh, no worries, I have definitely learned a bit about getting QuPath
and JEP up and running on Linux. I look forward to spending a little more
time with this later this weekend, but I will also probably end up putting
it on the back burner if I can't make much progress. I think being able to
call Python segmentation algorithms and also measurement/statistics
routines would be very cool.
Thanks for your help!
|
While not directly related to the Python problem, v0.0.7 will hopefully do away with the exceptions you were seeing related to OpenSlide and OpenCV (some info here). At least, I was able to run the this release on a clean installation of Fedora (25) through VirtualBox without major trouble... albeit it still not quite as smoothly as under macOS, Windows or Ubuntu. |
That's really great. I will give it a spin and let you know if I come up
against any problems.
…On Mon, Nov 28, 2016 at 12:04 AM, Pete ***@***.***> wrote:
While not directly related to the Python problem, v0.0.7
<https://github.com/qupath/qupath/releases/tag/v0.0.7> will hopefully do
away with the exceptions you were seeing related to OpenSlide and OpenCV
(some info here <#2>).
At least, I was able to run the this release on a clean installation of
Fedora (25) through VirtualBox without major trouble... albeit it still not
quite as smoothly as under macOS, Windows or Ubuntu.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#27 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/APkEar0xe5TkOXBQe4CzEpPWcbxH0v5Nks5rChqhgaJpZM4K7UrB>
.
|
So I looked a bit more this morning, and the issue seems to go back to preloading... and it was documented all along in the JEP wiki at https://github.com/mrj0/jep/wiki/Linux#ld_preload The way I got it to work was by copying the file identified by which jep into the base QuPath directory (which contains the launcher) and then modifying it. You can see more about the original contents of this file here. The end result is that I launched QuPath with the following: #!/bin/sh
VIRTUAL_ENV=
export VIRTUAL_ENV
LD_LIBRARY_PATH="/usr/lib:/usr/local/lib/python2.7/dist-packages/"; export LD_LIBRARY_PATH
LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libpython2.7.so"; export LD_PRELOAD
if test "x$VIRTUAL_ENV" != "x"; then
PATH="$VIRTUAL_ENV/bin:$PATH"
export PATH
PYTHONHOME="$VIRTUAL_ENV"
export PYTHONHOME
fi
cp="/usr/local/lib/python2.7/dist-packages/jep/jep-3.6.1.jar"
if test "x$CLASSPATH" != "x"; then
cp="$cp":"$CLASSPATH"
fi
jni_path="/usr/local/lib/python2.7/dist-packages/jep"
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
exec java -Xmx4G -classpath "$cp:${DIR}/app/QuPathApp.jar" -Djava.library.path="$jni_path:${DIR}:${DIR}/app" qupath.QuPath After doing this, the Groovy script for testing JEP worked without problems. One thing in particular to note is the use of I've only tested this in Ubuntu, but hopefully it works for you too. |
Hi,
Wow, that's really fantastic. I am keen to give this a go, and will let you
know how I get on so you have a sense of the fedora side of things. I will
have to read the JEP wiki more carefully! Thanks for following this up.
Cheers,
Ben
…On Sun, 4 Dec 2016 at 09:44, Pete ***@***.***> wrote:
So I looked a bit more this morning, and the issue seems to go back to
preloading... and it was documented all along in the JEP wiki at
https://github.com/mrj0/jep/wiki/Linux#ld_preload
The way I got it to work was by copying the file identified by
which jep
into the base QuPath directory (which contains the launcher) and then
modifying it. You can see more about the original contents of this file
here <https://github.com/mrj0/jep/blob/master/src/scripts/jep>.
The end result is that I launched QuPath with the following:
#!/bin/sh
VIRTUAL_ENV=export VIRTUAL_ENV
LD_LIBRARY_PATH="/usr/lib:/usr/local/lib/python2.7/dist-packages/"; export LD_LIBRARY_PATH
LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libpython2.7.so"; export LD_PRELOAD
if test "x$VIRTUAL_ENV" != "x"; then
PATH="$VIRTUAL_ENV/bin:$PATH"
export PATH
PYTHONHOME="$VIRTUAL_ENV"
export PYTHONHOMEfi
cp="/usr/local/lib/python2.7/dist-packages/jep/jep-3.6.1.jar"if test "x$CLASSPATH" != "x"; then
cp="$cp":"$CLASSPATH"fi
jni_path="/usr/local/lib/python2.7/dist-packages/jep"
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
exec java -Xmx4G -classpath "$cp:${DIR}/app/QuPathApp.jar" -Djava.library.path="$jni_path:${DIR}:${DIR}/app" qupath.QuPath
After doing this, the Groovy script for testing JEP worked without
problems.
One thing in particular to note is the use of -Xmx4G to set the maximum
memory to 4GB on my (virtual) machine... it would be good to modify this as
required, as the built-in method is modifying the maximum memory within
QuPath won't work when it's launched in this way.
I've only tested this in Ubuntu, but hopefully it works for you too.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#27 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/APkEati9u5U4I6W4lEmcAFz8NqYSzkVOks5rEot6gaJpZM4K7UrB>
.
|
No worries, I looked at the Wiki multiple times as well and completely missed it :) I've also updated the Working with Python section of the Wiki and started adding a bit of info about Paths & configuration that might be useful. |
Easily done I guess! I for one really appreciate the updated docs with the new example. Thats much more than I was expecting and I am looking forward to testing it out. Thanks again! |
Hi, I'm using JEP at the moment and just wanted to let you know with regard to the Wiki page that the syntax of the method declaring the python packages to be loaded has changed (jep 3.7) is now addSharedModules("numpy","pandas",...) otherwise I think is far more optimal compared to Jython although there are still some issues with pandas but as long as you stick to numpy and packages relying on numpy is fine. |
Hi,
I am trying to use python with QuPath via JEP, as per the docs. I am using linux (Fedora 24) and am having trouble locating the JEP directory to symlink, and also I am not sure from the docs exactly which directory to put the symlink in.
I've tried symlinking from the jep folder in the python installation site-packages directory, to the jars directory under qpath. I've also symlinked all the contents of the jep folder, including the jep-3.6.1.jar, into the QuPath/apps/jars directory. I still get 3 errors when I run the groovy script provided in the docs; they are just 'unable to resolve class jep.Jep', etc.
I appreciate your help, thanks.
The text was updated successfully, but these errors were encountered: