[AstroPy] Importing packages across distributions?

Tom Aldcroft aldcroft at head.cfa.harvard.edu
Mon May 6 18:38:41 EDT 2013


On Mon, May 6, 2013 at 6:09 PM, Christoph Deil <
deil.christoph at googlemail.com> wrote:

> Hi,
>
> I've run into a similar problem … I wanted to install astropy into the
> Python that comes with the
> Chandra [1] and Fermi [2] analysis tools to be able to use astropy and
> their tools from the same script.
> [1] http://cxc.harvard.edu/ciao/index.html
> [2] http://fermi.gsfc.nasa.gov/ssc/data/analysis/software/
>
> Sometimes it is possible to make this work, but most of the time (at least
> on Mac) the astropy build fails.
> The problem is that these analysis packages are basically impossible to
> build from source (at least on Mac),
> so one has to get the binary distribution and then some incompatibility
> with the compiler or other libraries
> on the user machine occurs when trying to build astropy.
>

Are you using the "ciaorun" prefix, as in "ciaorun python setup.py install"
?  This probably won't solve all compiler/library issues, but it's a good
start.


> I guess there's nothing that can be done to improve this situation from
> the astropy side,
> except maybe share hacks how to make it work?
> Or if someone knows people maintaining those big astro analysis packages
> that come with their
> own Python to ask them to test if building astropy works with their Python
> on common platforms?
>

For CIAO at least a good strategy is putting in helpdesk tickets.  That
gives the CIAO team an idea of how people are using CIAO Python and what
needs they should address.  I certainly think that a thread aimed at
providing guidance on building external packages within CIAO Python would
be valuable.

- Tom


>
> Christoph
>
> On May 6, 2013, at 11:28 PM, Thomas Robitaille <
> thomas.robitaille at gmail.com> wrote:
>
> > Hi Eric,
> >
> > CASA uses it's own Python installation, which is separate from
> > Anaconda and other distributions. While it's possible to mess with
> > PYTHONPATH to make CASA and other Python distributions see the same
> > packages, it's kind of a hack. Instead, the easiest way (in my
> > opinion) to install Python packages into CASA is to use the script
> > I've written and made available here:
> >
> > https://github.com/astrofrog/casa-python
> >
> > In fact, the README shows you how to install Astropy into CASA.
> >
> > Let me know if you have any trouble installing it.
> >
> > Cheers,
> > Tom
> >
> >
> > On 6 May 2013 23:22, Eric L. N. Jensen <ejensen1 at swarthmore.edu> wrote:
> >> Hi all,
> >>
> >> First, thanks for your answers to my previous question about an
> easy-to-install python distribution - I ended up installing anaconda.
> >>
> >> My next question is most likely a pretty elementary bit of python, but
> I haven't succeeded in finding a discussion of it: to what extent are
> packages installed under one distribution's tree importable by another
> distribution?  I had thought/hoped that after installing anaconda (with its
> rich collection of auxiliary packages) that I might be able to do the
> following within CASA (with has its own python installation):
> >>
> >>   sys.path.append('/Users/ejensen1/anaconda')
> >>
> >>   from astropy import coordinates as coord
> >>
> >> but that fails with "No module named astropy".    The situation is
> similar if I can start up the Mac OS system-distributed python, so it's not
> just a CASA thing.
> >>
> >> So my specific question is whether this sort of thing is ever possible
> (simply importing a module from somewhere else in a directory tree), and
> more generally where to find some documentation / discussion of this issue
> - all the discussions I've found so far (probably not searching on the
> right words) imply that importing modules is simply a matter of setting the
> path correctly, but it's clearly more complicated than that.
> >>
> >> Thanks,
> >>
> >> Eric
> >>
> >>
> >>
> >>
> >> _______________________________________________
> >> AstroPy mailing list
> >> AstroPy at scipy.org
> >> http://mail.scipy.org/mailman/listinfo/astropy
> > _______________________________________________
> > AstroPy mailing list
> > AstroPy at scipy.org
> > http://mail.scipy.org/mailman/listinfo/astropy
>
> _______________________________________________
> AstroPy mailing list
> AstroPy at scipy.org
> http://mail.scipy.org/mailman/listinfo/astropy
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/astropy/attachments/20130506/bc421633/attachment.html>


More information about the AstroPy mailing list