On Mon, Jun 9, 2008 at 8:46 AM, William Stein <[EMAIL PROTECTED]> wrote: > On Mon, Jun 9, 2008 at 8:13 AM, Mats <[EMAIL PROTECTED]> wrote: >> >> I tried to do "sudo easy_install feedparser", which worked. I can >> "import feedparser" from the python shell, but not from sage unless I >> explicitly add it to my path. >> > > You might want to try:
[snip]. You can also just do the following in Sage, since we evidently include easy_install: sage: !easy_install feedparser Searching for feedparse Best match: feedparser 4.1 Adding feedparser 4.1 to easy-install.pth file Using /Users/was/s/local/lib/python2.5/site-packages Processing dependencies for feedparser Finished processing dependencies for feedparser f > > (1) Download feedparser from here: > http://code.google.com/p/feedparser/downloads/list > > (2) Unzip feedparser-4.1.zip then type > > $ sage -python setup.py install > > (3) You'll see > running install > running build > running build_py > creating build > creating build/lib > copying feedparser.py -> build/lib > running install_lib > copying build/lib/feedparser.py -> > /Users/was/s/local/lib/python2.5/site-packages > byte-compiling /Users/was/s/local/lib/python2.5/site-packages/feedparser.py > to feedparser.pyc > running install_egg_info > Writing > /Users/was/s/local/lib/python2.5/site-packages/feedparser-4.1-py2.5.egg-info > > (4) Then feedparser is installed into sage: > > $ sage > ---------------------------------------------------------------------- > | SAGE Version 3.0.2, Release Date: 2008-05-24 | > | Type notebook() for the GUI, and license() for information. | > ---------------------------------------------------------------------- > > sage: import feedparser > sage: d = feedparser.parse("http://feedparser.org/docs/examples/atom10.xml") > sage: d['feed']['title'] > u'Sample Feed' > > > >> I also did exactly as you did and compared the paths; as per request: >> >> sage: import sys >> sage: sys.path >> ['/home/mats/install/sage-3.0.2-suse-x86_64-bit-x86_64-Linux/local/lib/ >> python2.5/site-packages/sympy/plotting', >> '/home/mats/install/sage-3.0.2-suse-x86_64-bit-x86_64-Linux/local/lib/ >> python2.5/site-packages/sympy/thirdparty/pyglet', >> '', >> '/home/mats/install/sage-3.0.2-suse-x86_64-bit-x86_64-Linux/local/ >> bin', >> '/home/mats/install/sage-3.0.2-suse-x86_64-bit-x86_64-Linux/local/lib/ >> python2.5/site-packages/setuptools-0.6c8-py2.5.egg', >> '/home/mats/install/sage-3.0.2-suse-x86_64-bit-x86_64-Linux/local/lib/ >> python2.5/site-packages/SQLAlchemy-0.4.3-py2.5.egg', >> '/home/mats/install/sage-3.0.2-suse-x86_64-bit-x86_64-Linux/local/ >> bin', >> '/home/mats/install/sage-3.0.2-suse-x86_64-bit-x86_64-Linux/local/lib/ >> python', >> '/home/mats/install/sage-3.0.2-suse-x86_64-bit-x86_64-Linux/local/lib/ >> python25.zip', >> '/home/mats/install/sage-3.0.2-suse-x86_64-bit-x86_64-Linux/local/lib/ >> python2.5/plat-linux2', >> '/home/mats/install/sage-3.0.2-suse-x86_64-bit-x86_64-Linux/local/lib/ >> python2.5/lib-tk', >> '/home/mats/install/sage-3.0.2-suse-x86_64-bit-x86_64-Linux/local/lib/ >> python2.5/lib-dynload', >> '/home/mats/install/sage-3.0.2-suse-x86_64-bit-x86_64-Linux/local/lib/ >> python2.5/site-packages', >> '/home/mats/install/sage-3.0.2-suse-x86_64-bit-x86_64-Linux/local/lib/ >> python2.5/site-packages/IPython/Extensions', >> '/home/mats/.sage/ipython'] >> >> # I took the liberty of inserting linebreaks for readability: >>>>> import sys >>>>> sys.path >> [ >> '', >> '/usr/local/lib64/python2.5/site-packages/setuptools-0.6c7- >> py2.5.egg', >> '/usr/local/lib64/python2.5/site-packages/TurboGears-1.0.4.4- >> py2.5.egg', >> '/usr/local/lib64/python2.5/site-packages/TurboKid-1.0.4-py2.5.egg', >> '/usr/local/lib64/python2.5/site-packages/TurboJson-1.1.2-py2.5.egg', >> '/usr/local/lib64/python2.5/site-packages/TurboCheetah-1.0-py2.5.egg', >> '/usr/local/lib64/python2.5/site-packages/simplejson-1.7.4-py2.5-linux- >> x86_64.egg', '/usr/local/lib64/python2.5/site-packages/ >> RuleDispatch-0.5a0.dev_r2306-py2.5-linux-x86_64.egg', '/usr/local/ >> lib64/python2.5/site-packages/PasteScript-1.6.2-py2.5.egg', >> '/usr/local/lib64/python2.5/site-packages/FormEncode-0.9-py2.5.egg', >> '/usr/local/lib64/python2.5/site-packages/DecoratorTools-1.7- >> py2.5.egg', >> '/usr/local/lib64/python2.5/site-packages/configobj-4.5.2-py2.5.egg', >> '/usr/local/lib64/python2.5/site-packages/CherryPy-2.3.0-py2.5.egg', >> '/usr/local/lib64/python2.5/site-packages/kid-0.9.6-py2.5.egg', >> '/usr/local/lib64/python2.5/site-packages/Cheetah-2.0.1-py2.5-linux- >> x86_64.egg', '/usr/local/lib64/python2.5/site-packages/ >> PyProtocols-1.0a0dev_r2302-py2.5-linux-x86_64.egg', '/usr/local/lib64/ >> python2.5/site-packages/PasteDeploy-1.3.1-py2.5.egg', >> '/usr/local/lib64/python2.5/site-packages/Paste-1.6-py2.5.egg', >> '/usr/local/lib64/python2.5/site-packages/Pylons-0.9.6.1-py2.5.egg', >> '/usr/local/lib64/python2.5/site-packages/Mako-0.1.8-py2.5.egg', >> '/usr/local/lib64/python2.5/site-packages/nose-0.10.1-py2.5.egg', >> '/usr/local/lib64/python2.5/site-packages/decorator-2.2.0-py2.5.egg', >> '/usr/local/lib64/python2.5/site-packages/Beaker-0.7.5-py2.5.egg', >> '/usr/local/lib64/python2.5/site-packages/WebHelpers-0.3.2- >> py2.5.egg', >> '/usr/local/lib64/python2.5/site-packages/Routes-1.7.1-py2.5.egg', >> '/usr/local/lib64/python2.5/site-packages/SQLAlchemy-0.4.4-py2.5.egg', >> '/usr/local/lib64/python2.5/site-packages/MySQL_python-1.2.2-py2.5- >> linux-x86_64.egg', '/usr/local/lib64/python2.5/site-packages/ >> feedparser-4.1-py2.5.egg', >> '/home/mats/install/pythonPackages', >> '/usr/lib/python25.zip', >> '/usr/lib64/python2.5', >> '/usr/lib64/python2.5/plat-linux2', >> '/usr/lib64/python2.5/lib-tk', >> '/usr/lib64/python2.5/lib-dynload', >> '/usr/lib64/python2.5/site-packages', >> '/usr/lib64/python2.5/site-packages/Numeric', >> '/usr/lib64/python2.5/site-packages/gtk-2.0', >> '/usr/lib64/python2.5/site-packages/wx-2.8-gtk2-unicode', >> '/usr/local/lib64/python2.5/site-packages' >> ] >> >> Best wishes, >> Mats >> >> On Jun 9, 4:01 am, mabshoff <[EMAIL PROTECTED]> wrote: >>> On Jun 8, 1:57 pm,Mats<[EMAIL PROTECTED]> wrote: >>> >>> > Hello, >>> >>> Hi, >>> >>> > I just installed a package using easy_install. I can import said >>> > package in a python interactive shell, but I cannot import the package >>> > in sage. Closer inspection reveals that: >>> >>> > import sys >>> > print sys.path # <-- FYI, sys.path is different in sage than in python >>> > interpreter >>> >>> Yes, sys.path is different, but that is to be expected: >>> >>> [EMAIL PROTECTED]:/scratch/mabshoff/release-cycle/sage-3.0.3.alpha2$ ./ >>> sage >>> ---------------------------------------------------------------------- >>> | SAGE Version 3.0.3.alpha1, Release Date: 2008-06-04 | >>> | Type notebook() for the GUI, and license() for information. | >>> ---------------------------------------------------------------------- >>> >>> sage: import sys >>> sage: print sys.path >>> ['/scratch/mabshoff/release-cycle/sage-3.0.3.alpha2/local/lib/ >>> python2.5/site-packages/sympy/plotting', '/scratch/mabshoff/release- >>> cycle/sage-3.0.3.alpha2/local/lib/python2.5/site-packages/sympy/ >>> thirdparty/pyglet', '', '/scratch/mabshoff/release-cycle/ >>> sage-3.0.3.alpha2/local/bin', '/scratch/mabshoff/release-cycle/ >>> sage-3.0.3.alpha2/local/lib/python2.5/site-packages/setuptools-0.6c8- >>> py2.5.egg', '/scratch/mabshoff/release-cycle/sage-3.0.3.alpha2/local/ >>> lib/python2.5/site-packages/SQLAlchemy-0.4.3-py2.5.egg', '/scratch/ >>> mabshoff/release-cycle/sage-3.0.3.alpha2/local/bin', '/scratch/ >>> mabshoff/release-cycle/sage-3.0.3.alpha2/local/lib/python', '/scratch/ >>> mabshoff/release-cycle/sage-3.0.3.alpha2/local/lib/python25.zip', '/ >>> scratch/mabshoff/release-cycle/sage-3.0.3.alpha2/local/lib/python2.5/ >>> plat-linux2', '/scratch/mabshoff/release-cycle/sage-3.0.3.alpha2/local/ >>> lib/python2.5/lib-tk', '/scratch/mabshoff/release-cycle/ >>> sage-3.0.3.alpha2/local/lib/python2.5/lib-dynload', '/scratch/mabshoff/ >>> release-cycle/sage-3.0.3.alpha2/local/lib/python2.5/site-packages', '/ >>> scratch/mabshoff/release-cycle/sage-3.0.3.alpha2/local/lib/python2.5/ >>> site-packages/IPython/Extensions', '/home/mabshoff/.sage/ipython'] >>> sage: >>> Exiting SAGE (CPU time 0m0.02s, Wall time 0m21.58s). >>> [EMAIL PROTECTED]:/scratch/mabshoff/release-cycle/sage-3.0.3.alpha2$ ./ >>> sage -python >>> Python 2.5.2 (r252:60911, Jun 4 2008, 15:41:24) >>> [GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux2 >>> Type "help", "copyright", "credits" or "license" for more information.>>> >>> import sys >>> >>> print sys.path >>> >>> ['', '/scratch/mabshoff/release-cycle/sage-3.0.3.alpha2/local/lib/ >>> python2.5/site-packages/setuptools-0.6c8-py2.5.egg', '/scratch/ >>> mabshoff/release-cycle/sage-3.0.3.alpha2/local/lib/python2.5/site- >>> packages/SQLAlchemy-0.4.3-py2.5.egg', '/scratch/mabshoff/release-cycle/ >>> sage-3.0.3.alpha2', '/scratch/mabshoff/release-cycle/sage-3.0.3.alpha2/ >>> local/lib/python', '/scratch/mabshoff/release-cycle/sage-3.0.3.alpha2/ >>> local/lib/python25.zip', '/scratch/mabshoff/release-cycle/ >>> sage-3.0.3.alpha2/local/lib/python2.5', '/scratch/mabshoff/release- >>> cycle/sage-3.0.3.alpha2/local/lib/python2.5/plat-linux2', '/scratch/ >>> mabshoff/release-cycle/sage-3.0.3.alpha2/local/lib/python2.5/lib-tk', >>> '/scratch/mabshoff/release-cycle/sage-3.0.3.alpha2/local/lib/python2.5/ >>> lib-dynload', '/scratch/mabshoff/release-cycle/sage-3.0.3.alpha2/local/ >>> lib/python2.5/site-packages'] >>> >>> >>> >>> > Not sure if this is a bug. I closed and reopened sage. >>> >>> Could you give a concrete example what you did, i.e. which python >>> package you installed and how sys.path looks for you in the various >>> configs? >>> >>> > Best wishes, >>> >Mats >>> >>> Cheers, >>> >>> Michael >> >> >> >> > > > > -- > William Stein > Associate Professor of Mathematics > University of Washington > http://wstein.org > -- William Stein Associate Professor of Mathematics University of Washington http://wstein.org --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---