dnarayanan/powderday

'astropy.modeling.blackbody' does not exist anymore

Closed this issue · 3 comments

File "", line 259, in load_module
File "/home/chosson/local/Python-3.9.4/lib/python3.9/site-packages/powderday-0.1.0-py3.9.egg/powderday/helpers.py", line 4, in
ModuleNotFoundError: No module named 'astropy.modeling.blackbody'

pd doesn't work with the most recent version of Astropy because now, there is a new model:
https://docs.astropy.org/en/stable/modeling/physical_models.html

The last version of astropy allowing the previous model is 4.0, after that we should find the new way to write "helpers.py".
So, first solution is to pip install "astropy==4.0"
Second one to rewrite "helpers.py" with the new model.

thanks for reporting this! what astropyversion are you using? when I'm in:

In [6]: astropy.version.version
Out[6]: '4.2.1'

this works for me:

In [1]: from astropy.modeling.blackbody import blackbody_lambda,blackbody_nu



In [2]:

"pip install astropy --upgrade" gives me the version
astropy 4.3.post1

which is described here:
https://docs.astropy.org/en/stable/whatsnew/4.3.html

The full issue was the following:
[chosson@virgo pdd_test]$ pd_front_end.py /home/chosson/simulation/pdd_test parameters_master_401 parameters_model_401
Traceback (most recent call last):
File "/home/chosson/local/Python-3.9.4/bin/pd_front_end.py", line 4, in
import('pkg_resources').run_script('powderday==0.1.0', 'pd_front_end.py')
File "/home/chosson/local/Python-3.9.4/lib/python3.9/site-packages/pkg_resources/init.py", line 651, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/home/chosson/local/Python-3.9.4/lib/python3.9/site-packages/pkg_resources/init.py", line 1455, in run_script
exec(script_code, namespace, namespace)
File "/home/chosson/local/Python-3.9.4/lib/python3.9/site-packages/powderday-0.1.0-py3.9.egg/EGG-INFO/scripts/pd_front_end.py", line 8, in
File "", line 259, in load_module
File "/home/chosson/local/Python-3.9.4/lib/python3.9/site-packages/powderday-0.1.0-py3.9.egg/powderday/init.py", line 12, in
File "", line 259, in load_module
File "/home/chosson/local/Python-3.9.4/lib/python3.9/site-packages/powderday-0.1.0-py3.9.egg/powderday/enzo_tributary.py", line 7, in
File "", line 259, in load_module
File "/home/chosson/local/Python-3.9.4/lib/python3.9/site-packages/powderday-0.1.0-py3.9.egg/powderday/helpers.py", line 4, in
ModuleNotFoundError: No module named 'astropy.modeling.blackbody'

It is explained here:
https://docs.astropy.org/en/stable/modeling/physical_models.html#blackbody

And they clearly said that "astropy.modeling.blackbody" (the old version) is not taken into account with this new version:

Quote:

Note on old blackbody module

Prior to v4.0, blackbody functionality was provided by the astropy.modeling.blackbody module, which was then removed in v4.3. If you are still using the removed blackbody module, please see Blackbody Module (deprecated capabilities).

In order to make pd works, I had to go back to the previous version.