I have spent several days to be able to install snappy. So, I thought it would be useful to write down the procedure that I followed. Any suggestions/edits would be appreciated.
To install snappy in ubuntu 22.04, and Anaconda 3 for python 3.9 I did the following steps:
• If you don’t have python installed, the first step is to install python – as mentioned above, I installed Anaconda 3 – python3.9.
• Next, make sure you have java installed as well. It is recommended to install JDK 8 with oracle distribution. you can search the instructions and where you can find the archived versions.
Please note that even if you have OpenJDK installed, you may still have to install JDK 8 with oracle distribution and prioritize it.
• Then, run the sudo vim ~/.profile or sudo vim ~/.bashrc (depending on your system), and edit the path for JDK_HOME and JAVA_HOME as follows- you could do this step after snap installation:
export JDK_HOME=/usr/lib/jvm/jdk1.8.0_333 #this is an example path
• Then, install maven for ubuntu.
• Next, you need to install snap. For doing so, download the Unix .sh file for the current snap version, cd to where you downloaded the file, and run:
sudo chmod +x esa-snap_sentinel_unix_5_0.sh
• Then, run the following commands (documentation can be found in GitHub under jpy-consortium):
git clone jpy-consortium HTTPS link
python setup.py build maven bdist_wheel
cp dist/*.whl “/root/.snap/snap-python/snappy”
If you encountered the error: Error: environment variable “JAVA_HOME” must be set to a JDK (>= v1.7) installation directory It means that you have not set the JDK_HOME and JAVA_HOME, or have not done this correctly. Note that the Java home should include “include” and “lib” directories.
• Afterwards, you should configure python for snappy:
cd snap installation directory/bin
./snappy-conf “python executable”
If the configuration fails with code 10, it means that you have not configured jpy correctly, or you have not copied the wheel to the snappy directory.
If the configuration fails with code 30, the version of the copied wheel is not compatible with the python version. In this case, you could find ideas on how to fix it by searching this forum. In short, you have to download another wheel which is compatible with your python version, and copy it to the snappy folder.
• The final step is to open python and run the following commands to check if snappy is up and running:
from snappy import ProductIO
if you encountered an error, make sure you have specified the installation directory correctly, and make sure conda has not confused snappy with another package with the same name.
if these lines run smoothly, you are good to go!