question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Astropy 2.0.16 not working after clean install

See original GitHub issue

Any idea why the following isn’t working?

conda create --name py2.7.15 python=2.7.15
conda activate py2.7.15
conda install astropy

Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: /nfs/slac/g/ki/ki08/kocevski/bin/miniconda2/envs/py2.7.15

  added / updated specs:
    - astropy


The following NEW packages will be INSTALLED:

  astropy            pkgs/main/linux-64::astropy-2.0.16-py27h7b6447c_0
  atomicwrites       pkgs/main/noarch::atomicwrites-1.4.0-py_0
  attrs              pkgs/main/noarch::attrs-20.3.0-pyhd3eb1b0_0
  blas               pkgs/main/linux-64::blas-1.0-mkl
  funcsigs           pkgs/main/linux-64::funcsigs-1.0.2-py27_0
  intel-openmp       pkgs/main/linux-64::intel-openmp-2020.2-254
  libgfortran-ng     pkgs/main/linux-64::libgfortran-ng-7.3.0-hdf63c60_0
  mkl                pkgs/main/linux-64::mkl-2020.2-256
  mkl-service        pkgs/main/linux-64::mkl-service-2.3.0-py27he904b0f_0
  mkl_fft            pkgs/main/linux-64::mkl_fft-1.0.15-py27ha843d7b_0
  mkl_random         pkgs/main/linux-64::mkl_random-1.1.0-py27hd6b4f25_0
  more-itertools     pkgs/main/linux-64::more-itertools-5.0.0-py27_0
  numpy              pkgs/main/linux-64::numpy-1.16.6-py27hbc911f0_0
  numpy-base         pkgs/main/linux-64::numpy-base-1.16.6-py27hde5b4d6_0
  pluggy             pkgs/main/linux-64::pluggy-0.6.0-py27_0
  py                 pkgs/main/noarch::py-1.10.0-pyhd3eb1b0_0
  pytest             pkgs/main/linux-64::pytest-3.6.4-py27_0
  six                pkgs/main/noarch::six-1.15.0-py_0


Proceed ([y]/n)? y

Preparing transaction: done
Verifying transaction: done
 
conda list
> astropy                   2.0.16           py27h7b6447c_0  

