[AstroPy] Importing packages across distributions?

Thomas Robitaille thomas.robitaille at gmail.com
Mon May 6 18:35:37 EDT 2013


On 6 May 2013 23:30, Nathan Goldbaum <goldbaum at ucolick.org> wrote:
> Hi Eric,
>
> I think you need to recursively add all the subfolders in the anaconda
> folder to your sys.path.  You can also manage all this from the command line
> by setting the PYTHONPATH.

I strongly recommend against this - see my previous email. For a
start, CASA and Anaconda may be using different Python versions (in
fact they are) and some of the Anaconda packages may conflict with
CASA.

The correct way to do it is to install the packages directly into CASA:

https://github.com/astrofrog/casa-python

Eric confirmed off-list that this worked.

Cheers,
Tom

>
> I'm not familiar with CASA, but presumably it should be possible to install
> it in a way that uses anaconda's python instead of relying on its own, that
> way you won't need to worry about this PYTHONPATH mess.  Instructions on how
> to build CASA from source are available here:
> https://safe.nrao.edu/wiki/bin/view/Main/ScottRankinCasaBuildNotes
>
> Cheers,
>
> Nathan
>
>
> On Mon, May 6, 2013 at 2:22 PM, 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
>



More information about the AstroPy mailing list