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

cannot Install on Canopy OS X with pip install spiceypy #188

Closed
RichardGFrench opened this issue May 3, 2017 · 11 comments
Closed

cannot Install on Canopy OS X with pip install spiceypy #188

RichardGFrench opened this issue May 3, 2017 · 11 comments

Comments

@RichardGFrench
Copy link

RichardGFrench commented May 3, 2017

I tried pip install spiceypy running pip from
/Users/rfrench/Library/Enthought/Canopy_64bit/User/bin/pip

I get an error that it can't find cspice.tar.Z, but I was able to follow the "Best option" URL
https://naif.jpl.nasa.gov/pub/naif/misc/toolkit_N0065/C/MacIntel_OSX_AppleC_64bit/packages/cspice.tar.Z
to get cspice on my own. However, I don't know where to install it to make pip happy.
Any suggestions?

2007 rfrench@achilles> pip install spiceypy
Collecting spiceypy
Using cached spiceypy-1.1.1.tar.gz
Complete output from command python setup.py egg_info:
Unable to find CSPICE at /private/var/folders/gb/sk0lbh553q79qcmbk1gwrb5c0000gn/T/pip-build-urphol/spiceypy/cspice. Attempting to Download CSPICE For you:
Gathering information...
('SYSTEM: ', 'Mac')
('PROCESSOR:', 'i386')
('MACHINE: ', '64bit')
('Best option:', 'MacIntel_OSX_AppleC_64bit')
('URL: ', 'https://naif.jpl.nasa.gov/pub/naif/misc/toolkit_N0065/C/MacIntel_OSX_AppleC_64bit/packages/cspice.tar.Z')

Downloading...
Attempting to download spice...
Download failed with URLError, trying again after 15 seconds!
Attempting to download spice...
Download failed with URLError, trying again after 15 seconds!
Attempting to download spice...
Download failed with URLError, trying again after 15 seconds!
Attempting to download spice...
Download failed with URLError, trying again after 15 seconds!
Attempting to download spice...
Download failed with URLError, trying again after 15 seconds!
Attempting to download spice...
Download failed with URLError, trying again after 15 seconds!
Attempting to download spice...
Download failed with URLError, trying again after 15 seconds!
Attempting to download spice...
Download failed with URLError, trying again after 15 seconds!
Attempting to download spice...
Download failed with URLError, trying again after 15 seconds!
Attempting to download spice...
Download failed with URLError, trying again after 15 seconds!
Unable to find CSPICE at /private/var/folders/gb/sk0lbh553q79qcmbk1gwrb5c0000gn/T/pip-build-urphol/spiceypy/cspice. Exiting

----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/gb/sk0lbh553q79qcmbk1gwrb5c0000gn/T/pip-build-urphol/spiceypy/

@RichardGFrench RichardGFrench changed the title Installing on Conda OS X with pip install spiceypy cannot Install on Canopy OS X with pip install spiceypy May 3, 2017
@AndrewAnnex
Copy link
Owner

AndrewAnnex commented May 3, 2017

Hey Richard, thanks for writing in.

So first of all if I am correct, this issue is related to the recent SSL cert upgrade on the JPL servers (it was in january I think) and that the python you are using is using an old OpenSSL version which can't work with the newer cert.

There is at least one other user with the same error but they have not written back to me yet on the success of my half-remembered fix, so I will check on that. That fix is installing/upgrading pyopenssl and trying again. You may also need to install a new version of OpenSSL first using something like MacPorts or Homebrew. But since you are using canopy I am not exactly sure what other steps may be involved. I can find some relevant links for you, but I would just be googling 'python upgrade openssl'.

The alternative is to clone or download the release and then download the correct version of spice and extract it to a folder called cspice within the repository folder and then you can install by running python setup.py install

EDIT: see note below about upgrading openssl

@AndrewAnnex
Copy link
Owner

To be clear, this is not a spiceypy specific issue, but an environment issue (albeit likely a common one)

@RichardGFrench
Copy link
Author

RichardGFrench commented May 3, 2017 via email

@RichardGFrench
Copy link
Author

RichardGFrench commented May 3, 2017 via email

@AndrewAnnex
Copy link
Owner

Sorry the pyopenssl was not the thing I remembered it to be.
The issue again is that you are running python with an old OpenSSL that cannot validate the TLS 1.2 JPL certificate, for you and to anyone else with this issue you can check this by running

python -c "import ssl; print ssl.OPENSSL_VERSION" 

or

python3 -c "import ssl; print(ssl.OPENSSL_VERSION)" 

if using python 3.

If the version is older than something from late 2016 you need to upgrade that.
This is ultimately the correct way to fix the issue, and it is fairly mac specific as ubuntu versions newer than 14.04 I think come with newer openssl installations and I have not seen any issues on the windows side of things.

Secondly neither of those directories would work for a manual spiceypy install.
If you clone spiceypy to a folder say ~/spiceypy, with no further nesting so that the readme for example is located directly within ie ~/spiceypy/README.rst, you could then download cspice into that folder ie ~/spiceypy/cspice.

At that point you should be able to just run python setup.py install while within ~/spiceypy.

@AndrewAnnex
Copy link
Owner

See this link for some info on upgrading OpenSSL
https://comeroutewithme.com/2016/03/13/python-osx-openssl-issue/

@RichardGFrench
Copy link
Author

RichardGFrench commented May 3, 2017 via email

@RichardGFrench
Copy link
Author

RichardGFrench commented May 3, 2017 via email

@AndrewAnnex
Copy link
Owner

very odd. And you checked that python was using the new openssl version.

As I can't reproduce the error, would you be willing to modify the getspice.py file around line 148 to this:

 except urllib.error.URLError as err:
          print(err.reason)
          print(err)

and then running it?
The output may help me check a few things.

@AndrewAnnex
Copy link
Owner

also as a curiosity, which version of macos are you running?

@AndrewAnnex
Copy link
Owner

So I am closing this issue for now as it is a problem with the end user's environment. I will be adding mac os builds to the travis matrix soon which proves the point in #189 .

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

No branches or pull requests

2 participants