[AstroPy] ImportError: cannot import name _compiler

Erik Bray embray at stsci.edu
Thu Jul 9 10:57:50 EDT 2015


On 07/09/2015 10:50 AM, Erik Bray wrote:
> It looks like you're still in the directory you unpacked the astropy source
> into.  Python adds the current working directory to your import path by default,
> so if you're still in the source tree it will try to import from there, rather
> than the version you installed. (Still odd since it should still work even then.)

Ah, I see now why it didn't work for you.  The mechanism that enables automatic 
in-place build for import from the source code only works in a git clone, but 
not from a source tarball.  That should probably be fixed.  (Still, just change 
directories out of the unpacked source and you should be fine.)

Erik

> Incidentally, unless you have a specific reason not to, you should use pip to
> install Python packages:
>
> pip install --user astropy
>
> Erik
>
> On 07/09/2015 08:47 AM, Steffen Brinkmann wrote:
>> Hello,
>>
>> I just installed locally with
>>
>> $ python setup.py install --user
>>
>> Now when I import astropy, I get
>>
>>
>>>>>
>> In [1]: import astropy
>> ---------------------------------------------------------------------------
>> ImportError                               Traceback (most recent call last)
>> <ipython-input-1-d192094ef7da> in <module>()
>> ----> 1 import astropy
>>
>> /disk1/brinkmann/code/astropy-1.0.3/astropy/__init__.py in <module>()
>>        323     log = _init_log()
>>        324
>> --> 325     _initialize_astropy()
>>        326
>>        327     from .utils.misc import find_api_page
>>
>> /disk1/brinkmann/code/astropy-1.0.3/astropy/__init__.py in
>> _initialize_astropy()
>>        236
>>        237     try:
>> --> 238         from .utils import _compiler
>>        239     except ImportError:
>>        240         if is_astropy_source_dir:
>>
>> ImportError: cannot import name _compiler
>
> _______________________________________________
> AstroPy mailing list
> AstroPy at scipy.org
> http://mail.scipy.org/mailman/listinfo/astropy
>




More information about the AstroPy mailing list