fermiPy / fermipy

Fermi-LAT Python Analysis Framework
http://fermipy.readthedocs.org/
BSD 3-Clause "New" or "Revised" License
51 stars 53 forks source link

Issue when running GTAnalysis #413

Closed chsteel32 closed 2 years ago

chsteel32 commented 3 years ago

I was starting work on an analysis walkthrough and I encountered an issue when trying to run GTAnalysis using a config.yaml file which was provided with the other files necessary for the analysis. Running the command resulted in a FileNotFoundError which stated that 'conda' was not a valid file or directory. I tried using ipykernel to activate the fermipy environment in jupyter notebook but still had the same error occur. The input and error message are shown below.

gta = GTAnalysis('config.yaml',logging={'verbosity' : 3})

FileNotFoundError Traceback (most recent call last) ~/anaconda3/envs/fermipy/lib/python3.7/site-packages/fermipy/init.py in get_ft_conda_version() 59 try: ---> 60 lines = subprocess.check_output(['conda', 'list', '-f', 'fermitools']).decode().split('\n') 61 except:

~/anaconda3/envs/fermipy/lib/python3.7/subprocess.py in check_output(timeout, *popenargs, *kwargs) 410 return run(popenargs, stdout=PIPE, timeout=timeout, check=True, --> 411 **kwargs).stdout 412

~/anaconda3/envs/fermipy/lib/python3.7/subprocess.py in run(input, capture_output, timeout, check, *popenargs, *kwargs) 487 --> 488 with Popen(popenargs, **kwargs) as process: 489 try:

~/anaconda3/envs/fermipy/lib/python3.7/subprocess.py in init(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, encoding, errors, text) 799 errread, errwrite, --> 800 restore_signals, start_new_session) 801 except:

~/anaconda3/envs/fermipy/lib/python3.7/subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, restore_signals, start_new_session) 1550 err_msg += ': ' + repr(err_filename) -> 1551 raise child_exception_type(errno_num, err_msg, err_filename) 1552 raise child_exception_type(err_msg)

FileNotFoundError: [Errno 2] No such file or directory: 'conda': 'conda'

During handling of the above exception, another exception occurred:

FileNotFoundError Traceback (most recent call last)

in ----> 1 gta = GTAnalysis('config.yaml',logging={'verbosity' : 3}) ~/anaconda3/envs/fermipy/lib/python3.7/site-packages/fermipy/gtanalysis.py in __init__(self, config, roi, **kwargs) 315 "fermipy version {} ". 316 format(fermipy.__version__) + '\n' + --> 317 'ScienceTools version %s', fermipy.get_st_version()) 318 self.print_config(self.logger, loglevel=logging.DEBUG) 319 ~/anaconda3/envs/fermipy/lib/python3.7/site-packages/fermipy/__init__.py in get_st_version() 35 vv = ST_Version.get_git_version() 36 if vv == "unknown": ---> 37 vv = get_ft_conda_version() 38 return vv 39 except ImportError: ~/anaconda3/envs/fermipy/lib/python3.7/site-packages/fermipy/__init__.py in get_ft_conda_version() 60 lines = subprocess.check_output(['conda', 'list', '-f', 'fermitools']).decode().split('\n') 61 except: ---> 62 lines = subprocess.check_output(['conda', 'list', '-f', 'fermitools']).split('\n') 63 for l in lines: 64 if not l: ~/anaconda3/envs/fermipy/lib/python3.7/subprocess.py in check_output(timeout, *popenargs, **kwargs) 409 410 return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, --> 411 **kwargs).stdout 412 413 ~/anaconda3/envs/fermipy/lib/python3.7/subprocess.py in run(input, capture_output, timeout, check, *popenargs, **kwargs) 486 kwargs['stderr'] = PIPE 487 --> 488 with Popen(*popenargs, **kwargs) as process: 489 try: 490 stdout, stderr = process.communicate(input, timeout=timeout) ~/anaconda3/envs/fermipy/lib/python3.7/subprocess.py in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, encoding, errors, text) 798 c2pread, c2pwrite, 799 errread, errwrite, --> 800 restore_signals, start_new_session) 801 except: 802 # Cleanup if the child failed starting. ~/anaconda3/envs/fermipy/lib/python3.7/subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, restore_signals, start_new_session) 1549 if errno_num == errno.ENOENT: 1550 err_msg += ': ' + repr(err_filename) -> 1551 raise child_exception_type(errno_num, err_msg, err_filename) 1552 raise child_exception_type(err_msg) 1553 FileNotFoundError: [Errno 2] No such file or directory: 'conda': 'conda' I do not have a lot of experience yet using fermipy, so it may be a simple solution but I am grateful for any help that can be offered. Thanks.
henrikef commented 2 years ago

Hi @chsteel32 , were you able to resolve this? If you still have this issue, can you please let me know how you installed the fermitools and fermipy?

henrikef commented 2 years ago

Please re-open if this is still a problem.