run_test.py fails with python 3.8.5
svaverbe opened this issue · 1 comments
After installing pandexo with python 3.8.5, the following errors appear in ubuntu linux
python run_test.py
Downloading https://hpiers.obspm.fr/iers/bul/bulc/Leap_Second.dat
|========================================================================================================================================================================| 1.3k/1.3k (100.00%) 0s
Starting TEST run
Running Single Case for: NIRSpec G140H
Traceback (most recent call last):
File "/mnt/d/Pandexo-master/pandexo/engine/jwst.py", line 79, in compute_full_sim
i = InstrumentFactory(config=conf)
File "/home/siegfried/anaconda3/envs/science/lib/python3.8/site-packages/pandeia.engine-1.6-py3.8.egg/pandeia/engine/instrument_factory.py", line 50, in InstrumentFactory
cls = inst_map[instrument](mode=mode, config=config, webapp=webapp, **kwargs)
File "/home/siegfried/anaconda3/envs/science/lib/python3.8/site-packages/pandeia.engine-1.6-py3.8.egg/pandeia/engine/jwst.py", line 62, in init
JWSTInstrument.init(self, mode=mode, config=config, webapp=webapp, **kwargs)
File "/home/siegfried/anaconda3/envs/science/lib/python3.8/site-packages/pandeia.engine-1.6-py3.8.egg/pandeia/engine/jwst.py", line 32, in init
telescope = JWST()
File "/home/siegfried/anaconda3/envs/science/lib/python3.8/site-packages/pandeia.engine-1.6-py3.8.egg/pandeia/engine/config.py", line 47, in init
all_config = merge_data(self._get_config(), config, dict(**kwargs))
File "/home/siegfried/anaconda3/envs/science/lib/python3.8/site-packages/pandeia.engine-1.6-py3.8.egg/pandeia/engine/telescope.py", line 33, in _get_config
self.ref_dir = os.path.join(default_refdata_directory, self.tel_name, "telescope")
File "/home/siegfried/anaconda3/envs/science/lib/python3.8/posixpath.py", line 76, in join
a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not NoneType
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "run_test.py", line 30, in
jdi.run_pandexo(exo_dict, ['NIRSpec G140H'], save_file=False)
File "/mnt/d/Pandexo-master/pandexo/engine/justdoit.py", line 402, in run_pandexo
results =wrapper({"pandeia_input": inst_dict , "pandexo_input":exo}, verbose=verbose)
File "/mnt/d/Pandexo-master/pandexo/engine/pandexo.py", line 36, in wrapper
return compute_full_sim(dictinput, verbose=verbose)
File "/mnt/d/Pandexo-master/pandexo/engine/jwst.py", line 85, in compute_full_sim
i = InstrumentFactory(config=conf_temp)
File "/home/siegfried/anaconda3/envs/science/lib/python3.8/site-packages/pandeia.engine-1.6-py3.8.egg/pandeia/engine/instrument_factory.py", line 50, in InstrumentFactory
cls = inst_map[instrument](mode=mode, config=config, webapp=webapp, **kwargs)
File "/home/siegfried/anaconda3/envs/science/lib/python3.8/site-packages/pandeia.engine-1.6-py3.8.egg/pandeia/engine/jwst.py", line 62, in init
JWSTInstrument.init(self, mode=mode, config=config, webapp=webapp, **kwargs)
File "/home/siegfried/anaconda3/envs/science/lib/python3.8/site-packages/pandeia.engine-1.6-py3.8.egg/pandeia/engine/jwst.py", line 32, in init
telescope = JWST()
File "/home/siegfried/anaconda3/envs/science/lib/python3.8/site-packages/pandeia.engine-1.6-py3.8.egg/pandeia/engine/config.py", line 47, in init
all_config = merge_data(self._get_config(), config, dict(**kwargs))
File "/home/siegfried/anaconda3/envs/science/lib/python3.8/site-packages/pandeia.engine-1.6-py3.8.egg/pandeia/engine/telescope.py", line 33, in _get_config
self.ref_dir = os.path.join(default_refdata_directory, self.tel_name, "telescope")
File "/home/siegfried/anaconda3/envs/science/lib/python3.8/posixpath.py", line 76, in join
a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not NoneType
Most likely an issue with upgrading to the latest python version(s).
The TypeError: expected str, bytes or os.PathLike object, not NoneType
is usually caused by the pandeia_refdata
environment variable not being set.
PandExo requires two environment variables: pandeia_refdata
and PYSYN_CDBS
. I have an explanation of different ways to set environment variables here. You can check that they are properly set in python by doing the following:
import os
print(os.environ['pandeia_refdata'])
print(os.environ['PYSYN_CDBS'])
If you see a NoneType
printout then you have not set them correctly. For example i get the following printout:
>>> print(os.environ['pandeia_refdata'])
/Users/nbatalh1/Documents/data/pandeia_data-1.6
>>> print(os.environ['PYSYN_CDBS'])
/Users/nbatalh1/Documents/data/grp/hst/cdbs
If you haven't set them and want to do so in python, your code would look like this:
import os
os.environ['pandeia_refdata'] = "/Users/nbatalh1/Documents/data/pandeia_data-1.6"#add your own path
os.environ['PYSYN_CDBS'] = "/Users/nbatalh1/Documents/data/grp/hst/cdbs"
import pandexo.engine #MAKE SURE THIS COMES AFTER SET PATHS
Let me know if this solves the problem.