I would also recommend posting to GitHub. You might be forging a new path doing this. But it looks like NAIF will be testing on a Raspberry PI but probably still nothing to report as of yet (see page 2): https://naif.jpl.nasa.gov/naif/SPICE_News_Apr_2020.pdf
CSPICE on ARM is not currently supported by the Naif but I have heard that it is possible to compile CSPICE for ARM from the folks supporting the ruby spice wrapper. Currently spiceypy does not attempt the steps necessary to recompile spice when installed through pypi for Linux/macOS. I also don’t own a raspberry pi to attempt to figure out any additional steps that could be needed, but maybe the Ruby Spice authors would be willing to provide the necessary instructions. If you are able to compile CSPICE yourself then you can provide the shared library at install time using an environment variable (see spiceypy docs).
Hello vigilancewx,
I have spiceypy running on a Pi3. I managed to convert the libs from the ruby package into something workable. If you’re interested I’ll try to recap what steps were nescessary to do this.
Edit, I found the appropriate commands in the shell history, hope this works for you!
copy spice.so to the path where spiceypy expects it (path might be different for you)
sudo cp spice.so /usr/local/lib/python3.7/dist-packages/spiceypy/utils/
this install was also needed on my Pi3: sudo apt-get install libatlas-base-dev
Steps 7 and 8 are for converting the static spice library (lib.a) into a shared library (lib.so).
When you unpack the lib (step 7, “ar -x libcspice.a”) you’ll see a lot of object files (*.o) appear in the directory. This is good because now you don’t have to compile the spice code from scratch yourself.
Just pack these object files into a new shared library (step 8, “gcc -shared *.o -o spice.so”)
and copy the new file spice.so to the spiceypy/utils directory (step 9). Together with step 10 this method worked for me. I hope it will work for you too!
I am unable to repack the files
gcc -shared *.o -o spice.so
it returns the error
/usr/bin/ld: abort_.o: error adding symbols: file in wrong format
collect2: error: ld returned 1 exit status
gcc is version 10.2.0
I have a pi4 so I tried the 64 bit
pi@pi-desktop:~/naif-spice/ext/lib/x86_64-linux$ gcc -shared *.o -o spice.so
/usr/bin/ld: abort_.o: Relocations in generic ELF (EM: 62)
/usr/bin/ld: abort_.o: Relocations in generic ELF (EM: 62)
/usr/bin/ld: abort_.o: error adding symbols: file in wrong format
collect2: error: ld returned 1 exit status
Sorry to hear it doesn’t work as planned.
You can try and download my arm version of the file although I doubt it will work. https://hemelmechanica.nl/share/spice.so.tgz
Happy Xmas to you too!
Thank you all so much for this thread. I found phaseIV’s comments very helpful, but I needed to make several modifications to get this to work on my Pi3. Below are the steps I took. This is perhaps much more detail than is needed, but maybe it will help some future user:
Install python packages
–sudo apt-get install python3-pip
–sudo apt-get install libatlas-base-dev
–pip3 install numpy==1.18.1
–pip3 install scipy==1.4.1
–pip3 install setuptools wheel
–pip3 install --no-clean spiceypy==3.1.1
—the spiceypy installation will fail. Record the name of the tmp directory
For my setup, Python packages are installed in ~/.local/lib/python3.7/site-packages/ This should be added to the PATH:
– PATH=$PATH:/home/pi/.local/bin;export PATH
Download naif-spice-2.25.gem from https://lunaserv.lroc.asu.edu/downloads.html
– unpack this file, and unpack the data.tar.gz file.
– locate the libcspice.a file in data/ext/lib/arm-linux-gnueabihf
On the pi, unpack the libcspice.a file with: ar -x libcspice.a
repack to spice.so: gcc -shared *.o -o spice.so
copy spice.so to the path where spiceypy expects it
(in my case, this was the tmp directory - replace pip-install-z__gvcje with the tmp directory used)
sudo cp spice.so /tmp/pip-install-z__gvcje/spiceypy/spiceypy/utils
cd to this directory and rebuild spiceypy:
– python3 spiceypy build
– python3 spiceypy install (this failed for me)
copy the spiceypy file to the expected site_package directory
cp -R /tmp/pip-install-z__gvcje/spiceypy/spiceypy ~/.local/lib/python3.7/site-packages/
Test this by opening python and importing spiceypy:
– python3
– import spiceypy
SpiceyPy now supports ARM 64bit through the conda-forge just FYI, although I can see that the original posts were related to rpi3. SpiceyPy also can use an environment variable for the cspice.so file to simplify some of your steps