Problem installing luts

Use this Forum to find information on, or ask a question about, NASA Earth Science data.
gnwiii
Posts: 713
Joined: Fri Jan 29, 2021 5:51 pm America/New_York
Answers: 2
Has endorsed: 1 time

Problem installing luts

by gnwiii » Wed Apr 12, 2017 7:55 am America/New_York

If you run the SeaDAS 7 GUI by clicking the icon, it is using Anaconda python3 which will cause pyvercheck.py to fail.  The current pyvercheck.py seems to have been designed to handle "too old" python versions and does not run under python3. It is not hard to change the script to support both python2 and python3:
$ diff $OCSSWROOT/run/scripts/pyverchk.py pyverchk3.py
2a3,4


> from __future__ import print_function
> from six.moves import input


11c13
<     is_installed = raw_input(prompt)
---

>     is_installed = input(prompt)


22c24
<     ver = raw_input("What is the full path to your python (v2.6 or greater)?: ")
---

>     ver = input("What is the full path to your python (v2.6 or greater)?: ")


26c28
<         print "%s does not exist." % ver
---

>         print("%s does not exist." % ver)


37c39
<         print "Python version acceptable"
---

>         print("Python version acceptable")


39c41
<         print "Your default python interpreter is too old."
---

>         print("Your default python interpreter is too old or too new.")


47c49
<             print "The following scripts have been modified to use %s as the interpreter:" % pyver
---

>             print("The following scripts have been modified to use %s as the interpreter:" % pyver)


58c60
<                     print "\t", file
---

>                     print("\t", file)


61c63
<             print '''
---

>             print('''


64c66
<             '''
---

>             ''')




Then, with the default Anaconda python3 and the new pyverchk3.py, you can edit the scripts so they use Anaconda python2:

$ python
Python 3.6.0 |Anaconda 4.3.1 (x86_64)| (default, Dec 23 2016, 13:19:00)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

$ ./pyverchk.py
Your default python interpreter is too old or too new.
Do you have another python installation >= v2.6? (Y or N): Y
What is the full path to your python (v2.6 or greater)?: /opt/continuum.io/anaconda3/envs/python2/bin/python
The following scripts have been modified to use /opt/continuum.io/anaconda3/envs/python2/bin/python as the interpreter:
   /Users/seadas/ocssw/run/scripts/fd_matchup.py
        [...]
   /Users/seadas/ocssw/run/scripts/update_luts.py


Still in the Anaconda python3 environment, the scripts now run:

$ update_luts.py --verbose aqua
[ MODIS ]
+ leapsec.dat
+ utcpole.dat
[ Sensor: AQUA ]
+ OPER:MYD02_Emissive_LUTs.V6.1.35.29_OC2.hdf
[...]
+ EVAL:xcal_modisa_axc42d_869.hdf
[ Done ]


Running update processors installs the old script, causing:

installing scripts (14 of 18)
  File "/Users/gwhite/ocssw/run/scripts/pyverchk.py", line 26
    print "%s does not exist." % ver
                             ^
SyntaxError: Missing parentheses in call to 'print'
Error - Python version is not new enough to install luts

attachment 1

Filters:

liamgumley
Posts: 25
Joined: Tue Aug 09, 2005 12:58 pm America/New_York
Answers: 0

Problem installing luts

by liamgumley » Fri Apr 21, 2017 11:00 am America/New_York

I think the problem may be more explicitly stated as:
"SeaDAS 7.4 OCSSW now requires that the host computer have Python installed (at least v2.6) with OpenSSL support built-in (at least v1.0.1)".

Others may care to chime in on the wording and/or version numbers.

I found out recently that it is possible to build a local Python install without OpenSSL support. So even if the Python version is recent, if it is built without OpenSSL support the OCSSW modules using https connections (e.g., update_luts.py) will fail. Perhaps there could be a recommendation for a particular Python distribution on both Linux and Mac platforms (e.g., Anaconda vx.y).

Specific to my local computer (CentOs 6.9 64-bit), I get these diagnostics:

[gumley@bolt ~]$ cat /etc/redhat-release
CentOS release 6.9 (Final)
[gumley@bolt ~]$ which python
/usr/bin/python
[gumley@bolt ~]$ python -V
Python 2.6.6
[gumley@bolt ~]$ python -c 'import ssl ; print ssl.OPENSSL_VERSION'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
AttributeError: 'module' object has no attribute 'OPENSSL_VERSION'

However, the OCSSW 7.4 install and operation (e.g., update_luts.py) all works just fine.

gnwiii
Posts: 713
Joined: Fri Jan 29, 2021 5:51 pm America/New_York
Answers: 2
Has endorsed: 1 time

Problem installing luts

by gnwiii » Fri Apr 21, 2017 12:37 pm America/New_York

The Python 2.7 documentation says ssl.OPENSSL_VERSION was new in 2.7.  Kudos to RedHat for providing a useful Python 2.6 configuration.

liamgumley
Posts: 25
Joined: Tue Aug 09, 2005 12:58 pm America/New_York
Answers: 0

Problem installing luts

by liamgumley » Fri Apr 21, 2017 12:43 pm America/New_York

This might be a better way to test the compatibility of the local Python installation:

status=$(python -c 'import httplib ; c = httplib.HTTPSConnection("oceancolor.gsfc.nasa.gov")')
echo $status

If it returns zero, you are good to go.

liamgumley
Posts: 25
Joined: Tue Aug 09, 2005 12:58 pm America/New_York
Answers: 0

Problem installing luts

by liamgumley » Fri Apr 21, 2017 12:45 pm America/New_York

I meant to say

result=$(python -c 'import httplib ; c = httplib.HTTPSConnection("oceancolor.gsfc.nasa.gov")')
status=$?

If $status equals zero, you are good to go...

liamgumley
Posts: 25
Joined: Tue Aug 09, 2005 12:58 pm America/New_York
Answers: 0

Problem installing luts

by liamgumley » Fri Apr 21, 2017 12:46 pm America/New_York

This could go in the Python installer script...

gnwiii
Posts: 713
Joined: Fri Jan 29, 2021 5:51 pm America/New_York
Answers: 2
Has endorsed: 1 time

Problem installing luts

by gnwiii » Fri Apr 21, 2017 2:30 pm America/New_York

You need to do something with the connection to know it works.  On macOS El Capitan:


$ /usr/bin/python2.7 -c 'import httplib ; c = httplib.HTTPSConnection("oceancolor.gsfc.nasa.gov"); c.request("GET", "/"); r=c.getresponse(); print r.status, r.reason'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1053, in request
    self._send_request(method, url, body, headers)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1093, in _send_request
    self.endheaders(body)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1049, in endheaders
    self._send_output(message_body)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 893, in _send_output
    self.send(msg)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 855, in send
    self.connect()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1274, in connect
    server_hostname=server_hostname)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 352, in wrap_socket
    _context=self)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 579, in __init__
    self.do_handshake()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 808, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:590)


Using macports' python:


/opt/local/bin/python2.7 -c 'import httplib ; c = httplib.HTTPSConnection("oceancolor.gsfc.nasa.gov"); c.request("GET", "/"); res=c.getresponse(); print res.status, res.reason'
200 OK

Post Reply