AndrewAnnex / SpiceyPy

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

Installation Issue #412

Closed katharinehesse closed 3 years ago

katharinehesse commented 3 years ago

Describe the bug I am having installation issues that were not solved by the documentation at: https://spiceypy.readthedocs.io/en/latest/installation.html#common-issues. I am using pip install spiceypy but the building wheel fails for spiceypy. The full error output is attached below, but the relevant portion seems to be:

 Downloading CSPICE for MacIntel_OSX_AppleC_64bit...
  Unpacking... (this may take some time!)
  Host OS: Darwin
  ld: library not found for -lSystem
  collect2: error: ld returned 1 exit status
  Error: compilation of shared spice.so build exit status: ('256',)
error
  ERROR: Failed building wheel for spiceypy

Expected behavior 'pip install [...]' typically runs alright

To Reproduce Verbose output for the installation error is in the attached text file installation_error.txt

Desktop (please complete the following information):

Additional context I do have Python 2.7.16 installed on my machine as well as Python 3.9.2, though the latter is the one in $PATH: and the version altered by pip installations

Thank you! Please let me know if I can provide any other helpful information. I am wondering if it is a Python 3.9 issue since a colleague with Python 3.7 was able to install without error

AndrewAnnex commented 3 years ago

ahh you must not have xcode installed, first try running sudo xcode-select --install to install xcode. This thread: https://github.com/ponylang/ponyc/issues/3684 may have some relevant details for this particular issue, so it's not python specific.

If you have xcode installed and still run into the issue, could you possibly be running on a m1/arm mac?

katharinehesse commented 3 years ago

I do have xcode installed, version 12.5. Here is some other potentially relevant information:

CPU: 16-core 64-bit kabylake Clang: 12.0.5 build 1205 Git: 2.30.1 => /Library/Developer/CommandLineTools/usr/bin/git Curl: 7.64.1 => /usr/bin/curl macOS: 11.4-x86_64 CLT: 12.5.0.22.9

As for whether I have an m1/arm mac I don't believe so. I have a MacBook Pro (16-inch, 2019) with 2.4 GHz 8-Core Intel Core i9 processor

AndrewAnnex commented 3 years ago

Hmm well I’ll have to think about it but I am going on a vacation for a few days so I will be mostly unavailable for a bit. I still think it is an issue with your system level compiler, as that error is specifically an issue that clang is running into looking for something. It could be a change with recent releases of Xcode, but since I haven’t seen this particular issue before I would have to google more things to try to reproduce the error.

In the meantime if you still need to use spiceypy try to install SpiceyPy using the conda-forge distribution to an anaconda/miniconda distribution. To do this you will need to install miniconda/anaconda following instructions on their website, then use conda install spiceypy -c conda-forge in a activated conda environment.

If you don’t want to install anaconda there is another workaround. You could potentially download the tar.gz file for macOS CSPICE here: https://anaconda.org/conda-forge/cspice/files, extract the “.dylib” file for cspice and then follow the instructions for “offline” installation of cspice in the SpiceyPy docs here: https://spiceypy.readthedocs.io/en/main/installation.html#offline-installation.

Although that is a bit convoluted to follow for sure, so I recommend the conda method even if it takes some time to learn how conda works vs pip.

Hope that helps in the meantime -Andrew

On Jun 10, 2021, at 9:18 PM, katharinehesse @.***> wrote:

 I do have xcode installed, version 12.5. Here is some other potentially relevant information:

CPU: 16-core 64-bit kabylake Clang: 12.0.5 build 1205 Git: 2.30.1 => /Library/Developer/CommandLineTools/usr/bin/git Curl: 7.64.1 => /usr/bin/curl macOS: 11.4-x86_64 CLT: 12.5.0.22.9

As for whether I have an m1/arm mac I don't believe so. I have a MacBook Pro (16-inch, 2019)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

AndrewAnnex commented 3 years ago

@katharinehesse

So I found another few posts and it is definitely something wrong with your system's xcode installation not finding the system library although I am not sure about how to fix it exactly because the xcode CLI install should have set up everything correctly. In reading the above, did you just install xcode or did you also install the xcode CLI? If you haven't installed the CLI, try going to https://developer.apple.com/download/ and then download and install "Command Line Tools for Xcode 12.5".

Once you have installed that and rebooted it should work.

If not then something deeper is wrong. I have seen two approaches to fixing it and it either requires installing gcc using homebrew or figuring out what environment variable is mis-configured. Although using homebrew is easy, I think it would be better to quickly test the latter instead.

To figure out what variables are incorrect you can follow the post here https://developer.apple.com/forums/thread/669094?answerId=653168022#653168022, to write a simple c program and compile it. In particular pay attention to the output from cc test.o -v -o test and paste the output here. But you should see a path for "-lSystem" and you can check the directory it points to, to see if it exists.

AndrewAnnex commented 3 years ago

@katharinehesse any updates? If you have tried all of the above please let me know what specific issues occurred and I can continue to look up information to try to find the root cause, as it would be good to update the spiceypy docs with the fix.

Otherwise I will be closing this issue soon-ish, if you continue to have this problem you may re-open this issue.

katharinehesse commented 3 years ago

Hi, Andrew! I did install CIL but still have the same error upon rebooting and retrying installation.

I do have homebrew installed as well as gcc I believe. The mis-configured variable does seem like it may be what the issue is: I will try out the link and report back. Thank you for your help!

AndrewAnnex commented 3 years ago

closing this issue for now, if there are updates feel free to re-open