(py2.7.15)$ python
Python 2.7.15 |Anaconda, Inc.| (default, Dec 14 2018, 19:04:19) 
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from astropy import coordinates as coord
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/nfs/slac/g/ki/ki08/kocevski/bin/miniconda2/envs/py2.7.15/lib/python2.7/site-packages/astropy/coordinates/__init__.py", line 12, in <module>
    from .angles import *
  File "/nfs/slac/g/ki/ki08/kocevski/bin/miniconda2/envs/py2.7.15/lib/python2.7/site-packages/astropy/coordinates/angles.py", line 17, in <module>
    from . import angle_utilities as util
  File "/nfs/slac/g/ki/ki08/kocevski/bin/miniconda2/envs/py2.7.15/lib/python2.7/site-packages/astropy/coordinates/angle_utilities.py", line 26, in <module>
    from .. import units as u
  File "/nfs/slac/g/ki/ki08/kocevski/bin/miniconda2/envs/py2.7.15/lib/python2.7/site-packages/astropy/units/__init__.py", line 16, in <module>
    from .decorators import *
  File "/nfs/slac/g/ki/ki08/kocevski/bin/miniconda2/envs/py2.7.15/lib/python2.7/site-packages/astropy/units/decorators.py", line 11, in <module>
    from .physical import _unit_physical_mapping
  File "/nfs/slac/g/ki/ki08/kocevski/bin/miniconda2/envs/py2.7.15/lib/python2.7/site-packages/astropy/units/physical.py", line 17, in <module>
    from . import astrophys
  File "/nfs/slac/g/ki/ki08/kocevski/bin/miniconda2/envs/py2.7.15/lib/python2.7/site-packages/astropy/units/astrophys.py", line 46, in <module>
    def_unit(['lyr', 'lightyear'], (_si.c * si.yr).to(si.m),
  File "/nfs/slac/g/ki/ki08/kocevski/bin/miniconda2/envs/py2.7.15/lib/python2.7/site-packages/astropy/constants/constant.py", line 45, in wrapper
    self.unit.to(inst.unit)
  File "/nfs/slac/g/ki/ki08/kocevski/bin/miniconda2/envs/py2.7.15/lib/python2.7/site-packages/astropy/units/quantity.py", line 895, in unit
    return self._unit
  File "/nfs/slac/g/ki/ki08/kocevski/bin/miniconda2/envs/py2.7.15/lib/python2.7/site-packages/astropy/utils/decorators.py", line 770, in __get__
    val = self.fget(obj)
  File "/nfs/slac/g/ki/ki08/kocevski/bin/miniconda2/envs/py2.7.15/lib/python2.7/site-packages/astropy/constants/constant.py", line 169, in _unit
    return Unit(self._unit_string)
  File "/nfs/slac/g/ki/ki08/kocevski/bin/miniconda2/envs/py2.7.15/lib/python2.7/site-packages/astropy/units/core.py", line 1820, in __call__
    raise ValueError(msg)
ValueError: 'm / (s)' did not parse as unit: 'module' object has no attribute '_tabversion'

The contents of my sys.path are as follows:

>>> import sys
>>> sys.path
['', '/nfs/slac/g/ki/ki08/kocevski/bin/miniconda2/envs/py2.7.15/lib/python27.zip', '/nfs/slac/g/ki/ki08/kocevski/bin/miniconda2/envs/py2.7.15/lib/python2.7', '/nfs/slac/g/ki/ki08/kocevski/bin/miniconda2/envs/py2.7.15/lib/python2.7/plat-linux2', '/nfs/slac/g/ki/ki08/kocevski/bin/miniconda2/envs/py2.7.15/lib/python2.7/lib-tk', '/nfs/slac/g/ki/ki08/kocevski/bin/miniconda2/envs/py2.7.15/lib/python2.7/lib-old', '/nfs/slac/g/ki/ki08/kocevski/bin/miniconda2/envs/py2.7.15/lib/python2.7/lib-dynload', '/nfs/slac/g/ki/ki08/kocevski/bin/miniconda2/envs/py2.7.15/lib/python2.7/site-packages'

I’m using this install/enviroment to support a legacy data analysis pipeline that is written in python2, so upgrading to python3 isn’t really an option unfortunately. Any suggestions on how to resolve this problem would be appreciated.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
taldcroftcommented, Jan 8, 2021

Looks like this was resolved so closing.

1reaction
dankocevskicommented, Jan 8, 2021

Thanks for the help. I tried my best to ensure that outside builds were not being called referenced in my PYTHONPATH and still encountered the error.

What did work was installing astropy 2.0.15 via pip, which uninstalled the conda installed 2.0.16 version and built a new copy of the library. I’m guessing the problem was that conda was finding a cached version of 2.0.16 which somehow didn’t build or download properly.

Thanks again!

Read more comments on GitHub >

github_iconTop Results From Across the Web

import astropy.io.fits fails · Issue #5878 - GitHub
I have a RH 7 machine, which I attempted to install astropy via pip. The package built and installed, but fails in use....
Read more >
How to install Astropy 5.0 using pip? - python - Stack Overflow
You have tried reinstalling it but you can try uninstalling it... pip uninstall astropy. Or maybe reinstall pip altogether along with your ...
Read more >
Installation — Astropy v5.2
Attempting to use pip to upgrade your installation of astropy itself may result in a corrupted installation.
Read more >
Astropy: A community Python package for astronomy
Motivated by these issues, the Astropy project was started in 2011 out of a ... Since Quantity objects can operate with NumPy arrays,...
Read more >
Full Changelog — Astropy v3.2.3 - Read the Docs
Fix sky coordinate matching when a dimensionless distance is provided. ... We now require setuptools 30.3.0 or later to install the core astropy...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found