0

I'm having issues when trying to use the astropy package in python3. I've found a few people having similar issues but haven't found a solution. I understand it's hard to help with a problem such as this but still.

When I've installed other packages such as numpy it works fine, it seems to be just astropy which is not working. The only difference between when I installed numpy and other packages as far as I can tell is time. I have used pip for installing, the installing gave no issue, it is just when trying to execute that the error: "Importerror: No module named astropy".

So far I have checked that the versions of pip and python coincide, and I believe it is installed in the correct directory. I'll link some information I think might be helpful below, I am running on mac and I read in a similar thread that the recent "macOS Catalina" update might interfere when installing packages somehow.

When trying to install astropy again:

pip3 install astropy
Requirement already satisfied: astropy in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (4.0.1.post1)
Requirement already satisfied: numpy>=1.16 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from astropy) (1.18.4)

And when I check with pip3 list it states astropy is installed.

erkoo
  • 23
  • 5

1 Answers1

0

I suspect it happens because you have installed updates for macOS Catalina, which changes the location of some files from the root. This link may be helpful, as I had the same problem: https://medium.com/analytics-vidhya/configuring-anaconda-environment-on-macos-catalina-26e1cb02f5ab

Anya Samadi
  • 673
  • 1
  • 5
  • 13
  • Thank you for the link, the solution seems to be working when I run things in the terminal straight away now but when trying to build in sublime text directly it still says no module named astropy. Do you have any solution for this? – erkoo May 15 '20 at 13:04
  • I also tried deleting the temporary packages left in my home directory, for example, $rm -r .astropy. It worked for me. The other case in which I got the same problem was the time that I wanted to use python2.X as an environment for conda. the same happens for matplotlib. there is a solution for that too. but I think you only have one python. you may need to redescribe your python 3 path to your python folder in your bin /python folder using ln. It seems that it goes to the other path than your astropy has installed. I have explained in one of my answers – Anya Samadi May 15 '20 at 16:00
  • here: https://stackoverflow.com/questions/61811366/how-to-set-the-default-python3-to-python3-7/61811700#61811700 – Anya Samadi May 15 '20 at 16:02