Closed gvnnlgl closed 3 years ago
Hi, Have you added to your PYTHONPATH? eg,
export PYTHONPATH=${PYTHONPATH}:/usr/local/astrometry/lib/python
? One additional note, you should not be in the astrometry/ source directory when you try to import, because there is an 'astrometry' symlink there that python will treat as the package. So try,
export PYTHONPATH=${PYTHONPATH}:/usr/local/astrometry/lib/python cd /tmp python3 -c "import astrometry; print(astrometry.file); print(astrometry.version)" python3 -c "import astrometry.util; print(astrometry.util.file)" python3 -c "import astrometry.util.util; print(astrometry.util.util.file)"
thanks
ps, we have an ubuntu 18 build in our CI, if that's of any help. https://app.circleci.com/pipelines/github/dstndstn/astrometry.net?branch=master
Thanks for quick reply! Here is result of proposed test, if it looks ok I will try later if this can solve the issue
...:$ python3 -c "import astrometry; print(astrometry.file); print(astrometry.version)" /usr/local/astrometry/lib/python/astrometry/init.py 0.80
...:$ python3 -c "import astrometry.util; print(astrometry.util.file)" /usr/local/astrometry/lib/python/astrometry/util/init.py
...:$ python3 -c "import astrometry.util.util; print(astrometry.util.util.file)" /usr/local/astrometry/lib/python/astrometry/util/util.py
(of course by replacing bold font with double underscores)
Thanks for your time, I noted that in your test snippet you used python3 and I questioned myself about the version my system was using by default: in fact it was 2.7! So I started my webapp (made in flask) by using python3 command and now it is importing astrometry.util.util... In closing the issue, I report the result of test snippet with "python" instead of "python3" if it may be useful for others:
...:$ python -c "import astrometry.util.util; print(astrometry.util.util.file)" ImportError: /usr/local/astrometry/lib/python/astrometry/util/_util.cpython-37m-arm-linux-gnueabihf.so: undefined symbol: PyBytes_AsStringAndSize
Aha! Good sleuthing. Thanks for leaving answers for the future 👍
In a raspbian buster environment, I compiled 0.80 to default /usr/local/astrometry; all suggested libraries installed with apt. Solving and plotting ok with solve-field, but I would need to use the util in python. util.py is giving error because _util is not found, although there is _util.cpython-37m-arm-linux-gnueabihf.so file for it in /usr/local/astrometry/lib/python/astrometry/util Is there something I need to do while making?