Skip to content
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

fix sampy.py SSL issue that prevents sherpa from connecting via SAMP #361

Open
jbudynk opened this issue Jan 16, 2020 · 0 comments
Open

Comments

@jbudynk
Copy link
Member

jbudynk commented Jan 16, 2020

The newer versions of conda have an updated SSL package that no longer has PROTOCOL_SSLv3 defined. sampy.py, which hasn't been developed in about 10 years, sets up an HTTPSConnection with ssl_version = ssl.PROTOCOL_SSLv3. This raises an AttributeError in sampy.py.

Original email of issue (from me):

Sherpa is started, but it can't connect to the SAMP hub due to an issue with the SSL package:

cat /data/scialg/staff/jbudynk/iris-issue/note.txt
/data/vao/staff/jbudynk/mojave-issue-sherpa-samp.traceback

(iris3.0) dudley:~ saoguest$ sherpa-samp
Traceback (most recent call last):
  File "/Users/saoguest/miniconda2/envs/iris3.0/bin/sherpa-samp", line 11, in <module>
    load_entry_point('sherpa-samp==2.1', 'console_scripts', 'sherpa-samp')()
  File "/Users/saoguest/miniconda2/envs/iris3.0/lib/python2.7/site-packages/pkg_resources/__init__.py", line 489, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/Users/saoguest/miniconda2/envs/iris3.0/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2793, in load_entry_point
    return ep.load()
  File "/Users/saoguest/miniconda2/envs/iris3.0/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2411, in load
    return self.resolve()
  File "/Users/saoguest/miniconda2/envs/iris3.0/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2417, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "build/bdist.macosx-10.7-x86_64/egg/sherpa_samp/mtypes.py", line 28, in <module>
  File "/Users/saoguest/miniconda2/envs/iris3.0/lib/python2.7/site-packages/sampy.py", line 914, in <module>
    class HTTPSConnection(httplib.HTTPConnection):
  File "/Users/saoguest/miniconda2/envs/iris3.0/lib/python2.7/site-packages/sampy.py", line 921, in HTTPSConnection
    ssl_version=ssl.PROTOCOL_SSLv3, strict=None):
AttributeError: 'module' object has no attribute 'PROTOCOL_SSLv3'

sampy imports the SSL library from iris/lib/python2.7/ssl.py. The 'PROTOCOL_SSLv3' variable is loaded from iris/lib/python2.7/lib-dynload/_ssl.so. I'm guessing that the variable PROTOCOL_SSLv3 defined in _ssl.so isn't read in correctly, thus the AttributeError in sampy.py.

I really don't know anything about SSL, but just to see if it would fix the issue -- If we switch the default protocol to 'PROTOCOL_SSLv23' in all the sampy.py methods, Sherpa connects to the SAMP hub, and I can compute fits in Iris again. iris/lib/python2.7/ssl.py defines "PROTOCOL_SSLv23 = PROTOCOL_TLS".

And @olaurino 's response:

We are using very old (like ancient) packages. Sampy hasn't been actively developed for almost a decade, it was already obsolete when we started using it, but we couldn't switch to astropy.samp. If you think you have a fix, try fixing sampy and creating a new conda package. An alternative would be to find which past version of python 2.7 fixes the problem.

If you go the conda way, you can start from here:
https://github.com/olaurino/conda-recipes

Download the source code from the URL in the sampy/meta.yaml file, make the file point to the location where you unpacked it and fixed it (file:///etc), increase the build number in meta.yaml, cd to that folder, and then do conda build .

Install the new package with conda install --use-local sampy, and see if it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant