Unable to install snappy - jpy problem?

I guess all you need to do is to change SNAP_HOME from

/Applications/snap/bin

to

/Applications/snap

New user (Principal on S34Sci Land Study 1 Snow with Carsten )…

I’m having same issue as cbenedek (same OSX release 10.12.1)

In what file is SNAP_HOME set?

Thanks,

Jason

Welcome Jason!
It is defined in the snappy.ini. It’s in the snappy folder which you probably copied to the site-packages directory of python.

Thanks Marco

am now trying to configure snappy on OSX 10.9…

earlier was getting a jdk version not high enough error, restarted…

$ python --version
Python 3.4.5

$ ./snappy-conf /opt/local/bin/python
Configuring SNAP-Python interface…
java.io.IOException: Python configuration failed.
Command [/opt/local/bin/python ./snappyutil.py --snap_home /Applications/snap --java_module /Applications/snap/snap/modules/org-esa-snap-snap-python.jar --force --log_file ./snappyutil.log --java_home /Applications/snap/.install4j/jre.bundle/Contents/Home/jre --req_arch x86_64]
failed with return code 10.
Please check the log file ‘/Users/jasonbox/.snap/snap-python/snappy/snappyutil.log’.
at org.esa.snap.python.PyBridge.configureJpy(PyBridge.java:223)
at org.esa.snap.python.PyBridge.installPythonModule(PyBridge.java:147)
at org.esa.snap.rcp.cli.SnapArgsProcessor.processPython(SnapArgsProcessor.java:103)
at org.esa.snap.rcp.cli.SnapArgsProcessor.process(SnapArgsProcessor.java:49)
at org.netbeans.modules.sendopts.DefaultProcessor.process(DefaultProcessor.java:202)
at org.netbeans.spi.sendopts.Option$1.process(Option.java:387)
at org.netbeans.api.sendopts.CommandLine.process(CommandLine.java:317)
at org.netbeans.modules.sendopts.HandlerImpl.execute(HandlerImpl.java:62)
at org.netbeans.modules.sendopts.Handler.cli(Handler.java:69)
at org.netbeans.CLIHandler.notifyHandlers(CLIHandler.java:234)
at org.netbeans.core.startup.CLICoreBridge.cli(CLICoreBridge.java:82)
at org.netbeans.CLIHandler.notifyHandlers(CLIHandler.java:234)
at org.netbeans.CLIHandler$1.exec(CLIHandler.java:268)
at org.netbeans.CLIHandler.finishInitialization(CLIHandler.java:447)
at org.netbeans.MainImpl.finishInitialization(MainImpl.java:256)
at org.netbeans.Main.finishInitialization(Main.java:92)
at org.netbeans.core.startup.Main.start(Main.java:316)
at org.netbeans.core.startup.TopThreadGroup.run(TopThreadGroup.java:123)
at java.lang.Thread.run(Thread.java:745)
Python configuration error: Python configuration failed.
Command [/opt/local/bin/python ./snappyutil.py --snap_home /Applications/snap --java_module /Applications/snap/snap/modules/org-esa-snap-snap-python.jar --force --log_file ./snappyutil.log --java_home /Applications/snap/.install4j/jre.bundle/Contents/Home/jre --req_arch x86_64]
failed with return code 10.

$ git clone https://github.com/bcdev/jpy.git
$ cd jpy
$ python setup.py bdist_wheel

Traceback (most recent call last):
File “setup.py”, line 25, in
from setuptools import setup
ImportError: No module named ‘setuptools’

tried python ez_setup.py… no joy

Any advice welcome!

Thanks,

Jason

Is there more information in the snappyutil.log?

Hi Marco,

Here is snappyutil.log…

$ cat /Users/jasonbox/.snap/snap-python/snappy/snappyutil.log
INFO: Installing from Java module ‘/Applications/snap/snap/modules/org-esa-snap-snap-python.jar’
INFO: Installing jpy…
ERROR: The module ‘jpy’ is required to run snappy, but no binary ‘jpy’ wheel matching the pattern
ERROR: ‘jpy-{version}-cp34-{abi_tag}-macosx_10_9_x86_64.whl’ could be found.
You can try to build a ‘jpy’ wheel yourself and then copy it into
“/Users/jasonbox/.snap/snap-python/snappy” and then run the configuration again.
Please go to https://github.com/bcdev/jpy and follow the build instructions. E.g.

