Error of "No module named 'astrometry'"

50 views
Skip to first unread message

Pachacoti

unread,
Apr 26, 2024, 4:15:00 AMApr 26
to astrometry
Hi,

I was able to run solve-field successfully on my Ubuntu 20.04 previously. But now as I try to run solve-field, the following error pops out:
Reading input file 1 of 1: "test.fits"...
Traceback (most recent call last):
  File "/usr/bin/image2pnm", line 14, in <module>
    from astrometry.util.image2pnm import main
ModuleNotFoundError: No module named 'astrometry'
augment-xylist.c:591:backtick Failed to run command: /usr/bin/image2pnm --infile test.fits --uncompressed-outfile /tmp/tmp.uncompressed.uZASdi --outfile /tmp/tmp.ppm.Whaszi --ppm --mydir /usr/bin/solve-field
 ioutils.c:568:run_command_get_outputs Command failed: return value 1
This seems to be traced back to image2pnm. I reinstalled astrometry.net and upgraded to the latest version 0.94 from v0.93. While the installation appeared to be flawless, the issue remains.

I saw that this issue has been raised here previously, but reinstalling solved the issue. So did I, but the problem wasn't solved. I suspect if any of my recent updates have messed up the installation and caused incompatibility. So I'm wondering if anybody may lend me a help? 

Thank you!

Dustin Lang

unread,
Apr 26, 2024, 10:44:39 AMApr 26
to Pachacoti, astrometry
Hi,
Nothing significant changed between 0.93 and 0.94, so it's probably something gone wrong with your installation.  Are you using the Ubuntu package?
cheers,
dustin

--
You received this message because you are subscribed to the Google Groups "astrometry" group.
To unsubscribe from this group and stop receiving emails from it, send an email to astrometry+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/astrometry/c56a141f-43b2-4bd6-a244-ac7b9ea0de78n%40googlegroups.com.

Pachacoti

unread,
Apr 26, 2024, 1:31:18 PMApr 26
to astrometry
Hi Dustin,

Yeah indeed my OS is Ubuntu 20.04. I don't see any error messages during installing 0.94. A different error pops out, if I deactivate my conda base environment:

/.local/lib/python3.8/site-packages/pyfits/__init__.py:21: PyFITSDeprecationWarning: PyFITS is deprecated, please use astropy.io.fits
  warnings.warn('PyFITS is deprecated, please use astropy.io.fits',
/usr/lib/python3/dist-packages/astrometry/util/fits.py:558: FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.
  np.bool:'L',

Traceback (most recent call last):
  File "/usr/bin/removelines", line 15, in <module>
    sys.exit(main())
  File "/usr/lib/python3/dist-packages/astrometry/util/removelines.py", line 77, in main
    return removelines(infile, outfile, xcol=opt.xcol, ycol=opt.ycol,
  File "/usr/lib/python3/dist-packages/astrometry/util/removelines.py", line 54, in removelines
    T.writeto(outfile)
  File "/usr/lib/python3/dist-packages/astrometry/util/fits.py", line 524, in write_to
    fc = self.to_fits_columns(columns)
  File "/usr/lib/python3/dist-packages/astrometry/util/fits.py", line 558, in to_fits_columns
    np.bool:'L',
  File "/.local/lib/python3.8/site-packages/numpy/__init__.py", line 305, in __getattr__
    raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'bool'.
`np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
augment-xylist.c:591:backtick Failed to run command: /usr/bin/removelines /tmp/tmp.xyls.zS5Kq4 /tmp/tmp.removelines.uYh8d3

 ioutils.c:568:run_command_get_outputs Command failed: return value 1

I've tried with reinstall relevant dependencies, but I'm told that every of them is already the latest available version. How should I fix it? Thanks!

Dustin Lang

unread,
Apr 26, 2024, 3:39:13 PMApr 26
to Pachacoti, astrometry
Hi,

You can try installing the python packages "fitsio" or "astropy".

But I don't know what version of the code you're running there, because that error was fixed years ago...  eg I'm looking at

File "/usr/lib/python3/dist-packages/astrometry/util/fits.py", line 558, in to_fits_columns
    np.bool:'L',

and line 558 in util.fits.py does not look like that in v 0.94 or 0.93...  that looks like v 0.80 or earlier.


cheers,
dustin




Pachacoti

unread,
Apr 27, 2024, 12:31:45 PMApr 27
to astrometry
Dustin,

It appeared that there were two different versions of astrometry.net, one of which was installed ages ago. So although a new version was installed, somehow there was the confusion. After getting rid of the old one and reconfiguring python as well as astropy, the problem was solved. Thank you so much for spending time looking into this issue.

Have a great day!

Reply all
Reply to author
Forward
0 new messages