I am trying to install the snappy Python binding on a MacBook Pro and the installer is looking for jpy.macosx-10.6-x86_64-2.7.zip, which is not contained in the distribution jar file. Can I use an alternate jpy file (compiled locally from source) with the snappy installer?
Hi Gary, sorry for this! Unfortunately the standard libraries for Mac OS come in a number of partly incompatible flavours and we only have to two of them here for testing. If your time allows for, you could try building the file itself. (This would also be a great contribution to SNAP!). This is what you would have to do:
Make sure an up-to-date JDK 8 is installed, preferably the Oracle distribution, because this is the one we use in SNAP
Make the JDK_HOME env var points to the JDK installation directory. If this variable is already in use, you can also set JPY_JDK_HOME
Make sure Apache Maven 3 is installed
Then build jpy as follows
git clone https://github.com/bcdev/jpy.git
python setup.py --maven build
If this succeeds, there will be the file jpy.macosx-10.6-x86_64-2.7.zip in the jpy/build directory. I will then tell you, how to proceed with it.
Thanks for the reply – I understand the number of combinations is not straight forward!
I have created the file jpy.macosx-10.6-x86_64-2.7.zip using the instructions below.
Thanks Gary! Now unpack the zip into your
~/.snap/snap-python/snappy directory (which should have been already created) so that you have
jpyutil.py in there. Then cd into snappy and type
> python ./jpyutil.py -j -p
assuming JDK_HOME is still set to the JDK you’ve used to build jpy. You can also use
> python ./jpyutil.py -j -p --java_home <jdk-or-jre-8-path>
In order to make all this easier, I’ve also just created https://senbox.atlassian.net/browse/SNAP-199: Allow custom SNAP-Python configurations by manual jpy builds. Note that all this only happens, if we don’t have precompiled binaries for the target platform.
The snappy module is now installed.
So you can successfully run the examples?
No, I haven’t tried the examples. I loaded the module and read in one SLSTR TDS band.
Are there specific test files to run the examples on?
thanks for developing this stuff that I learned during the Hackathon. I was trying to using snappy from an isolated virtualenv environment but when I attempted to install jpy by running PIP then it failed. I filed a ticket on github https://github.com/bcdev/jpy/issues/65
Please let me know if I can be useful to solve this.
Mac OS 10.11.5
I have installed apache maven 3.3.9, and jdk "/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/ ". However the build fails with this error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project jpy: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test failed: The forked VM terminated without saying properly goodbye. VM crash or System.exit called ? -> [Help 1]
This means that it does not successfully create the jpy zip file you mentioned in the jpy/build directory.
I do get these files:
A little concerned with the 10.5 not 10.6 as in your example.
Any help very much appreciated!
Thanks for reporting this, and sorry - such build errors are always annoying. However, I’ll need the test logs to see where the error actually originated. Can you pls attach them or just copy+paste the outputs of the failing tests. Also the JVM dump file (hs_err_pid.log or so) would be helpful.
My zip file is not created after running “python setup.py --maven build”.
The process stops with following message:
error: command ‘cl.exe’ failed: No such file or directory
In my jpy/build directory i can only find the following files:
…I can’t find the needed zip file here
I don’t know how to resolve this problem.
I would be very thankful if you could help me!
Thanks in advance,
cl.exe is the Windows C/C++ compiler which you’ll need for building jpy. See notes in README.rst file.
@Phil, update: just tried to build jpy for Python 3.5 on Windows 10 for the first time. It seems that some features of the Python 3.5 setuptools module changed in an incompatible way, at least for the Windows platform. The first thing I recognized was that the goal
bdist_wheeldidn’t work anymore so I had to
pip install wheel. But then I failed having the same error as you, see below. This is a pitty, because we seem to need a customized build step for Python 3.5, therefore fixing this will take some time, sorry for this.
cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -DWIN32=1 -IC:\Users\Norman\JavaProjects\jpy\src\main\c “-IC:\Program Files\Java\jdk1.8.0_112\include” “-IC:\Program Files\Java\jdk1.8.0_112\include\win32” -ID:\jpy\Python35\include -ID:\jpy\Python35\include /TcC:\Users\Norman\JavaProjects\jpy\src\main\c\jpy_module.c /Fobuild\temp.win32-3.5\Release\Users\Norman\JavaProjects\jpy\src\main\c\jpy_module.obj
error: command ‘cl.exe’ failed: No such file or directory
Hi Norman, thanks for your answers!
how long do you think fixing will take?
is there a way to avoid this problem? (Maybe doing the same on a windows 7 PC or with an older python version?)
I want to use snappy on python for my bachelor thesis, so I don´t know if its better to use the SNAP toolbox instead.
I have 51 satellite images, do you know another way to “automate” the preprocessing process?
Thanks for your helpfulness
What kind of pre-processing do you need to do? Which Satellite(s)?
I am working with Sentinel-1-Data (IW and VV/VH), and want to preprocess it with following steps:
- Read (Import)
- TOPSAR Split
- Apply Orbitfile
- TOPSAR Deburst
- Speckle Filtering
- Range Doppler Geocoding
Sorry, if it would have been Sentinel-2 or other Optical data then I could have helped you. But with radar I have no experience with alternative approaches.
PS: Did you try it with the command window prompt? Write “gpt” in your command window to see all tools. Or if you know the name of the tool you are going to use e.g. “gpt -h Multi-Temporal-Speckle-Filter” or “gpt -h TOPSAR-Split”. These command window prompts you can also automatize in Python.
ok I will give it a try!
But could you show me how to automate this command window prompts in python without a snappy installation?
Thanks for your help,
In python you also can call the command prompt. e.g.:
cmd = “gpt -h TOPSAR-Split”
There are also other functions which allows you to search for files or folders in a certain directory and give you back a list of strings. With these you can iterate through your 51 files and adjust the “cmd” string/prompt or do whatever you need (e.g. adjust the XML-File).