git clone https://github.com/bcdev/jpy.git
cd jpy
python setup.py bdist_wheel
cp dist/*.whl “/Users/jasonbox/.snap/snap-python/snappy”
ERROR: Configuration failed

I think you need to call python setup.py --maven bdist_wheel
See: https://github.com/bcdev/jpy/blob/master/README.md#how-to-build-on-linux-and-mac

$ export JDK_HOME=<your-jdk-dir>
$ export JAVA_HOME=$JDK_HOME
$ python get-pip.py
$ python setup.py --maven bdist_wheel

Thanks Marco, The suggested commands were accepted by the one machine (OSX 10.12) then I had to run from the office. Here at my other office, I am trying to install on another machine (OSX 10.9) where I was also to the point in the debugging that I had installed JDK. So picking up from there…

$ export JDK_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/
$ export JAVA_HOME=$JDK_HOME
$ which python
/opt/local/bin/python

$ cd /Applications/snap/bin
$ ./snappy-conf /opt/local/bin/python
Configuring SNAP-Python interface…
java.io.IOException: Python configuration failed.
Command [/opt/local/bin/python ./snappyutil.py --snap_home /Applications/snap --java_module /Applications/snap/snap/modules/org-esa-snap-snap-python.jar --force --log_file ./snappyutil.log --java_home /Applications/snap/.install4j/jre.bundle/Contents/Home/jre --req_arch x86_64]
failed with return code 10.
Please check the log file ‘/Users/jasonbox/.snap/snap-python/snappy/snappyutil.log’.
at org.esa.snap.python.PyBridge.configureJpy(PyBridge.java:223)
at org.esa.snap.python.PyBridge.installPythonModule(PyBridge.java:147)
at org.esa.snap.rcp.cli.SnapArgsProcessor.processPython(SnapArgsProcessor.java:103)
at org.esa.snap.rcp.cli.SnapArgsProcessor.process(SnapArgsProcessor.java:49)
at org.netbeans.modules.sendopts.DefaultProcessor.process(DefaultProcessor.java:202)
at org.netbeans.spi.sendopts.Option$1.process(Option.java:387)
at org.netbeans.api.sendopts.CommandLine.process(CommandLine.java:317)
at org.netbeans.modules.sendopts.HandlerImpl.execute(HandlerImpl.java:62)
at org.netbeans.modules.sendopts.Handler.cli(Handler.java:69)
at org.netbeans.CLIHandler.notifyHandlers(CLIHandler.java:234)
at org.netbeans.core.startup.CLICoreBridge.cli(CLICoreBridge.java:82)
at org.netbeans.CLIHandler.notifyHandlers(CLIHandler.java:234)
at org.netbeans.CLIHandler$1.exec(CLIHandler.java:268)
at org.netbeans.CLIHandler.finishInitialization(CLIHandler.java:447)
at org.netbeans.MainImpl.finishInitialization(MainImpl.java:256)
at org.netbeans.Main.finishInitialization(Main.java:92)
at org.netbeans.core.startup.Main.start(Main.java:316)
at org.netbeans.core.startup.TopThreadGroup.run(TopThreadGroup.java:123)
at java.lang.Thread.run(Thread.java:745)
Python configuration error: Python configuration failed.
Command [/opt/local/bin/python ./snappyutil.py --snap_home /Applications/snap --java_module /Applications/snap/snap/modules/org-esa-snap-snap-python.jar --force --log_file ./snappyutil.log --java_home /Applications/snap/.install4j/jre.bundle/Contents/Home/jre --req_arch x86_64]
failed with return code 10.
Please check the log file ‘/Users/jasonbox/.snap/snap-python/snappy/snappyutil.log’.

$ cat /Users/jasonbox/.snap/snap-python/snappy/snappyutil.log
INFO: Installing from Java module ‘/Applications/snap/snap/modules/org-esa-snap-snap-python.jar’
INFO: Installing jpy…
ERROR: The module ‘jpy’ is required to run snappy, but no binary ‘jpy’ wheel matching the pattern
ERROR: ‘jpy-{version}-cp34-{abi_tag}-macosx_10_9_x86_64.whl’ could be found.
You can try to build a ‘jpy’ wheel yourself and then copy it into
“/Users/jasonbox/.snap/snap-python/snappy” and then run the configuration again.
Please go to https://github.com/bcdev/jpy and follow the build instructions. E.g.

git clone https://github.com/bcdev/jpy.git
cd jpy
python setup.py bdist_wheel
cp dist/*.whl “/Users/jasonbox/.snap/snap-python/snappy”
ERROR: Configuration failed

$ git clone https://github.com/bcdev/jpy.git
Cloning into ‘jpy’…
remote: Counting objects: 5242, done.
remote: Total 5242 (delta 0), reused 0 (delta 0), pack-reused 5242
Receiving objects: 100% (5242/5242), 2.04 MiB | 511.00 KiB/s, done.
Resolving deltas: 100% (2942/2942), done.
Checking connectivity… done.
$ cd jpy
$ python setup.py bdist_wheel
Traceback (most recent call last):
File “setup.py”, line 25, in
from setuptools import setup
ImportError: No module named ‘setuptools’

… and so I came back to the following…
python get-pip.py
Collecting pip
Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB)
100% |████████████████████████████████| 1.3MB 400kB/s
Collecting setuptools
Downloading setuptools-36.2.0-py2.py3-none-any.whl (477kB)
100% |████████████████████████████████| 479kB 856kB/s
Collecting wheel
Downloading wheel-0.29.0-py2.py3-none-any.whl (66kB)
100% |████████████████████████████████| 69kB 2.3MB/s
Installing collected packages: pip, setuptools, wheel
Exception:
Traceback (most recent call last):
File “/var/folders/vw/lmkw2l0s1tx6vs5sk99vx5nc0000gn/T/tmpnyv94inb/pip.zip/pip/basecommand.py”, line 211, in main
status = self.run(options, args)
File “/var/folders/vw/lmkw2l0s1tx6vs5sk99vx5nc0000gn/T/tmpnyv94inb/pip.zip/pip/commands/install.py”, line 311, in run
root=options.root_path,
File “/var/folders/vw/lmkw2l0s1tx6vs5sk99vx5nc0000gn/T/tmpnyv94inb/pip.zip/pip/req/req_set.py”, line 646, in install
**kwargs
File “/var/folders/vw/lmkw2l0s1tx6vs5sk99vx5nc0000gn/T/tmpnyv94inb/pip.zip/pip/req/req_install.py”, line 803, in install
self.move_wheel_files(self.source_dir, root=root)
File “/var/folders/vw/lmkw2l0s1tx6vs5sk99vx5nc0000gn/T/tmpnyv94inb/pip.zip/pip/req/req_install.py”, line 998, in move_wheel_files
isolated=self.isolated,
File “/var/folders/vw/lmkw2l0s1tx6vs5sk99vx5nc0000gn/T/tmpnyv94inb/pip.zip/pip/wheel.py”, line 339, in move_wheel_files
clobber(source, lib_dir, True)
File “/var/folders/vw/lmkw2l0s1tx6vs5sk99vx5nc0000gn/T/tmpnyv94inb/pip.zip/pip/wheel.py”, line 310, in clobber
ensure_dir(destdir)
File “/var/folders/vw/lmkw2l0s1tx6vs5sk99vx5nc0000gn/T/tmpnyv94inb/pip.zip/pip/utils/init.py”, line 71, in ensure_dir
os.makedirs(path)
File “/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/os.py”, line 237, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: ‘/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pip’

jpy$ python setup.py --maven bdist_wheel
Traceback (most recent call last):
File “setup.py”, line 25, in
from setuptools import setup
ImportError: No module named ‘setuptools’

jpy$ ls
CHANGES.md README.md doc jpyutil.py setup.cfg winbuild.cmd
LICENSE.txt appveyor.yml ez_setup.py pom.xml setup.py
MANIFEST.in ci get-pip.py pysobug src

at this point, I welcome any pointers.

With appreciation,

Jason

Try

sudo python get-pip.py

The might help, because I see PermissionError: [Errno 13] Permission denied in your logs.

Thanks Marco,

That sudo indeed helped get that part in…

returning to…

$ ./snappy-conf /opt/local/bin/python
Configuring SNAP-Python interface…
java.io.IOException: Python configuration failed.
Command [/opt/local/bin/python ./snappyutil.py --snap_home /Applications/snap --java_module /Applications/snap/snap/modules/org-esa-snap-snap-python.jar --force --log_file ./snappyutil.log --java_home /Applications/snap/.install4j/jre.bundle/Contents/Home/jre --req_arch x86_64]
failed with return code 10.
Please check the log file ‘/Users/jasonbox/.snap/snap-python/snappy/snappyutil.log’.
at org.esa.snap.python.PyBridge.configureJpy(PyBridge.java:223)
at org.esa.snap.python.PyBridge.installPythonModule(PyBridge.java:147)
at org.esa.snap.rcp.cli.SnapArgsProcessor.processPython(SnapArgsProcessor.java:103)
at org.esa.snap.rcp.cli.SnapArgsProcessor.process(SnapArgsProcessor.java:49)
at org.netbeans.modules.sendopts.DefaultProcessor.process(DefaultProcessor.java:202)
at org.netbeans.spi.sendopts.Option$1.process(Option.java:387)
at org.netbeans.api.sendopts.CommandLine.process(CommandLine.java:317)
at org.netbeans.modules.sendopts.HandlerImpl.execute(HandlerImpl.java:62)
at org.netbeans.modules.sendopts.Handler.cli(Handler.java:69)
at org.netbeans.CLIHandler.notifyHandlers(CLIHandler.java:234)
at org.netbeans.core.startup.CLICoreBridge.cli(CLICoreBridge.java:82)
at org.netbeans.CLIHandler.notifyHandlers(CLIHandler.java:234)
at org.netbeans.CLIHandler$1.exec(CLIHandler.java:268)
at org.netbeans.CLIHandler.finishInitialization(CLIHandler.java:447)
at org.netbeans.MainImpl.finishInitialization(MainImpl.java:256)
at org.netbeans.Main.finishInitialization(Main.java:92)
at org.netbeans.core.startup.Main.start(Main.java:316)
at org.netbeans.core.startup.TopThreadGroup.run(TopThreadGroup.java:123)
at java.lang.Thread.run(Thread.java:745)
Python configuration error: Python configuration failed.
Command [/opt/local/bin/python ./snappyutil.py --snap_home /Applications/snap --java_module /Applications/snap/snap/modules/org-esa-snap-snap-python.jar --force --log_file ./snappyutil.log --java_home /Applications/snap/.install4j/jre.bundle/Contents/Home/jre --req_arch x86_64]
failed with return code 10.
Please check the log file ‘/Users/jasonbox/.snap/snap-python/snappy/snappyutil.log’

$ cat /Users/jasonbox/.snap/snap-python/snappy/snappyutil.log
INFO: Installing from Java module ‘/Applications/snap/snap/modules/org-esa-snap-snap-python.jar’
INFO: Installing jpy…
ERROR: The module ‘jpy’ is required to run snappy, but no binary ‘jpy’ wheel matching the pattern
ERROR: ‘jpy-{version}-cp34-{abi_tag}-macosx_10_9_x86_64.whl’ could be found.
You can try to build a ‘jpy’ wheel yourself and then copy it into
“/Users/jasonbox/.snap/snap-python/snappy” and then run the configuration again.
Please go to https://github.com/bcdev/jpy and follow the build instructions. E.g.

git clone https://github.com/bcdev/jpy.git
cd jpy
python setup.py bdist_wheel
cp dist/*.whl “/Users/jasonbox/.snap/snap-python/snappy”
ERROR: Configuration failed

the following is strange since JDK 1.8 is live?..

$ python setup.py --maven bdist_wheel
Error: environment variable “JAVA_HOME” must be set to a JDK (>= v1.7) installation directory
$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/
$ echo $JDK_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/

back installing on the OSX 10.12 machine name aput, working through anaconda per collaborators suggestion…

I got the JPY wheel turning, it seems. :slight_smile:

latest hang up I request input on:

$source activate esa_dev # anaconda environment
(esa_dev) aput:bin jason$ ./snappy-conf /Users/jason/anaconda3/bin/python
Configuring SNAP-Python interface…
Done. The SNAP-Python interface is located in ‘/Users/jason/.snap/snap-python/snappy’
When using SNAP from Python, either do: sys.path.append(’/Users/jason/.snap/snap-python’)
or copy the ‘snappy’ module into your Python’s ‘site-packages’ directory.

My question is if snappy.ini is the “snappy module”?

in that case, I try

cp /Users/jason/.snap/snap-python/snappy/snappy.ini /users/jason//anaconda3/envs/esa_dev/lib/python3.4/site-packages

after that…
(esa_dev) aput:snap jason$ python
Python 3.4.5 |Continuum Analytics, Inc.| (default, Jul 2 2016, 17:47:57)
[GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] on darwin
Type “help”, “copyright”, “credits” or “license” for more information.

import snappy
Traceback (most recent call last):
File “”, line 1, in
ImportError: No module named 'snappy

any suggestions?

Nice that the wheels turns…

snappy.ini is not the module. The complete snappy directory located snap-python is the module.
If you copy this it should work. *fingerscrossed*

I’m in business!!

What I hope can help others I sketch what I did on the OSX 10.12 Sierra Mac

Start by installing the following…

  1. python 3.4
  2. Anaconda
  3. JRE
  4. JDK (Java Development ToolKiit) I installed jdk-8uversion-macosx-x64.dmg
  5. SNAP latest version
  6. Xcode developer latest version

more…
sudo git clone https://github.com/bcdev/jpy.git
cd jpy
sudo python setup.py bdist_wheel
cp dist/*.whl “~/.snap/snap-python/snappy”

conda create --name esa_dev python=3.4

$ which python
~/anaconda3/bin/python
$ cd /Applications/snap/bin
(esa_dev) aput:bin jason$ ./snappy-conf /Users/jason/anaconda3/envs/esa_dev/bin/p

conda install --name esa_dev math numpy
conda install --name esa_dev mpmath numpy

these put in Mac .profile
export JDK_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/
export JAVA_HOME=$JDK_HOME
export PYTHONPATH=$PYTHONPATH:/Users/jason/.snap/snap-python/
source .profile

Anaconda How To…
Unix:
source activate esa_dev
[else on exit source deactivate esa_dev]

cd /Applications/snap/bin/
./snappy-conf ~/anaconda3/envs/esa_dev2/bin/python

cd ~/.snap/snap-python/snappy ;
python setup.py install

now execute your snappy .py scripts!

3 Likes

Glad you got it working. Thanks for posting the details. The same approach should work for El Capitan. A few items may need clarification/simplification for anyone who comes across this post in the future:

Under “Start by installing”

  1. python3.4

Python 3.4 is available from several sources (macports, homebrew, or python.org). You seem to using an Anaconda
environment. Did you start with Anaconda2 or Anaconda3 (or does it matter?). Mabe you meant:

  1. install Anaconda2 or Anaconda3 python (depending on whether you want to have 2.7 or 3.6 as your default version).
  2. configure an Anaconda python=3.4 environment for snappy

You shouldn’t need to use “sudo” to run “python setup.py bdist_wheel”, but I would think
that needs to be done using the esa_dev (python=3.4) environment.

Java has been getting regular updates on current macOS. In the .profile file you can use:

export JDK_HOME="${JDK_HOME:-$(/usr/libexec/java_home)}"

This should automatically switch to the new Java version at login.

1 Like

Dear All,

I’ve just set up snap for the first time on a clean OS X Sierra computer with the following commands. Homebrew and Anaconda python were already installed, and the Mac OS X JDK (jdk-8u144-macosx-x64.dmg) from http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html , then:

conda create -n SNAP python=3.4
source activate SNAP

# install maven
brew install maven

# install jpy
cd local/src/
git clone https://github.com/bcdev/jpy.git
cd jpy/
python setup.py bdist_wheel
cp dist/*.whl ~/.snap/snap-python/snappy

# set up snappy
# NOTE: customize paths here to where SNAP and Anaconda are installed
~/Applications/snap/bin/snappy-conf ~/local/anaconda/envs/SNAP/bin/python

cd ~/.snap/snap-python/snappy
python setup.py install

# I think here OS X told me it needed a legacy java and sent me to a webpage. I installed:
# https://support.apple.com/kb/DL1572?locale=en_US

# test
python
import snappy # no error message = works.
2 Likes

Hi! I am still getting the error “Error: environment variable “JAVA_HOME” must be set to a JDK (>= v1.7) installation directory”

and my version is jdk-12.0.1.jdk.

Do you remember how to solve this error?

Thanks a lot!

Please try it with a JDK 8 from Oracle. Not sure if it can work with a JDK greater then 8. Also OpenJDK can make problems.

2 Likes

Thanks for the reply!

(SNAP) Rochelles-MBP:jpy rochellecostasilva$ sudo python setup.py --maven bdist_wheel

Error: environment variable “JAVA_HOME” must be set to a JDK (>= v1.7) installation directory

(SNAP) Rochelles-MBP:jpy rochellecostasilva$ echo $JAVA_HOME

/Library/Java/JavaVirtualMachines/jdk1.8.0_211.jdk/Contents/Home

Already changed the JDK for 8 and it is from Oracle, but I still get the same error.

Did you export JAVA_HOME? Please run “export -p | grep JAVA_HOME” to verify that
the variable is exported.

I get this:

   $ export -p | grep JAVA_HOME
    declare -x JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_211.jdk/Contents/Home"