AndrewAnnex / SpiceyPy

SpiceyPy: a Pythonic Wrapper for the SPICE Toolkit.
MIT License
384 stars 84 forks source link

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

Closed RichardGFrench closed 7 years ago

RichardGFrench commented 7 years ago

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/

AndrewAnnex commented 7 years ago

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 commented 7 years ago

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

RichardGFrench commented 7 years ago

Thanks, Andrew - I installed pyopenssl in Canopy (it had not been previously installed), tried pip install spiceypy, and got the same error message. To be clear, I was able to get the spice toolkit from JPL - I just don't know where to put it so that python is aware of it, and how to complete the spiceypy installation manually.

I tried copying the cspice directory into /private/var/folders/gb/sk0lbh553q79qcmbk1gwrb5c0000gn/T/pip-build-z2kzy7/spiceypy/cspice and running pip install spiceypy again, but the pip-build-z2kzy7 folder has a new suffix for the last 6 characters each time I run the install command, so I can't anticipate the name of the folder it's looking for.

Here is the error message again:

2003 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-z2kzy7/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-z2kzy7/spiceypy/cspice

On Wed, May 3, 2017 at 12:27 AM, Andrew Annex notifications@github.com wrote:

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

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/AndrewAnnex/SpiceyPy/issues/188#issuecomment-298820831, or mute the thread https://github.com/notifications/unsubscribe-auth/AB84htbYYERYNOJju5iYcBwRi9Nus-atks5r2AIjgaJpZM4NO5Us .

--

Richard G. French

McDowell and Whiting Professor of Astrophysics

Chair of the Astronomy Department, Wellesley College

Director of the Whitin Observatory

Cassini Mission to Saturn Radio Science Team Leader

Wellesley, MA 02481-8203

(781) 283-3747

RichardGFrench commented 7 years ago

Here is a specific question: if you can tell me where within either of these two directory trees to place cspice, that might solve my problem:

2034 rfrench@achilles> pwd

/Users/rfrench/Library/Enthought/Canopy_64bit/User

2036 rfrench@achilles> ls -F

EGG-INFO/ LOCAL-REPO/ Resources/ enpkg.hist lib/ pyvenv.cfg

Examples/ Python@ bin/ include/ pip-selfcheck.json share/

or

2040 rfrench@achilles> pwd

/Users/rfrench/Library/Enthought/Canopy_64bit/System

2041 rfrench@achilles> ls -F

EGG-INFO/ Python@ addons/ include/ lib/

LOCAL-REPO/ Resources/ bin/ install.log pyvenv.cfg

On Wed, May 3, 2017 at 7:21 AM, Richard G French rfrench@wellesley.edu wrote:

Thanks, Andrew - I installed pyopenssl in Canopy (it had not been previously installed), tried pip install spiceypy, and got the same error message. To be clear, I was able to get the spice toolkit from JPL - I just don't know where to put it so that python is aware of it, and how to complete the spiceypy installation manually.

I tried copying the cspice directory into /private/var/folders/gb/ sk0lbh553q79qcmbk1gwrb5c0000gn/T/pip-build-z2kzy7/spiceypy/cspice and running pip install spiceypy again, but the pip-build-z2kzy7 folder has a new suffix for the last 6 characters each time I run the install command, so I can't anticipate the name of the folder it's looking for.

Here is the error message again:

2003 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-z2kzy7/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-z2kzy7/spiceypy/cspice

On Wed, May 3, 2017 at 12:27 AM, Andrew Annex notifications@github.com wrote:

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

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/AndrewAnnex/SpiceyPy/issues/188#issuecomment-298820831, or mute the thread https://github.com/notifications/unsubscribe-auth/AB84htbYYERYNOJju5iYcBwRi9Nus-atks5r2AIjgaJpZM4NO5Us .

--

Richard G. French

McDowell and Whiting Professor of Astrophysics

Chair of the Astronomy Department, Wellesley College

Director of the Whitin Observatory

Cassini Mission to Saturn Radio Science Team Leader

Wellesley, MA 02481-8203

(781) 283-3747

--

Richard G. French

McDowell and Whiting Professor of Astrophysics

Chair of the Astronomy Department, Wellesley College

Director of the Whitin Observatory

Cassini Mission to Saturn Radio Science Team Leader

Wellesley, MA 02481-8203

(781) 283-3747

AndrewAnnex commented 7 years ago

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 commented 7 years ago

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

RichardGFrench commented 7 years ago

Thanks, Andrew - I'll give that a try when I get back home to the recalcitrant machine! DF

On Wed, May 3, 2017 at 11:06 AM, Andrew Annex notifications@github.com wrote:

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

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/AndrewAnnex/SpiceyPy/issues/188#issuecomment-298939324, or mute the thread https://github.com/notifications/unsubscribe-auth/AB84htGWXsb_99vHsrpQj9GTc-OKceInks5r2JfugaJpZM4NO5Us .

--

Richard G. French

McDowell and Whiting Professor of Astrophysics

Chair of the Astronomy Department, Wellesley College

Director of the Whitin Observatory

Cassini Mission to Saturn Radio Science Team Leader

Wellesley, MA 02481-8203

(781) 283-3747

RichardGFrench commented 7 years ago

FYI, ugprading OpenSSL on the Mac did not work - it upgraded to the most recent version, but still failed to track down cspice from the URL. So, pip install spiceypy still fails, but the manual instructions worked fine! thanks for that. Dick

On Wed, May 3, 2017 at 11:38 AM, Richard G French rfrench@wellesley.edu wrote:

Thanks, Andrew - I'll give that a try when I get back home to the recalcitrant machine! DF

On Wed, May 3, 2017 at 11:06 AM, Andrew Annex notifications@github.com wrote:

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

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/AndrewAnnex/SpiceyPy/issues/188#issuecomment-298939324, or mute the thread https://github.com/notifications/unsubscribe-auth/AB84htGWXsb_99vHsrpQj9GTc-OKceInks5r2JfugaJpZM4NO5Us .

--

Richard G. French

McDowell and Whiting Professor of Astrophysics

Chair of the Astronomy Department, Wellesley College

Director of the Whitin Observatory

Cassini Mission to Saturn Radio Science Team Leader

Wellesley, MA 02481-8203

(781) 283-3747

--

Richard G. French

McDowell and Whiting Professor of Astrophysics

Chair of the Astronomy Department, Wellesley College

Director of the Whitin Observatory

Cassini Mission to Saturn Radio Science Team Leader

Wellesley, MA 02481-8203

(781) 283-3747

AndrewAnnex commented 7 years ago

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 commented 7 years ago

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

AndrewAnnex commented 7 years ago

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 .