Open fergalm opened 11 years ago
what do you mean by "cspice is compiling 64 bit as well' ? Are you compiling your own cspice? I am asking because usually NAIF delivers usable binaries in its distribution files?
Hi there!
I'm bumping into exactly the same problem described above. I'm running the 64bit Linux SPICE (http://naif.jpl.nasa.gov/naif/toolkit_C_PC_Linux_GCC_64bit.html) and python 2.7.
I also tried Apollo117's Python3 fork, but again got the same error.
Any advice?
Hi Apodemus,
Firstly, apologies to Michael Aye, for some reason I never saw your email back when I was trying to get things installed. For what it's worth, I think I downloaded source code and complied it myself, but I can't be sure.
Anyway, I fixed the missing init function error, but this was a couple of years ago, and my memory is hazy about what I did exactly. I think the solution was to follow the manual instructions in README.rst
I think the line python mkwrapper.py /path/to/cspice > spicemodule.c
hardcoded a path to a shared object library previously generated by CSpice so that python knew where to look for it.
Hope that helps.
Fergal
On 6 August 2014 05:48, apodemus notifications@github.com wrote:
Hi there!
I'm bumping into exactly the same problem described above. I'm running the 64bit Linux SPICE ( http://naif.jpl.nasa.gov/naif/toolkit_C_PC_Linux_GCC_64bit.html) and python 2.7.
I also tried Apollo117's Python3 fork, but again got the same error.
Any advice?
— Reply to this email directly or view it on GitHub https://github.com/rca/PySPICE/issues/6#issuecomment-51329375.
Hi Fergal
The manual build did the trick. So simple - should have done that straight away!
Thanks!
Have the same thing happening. Can not do the manual install as
python mkwrapper.py /myPathTo/PySPICE-master/cspice > spicemodule.c
fails with
File "mkwrapper.py", line 1077, in
I had pyspice working on several machines under linux, but with mint 17 it now fails. sidenote: when executing python setup.py build_ext it returns the same error as above, however rerunning the command will let it go through. also the install part works with no complaints.
cheers andre
Quick solution for N0065:
thanks, that worked fine. Although some funky permission issues:
/usr/local/lib/python2.7/dist-packages/spice/ and _spice.so had reading permissions disabled. so python could not import it although it was installed just fine.
I have the same problem. The fix (manual installation with hardcoded full path) didn't work for me, on Ubuntu 14.04 LTS 64b and Mac OSX Mavericks (still 64b). Funky things happen with the parsing of include files in mkwrapper.py. In the file cspice/include/SpiceZpr.h, the line
SpiceDouble termpts [ ][3] );
seems to give problems, producing in turn that
ValueError: invalid literal for int() with base 10: ''
message. That open bracket/space/closed bracket raises an exception in mkwrapper.py. Eliminating the space doesn't seem to take the problem away.
This does not happen in linux 32b AFAIK, as other colleagues installed it correctly, but I haven't had the time to install it on a VM and test it myself.
Quick solution for N0065:
@drbitboy thanks for this fix.
I have problems after installing PySPICE for linux suse 32 bit to use SPICE in the 32 bit version. The spice package correctly appears in the python library but I can not use any of the functions, python does not recognize them. What could be the problem?
Please specify "appears in the python library". Do you mean "import spice" worked? And what do you mean by "python does not recognize them". Just show the commands you are trying to do and their error messages.
On Mon, Mar 16, 2015 at 8:47 AM, antonio19812 notifications@github.com wrote:
I have problems after installing PySPICE for linux suse 32 bit to use SPICE in the 32 bit version. The spice package correctly appears in the python library but I can not use any of the functions, python does not recognize them. What could be the problem?
— Reply to this email directly or view it on GitHub https://github.com/rca/PySPICE/issues/6#issuecomment-81708551.
This is the screenshot. I need to work with spice and I am trying to learn how to use it. First I would like to try some examples of the various functions. I need to use for example GETFOV and I was trying to reproduce an example from the documentation but when I try to call the function and load the kernel with FURNSH, python just see them as undefined variables. WHY?? how should i call the functions??? I usually works with python but this time i have problems
This wrapper of SPICE is not really maintained. I'd checkout SpiceyPy by Andrew Annex if I were you: https://github.com/AndrewAnnex/SpiceyPy
Do this at a shell prompt:
python -c 'import spice;spice.tkvrsn("toolkit")'
please and paste the result in a response here.
whoops that should be:
python -c 'import spice;print(spice.tkvrsn("toolkit"))'
This is what I got on the shell prompt:
antonio@linux-zrhc:~> python -c 'import spice;print(spice.tkvrsn("toolkit"))'
Traceback (most recent call last):
File "
If you will help me it would be great...
I'll do my best
try this command:
nm -e path/to/_spice.so | grep init
and post the results again.
I don't know where your _spice.so file will be; for me it is in
build/lib.linux*/
under the top of the PySPICE/ area, but it is also in
~/.local/lib/python2.7/site-packages/_spice.so
the result is : nm: 'path/to/_spice.so': No such file
you have to figure out what "path/to/" is.
and how can I do it? i am getting confused !!!
there is a file called _spice.so, it has been installed on your system, the "path/to/" is the directory where it resides. You need to figure out what that directory is. e.g. try
nm -e /usr/lib/python2.7/site-packages/_spice.so | grep init
?
It is exactly in the site-packages directory!! I found it before reading your post but I could not enter here!! What was wrong with the first installation? I did all that was in the instructions
I used "path/to/" as a placeholder for you to replace.
what was the result of the nm ... grep command?
here is the result :
00002ee8 t __frame_dummy_init_array_entry 0000095c T _init
Actually, if you need the GETFOV function, you might indeed be better of with SpiceyPy, because our PySpice implementation does not yet encompass all available SPICE functions. @johnnycakes79 could confirm, if GETFOV works with SpiceyPy. I have a github version of PySpice that has GETFOV working as well, and maybe Brian's version works as well, but I don't remember if we ever merged it into here?
Actually I have to use various function from Spice, not GETFOV but GETFOV can help me to understand some key elements of spice and the kernels..I did not know SpiceyPy, I have been told only about PySpice.
Your PySPICE did not build correctly, something is missing.
1) you need a symlink, named cspice, to the top of the NAIF cspice tree
2) python setup.py install
If you want to do a google hangout I can watch and coach you through it.
This is what I did..
I downloaded the CSpice.tar.Z file for linux and I uncompressed it in the terminal with tar xfzv
then I put the Cspice uncompressed folder in the PySPICE-master folder that is obtained by uncompressing the PySpice-master.zip ..and then I followed the instructions of the readme file..
hmm, that should have worked.
try using my PySPICE (https://github.com/drbitboy/PySPICE), put in cspice, then
rm -R ./build python setup.py build python tests/test_btc.py
I made what you suggest, and then the result of the test was :
linux-zrhc:/home/antonio/Documents/PySPICE-master # python tests/test_btc.py
Traceback (most recent call last):
File "tests/test_btc.py", line 1, in
It is maybe late, if you want to stop here for today I can understand it..really no problem
i think the problem is PySpice and I would really like to know what it is, I have tried to install SpiceyPy and it works. Once I have installed it this is what I do : import SpiceyPy as sp
then just doing sp.(function_name) i obtain the list of all the functions..this should be the right thing, no?
There is something wrong with the build.
can you do a complete clean install?
get the .zip from here:
put cspice in a safe place:
mv cspice ~/
unzip to a clean place:
rm -R PySPICE-master.zip unzip -q PySPICE-master.zip
build:
cd PySPICE-master ln -s ~/cspice ./cspice python setup.py build
and post all those commands and the output here.
Thanks!
Also, do this after the build:
tail -50 spicemodule.c
and paste the results here also.
Thanks!
I have to thank you first!! Yes I can do a complete clean install , following your lines here!!
sorry but i am not an expert of linux : cspice must be put in a different folder or in the uncompressed PySPICE folder, before executing the line
ln -s ~/cspice ./cspice
?
The idea is that the cspice folder goes into a safe place because you only
change that very rarely. So you move the uncompressed cspice folder, for
example, into your home folder with "mv cspice ~".
Then you cd
into the PySPICE folder, and in there you type : "ln -s
~/cspice" or "ln -s ~/cspice ./cspice" as Brian said, but that does the
same, because by default this symbolic link goes where you currently are.
This symbolic (or 'soft') link makes it look like to the PySPICE
compilation that the cspice folder is just there inside the PySPICE folder,
while it actually is in your home folder.
On Mon, Mar 16, 2015 at 7:56 PM, antonio19812 notifications@github.com wrote:
sorry but i am not an expert of linux : cspice must be put in a different folder or in the uncompressed PySPICE folder, before executing the line
ln -s ~/cspice ./cspice
?
— Reply to this email directly or view it on GitHub https://github.com/rca/PySPICE/issues/6#issuecomment-82030046.
oh thanks!!!I have always worked with windows and suddenly I have to change and move to linux, it is just few days since I have begun with it..thanks i am going to do it...
problem, I obtain this one :
ntonio@linux-zrhc:~/Pictures/PySPICE-master> cd antonio@linux-zrhc:~> mv cspice ~ mv: ‘cspice’ and ‘/home/antonio/cspice’ are the same file antonio@linux-zrhc:~> cd Pictures antonio@linux-zrhc:~/Pictures> cd PySPICE-master antonio@linux-zrhc:~/Pictures/PySPICE-master> ln-s~/cspice ./cspice bash: ln-s~/cspice: No such file or directory antonio@linux-zrhc:~/Pictures/PySPICE-master>
and cspice is in the directory that contain Pictures
there are two spaces in there
ln -s ~/cspice
-b
other problem : linux-zrhc:/home/antonio/Pictures/PySPICE-master # python setup.py build Unable to find CSPICE source at cspice. Please untar the source there or set the environment variable CSPICE_SRC
it is endless...
other problem : linux-zrhc:/home/antonio/Pictures/PySPICE-master # python setup.py build Unable to find CSPICE source at cspice. Please untar the source there or set the environment variable CSPICE_SRC
No, not endless, we just need patience; you are very close to solving this.
That problem was caused by mis-typing the "ln -s ~/cspice" command, that is, typing it without the spaces between the ln, -s, and ~/cspice.
Go back and enter the
command, with the spaces this time, then do the
command again.
@michaelaye the getfov test in SpiceyPy works. I've not used it myself... yet!
Thank you so much for the hint, I have installed SpiceyPy in the meantime and at the moment it seems to work fine. By the way @johnnycakes79 I am an ESAC trainee and I saw here some minutes ago that you are not so far..I hope I can talk with you just to thank you directly . However I am still curious to understand why PySpice does not work on my laptop..
an alternative to the ln command is to do this:
If your shell is csh or tcsh (use the ps command to find out):
setenv CSPICE_SRC ~/cspice
or, if your shell is bash (again, use ps):
export CSPICE_SRC=~/cspice
those commands will tell the PySPICE setup.py where to find the cspice includes and libraries; the effect of those commands is persistent until you exit the shell or terminal window.
Here it was night @drbitboy and I stopped trying but I am going on now again. Yes we need a lot of patience, you have a lot!!! thanks for helping me..
hmm, I just looked at SpiceyPy again, it has a lot more coverage (of the SPICE library) than the last time I checked.
@antonio19812 I'm in the M-Building (M004). @drbitboy I'm pretty "convinced" of SpiceyPy up until now... and the author @andrewannex appreciates help with the testing and documentation. I'm also planning to prepare a suite of IPython Notebooks with SPICE tutorials (publicly available of curse) if anyone wants to help out.
I'm having some trouble getting PySpice installed on my machine. It compiles without warning:
$ CSPICE_SRC=/home/fmullall/apps/cspice/ $ export CSPICE_SRC $ python setup.py build_ext running build_ext building '_spice' extension creating build creating build/temp.linux-x86_64-2.7 gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/home/fmullall/apps/cspice/include -I/usr/include/python2.7 -c pyspice.c -o build/temp.linux-x86_64-2.7/pyspice.o gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/home/fmullall/apps/cspice/include -I/usr/include/python2.7 -c spicemodule.c -o build/temp.linux-x86_64-2.7/spicemodule.o creating build/lib.linux-x86_64-2.7 gcc -pthread -shared build/temp.linux-x86_64-2.7/pyspice.o build/temp.linux-x86_64-2.7/spicemodule.o -L/home/fmullall/apps/cspice/lib -L/usr/lib64 -lcspice -lpython2.7 -o build/lib.linux-x86_64-2.7/_spice.so
and installs without incident: $ python setup.py install --prefix=~/.local/ running install running build running build_py creating build/lib.linux-x86_64-2.7/spice copying spice/objects.py -> build/lib.linux-x86_64-2.7/spice copying spice/init.py -> build/lib.linux-x86_64-2.7/spice copying spice/misc.py -> build/lib.linux-x86_64-2.7/spice running build_ext running install_lib copying build/lib.linux-x86_64-2.7/_spice.so -> /home/fmullall/.local//lib64/python2.7/site-packages running install_egg_info Removing /home/fmullall/.local//lib64/python2.7/site-packages/Spice-1.0-py2.7.egg-info Writing /home/fmullall/.local//lib64/python2.7/site-packages/Spice-1.0-py2.7.egg-info
But when I run it, I get an error message: $ PYTHONPATH=$PYTHONPATH:/home/fmullall/.local/lib64/python2.7/site-packages/ $ python -c 'import spice' Traceback (most recent call last): File "", line 1, in
File "spice/init.py", line 3, in
from misc import
File "spice/misc.py", line 3, in
from _spice import
ImportError: dynamic module does not define init function (init_spice)
The readme files suggests this might be a 32/64 bit problem, but cspice is compiling 64 bit as well, as best I can tell. Any ideas what I'm doing wrong?