Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: TypeError upon import #77

Closed
ljlamarche opened this issue Dec 6, 2022 · 3 comments
Closed

[Bug]: TypeError upon import #77

ljlamarche opened this issue Dec 6, 2022 · 3 comments
Labels

Comments

@ljlamarche
Copy link

What happened?

When attempting to import pymap3d, I get the following TypeError:

TypeError: expected string or bytes-like object

I have attempted to reinstall pymap3d, but the error persists.

Computer: MacOS
Python: 3.9.15

Relevant log output

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/e30737/miniconda3/envs/py39/lib/python3.9/site-packages/pymap3d/__init__.py", line 34, in <module>
    from .aer import aer2ecef, aer2geodetic, ecef2aer, geodetic2aer
  File "/Users/e30737/miniconda3/envs/py39/lib/python3.9/site-packages/pymap3d/aer.py", line 7, in <module>
    from .ecef import ecef2enu, ecef2geodetic, enu2uvw, geodetic2ecef
  File "/Users/e30737/miniconda3/envs/py39/lib/python3.9/site-packages/pymap3d/ecef.py", line 7, in <module>
    from .eci import ecef2eci, eci2ecef
  File "/Users/e30737/miniconda3/envs/py39/lib/python3.9/site-packages/pymap3d/eci.py", line 10, in <module>
    import astropy.units as u
  File "/Users/e30737/miniconda3/envs/py39/lib/python3.9/site-packages/astropy/units/__init__.py", line 17, in <module>
    from .quantity import *
  File "/Users/e30737/miniconda3/envs/py39/lib/python3.9/site-packages/astropy/units/quantity.py", line 25, in <module>
    from astropy.utils.compat import NUMPY_LT_1_22
  File "/Users/e30737/miniconda3/envs/py39/lib/python3.9/site-packages/astropy/utils/compat/__init__.py", line 19, in <module>
    from .numpycompat import *  # noqa
  File "/Users/e30737/miniconda3/envs/py39/lib/python3.9/site-packages/astropy/utils/compat/numpycompat.py", line 14, in <module>
    NUMPY_LT_1_19 = not minversion('numpy', '1.19')
  File "/Users/e30737/miniconda3/envs/py39/lib/python3.9/site-packages/astropy/utils/decorators.py", line 546, in wrapper
    return function(*args, **kwargs)
  File "/Users/e30737/miniconda3/envs/py39/lib/python3.9/site-packages/astropy/utils/introspection.py", line 167, in minversion
    return Version(module_version) >= Version(version)
  File "/Users/e30737/miniconda3/envs/py39/lib/python3.9/site-packages/packaging/version.py", line 264, in __init__
    match = self._regex.search(version)
TypeError: expected string or bytes-like object
@ljlamarche ljlamarche added the bug label Dec 6, 2022
@scivision
Copy link
Member

I just tried with Python 3.9.15 and didn't see the same AstroPy import issue. Can you tell the Astropy version like:

 python -c "import numpy,astropy; print('Numpy ', numpy.__version__, ' AstroPy', astropy.__version__)"

Numpy 1.23.4 AstroPy 5.1

@ljlamarche
Copy link
Author

Ah, sorry, I had forgotten about this. It was an astropy issue. Manually updating astropy (which I hadn't done for some time) solved the problem. Unfortunately I don't recall what astropy version I was at before, but it works for me now with 5.0.1.

@scivision
Copy link
Member

OK thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants