I am trying to build an installer for a sage script using setuptools. Here is what I have.
My setup.py
file:
#!/usr/bin/env python2
from setuptools import setup
__name__ = 'sage-test'
__version__ = '0.0'
setup(name=__name__,
scripts=['sage-test'],
)
The sage-test
file:
#!/usr/bin/env sage
from sage.all import GF
print(GF(5))
I now do ./setup.py build
and ./setup.py install
. When I try to run sage-test, I get the following error:
Traceback (most recent call last):
File "/usr/bin/sage-test", line 4, in <module>
__import__('pkg_resources').run_script('sage-test==0.0.0', 'sage-test')
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 517, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 1443, in run_script
exec(script_code, namespace, namespace)
File "/usr/lib/python2.7/site-packages/sage_test-0.0.0-py2.7.egg/EGG-INFO/scripts/sage-test", line 3, in <module>
__requires__ = 'sage-test==0.0.0'
ImportError: No module named sage.all
Any ideas how to get this to work? (Note that I can run ./sage-test
within the current directory and everything works.)
This may not help, but this looks suspicious.
Maybe you need to do everything within
sage -sh
- I wouldn't be surprised if there was some env var that was not set up properly. I don't know exactly why but maybe it's picking up your system Python somehow.