map.reproject_to not finding optional package

25 views
Skip to first unread message

Matthew G Lennard

unread,
Mar 22, 2024, 12:57:40 PMMar 22
to SunPy
Hi,

I'm trying to do some work with HMI observations and need to rotate some images.


I am met with the following output:
'Traceback (most recent call last):
  File "/Users/matthew/miniconda3/envs/py3/lib/python3.11/site-packages/sunpy/map/mapbase.py", line 2716, in reproject_to
    import reproject
ModuleNotFoundError: No module named 'reproject'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/matthew/Documents/codes/rotation.py", line 28, in <module>
    out_warp = hmi_map.reproject_to(out_wcs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/matthew/miniconda3/envs/py3/lib/python3.11/site-packages/sunpy/util/decorators.py", line 322, in inner_f
    return f(**kwargs)
           ^^^^^^^^^^^
  File "/Users/matthew/miniconda3/envs/py3/lib/python3.11/site-packages/sunpy/map/mapbase.py", line 2718, in reproject_to
    raise ImportError("This method requires the optional package `reproject`.") from exc
ImportError: This method requires the optional package `reproject`.'

Namely, Sunpy is not finding reproject.

When I run
'pip install reproject'
It says everything is installed correctly. But when I try importing reproject in Python, it is unable to find the package.

Has anyone had any similar issues and found a way to fix this?

Thanks :)

Nabil Freij

unread,
Mar 22, 2024, 1:37:00 PMMar 22
to SunPy
Hello,

If pip says that reproject is installed but python nor sunpy can find it, that would suggest that pip command is not the correct pip that should be within the the py3 environment that python and sunpy are in.

I would just open a new terminal, activate py3, then see if the pip command location is within that environment location.

DId you install sunpy via pip or conda?
Reply all
Reply to author
Forward
0 new messages