biopragmatics/bioontologies

FileNotFoundError: No such file or directory: 'robot'

Closed this issue · 5 comments

Overview

I tried to convert as such but got a FileNotFoundError for robot.

Replicability

import bioontologies
inpath = '/Users/joeflack4/projects/owl-on-fhir-content/input/comploinc.owl'  # I think anything will work in this case; might not even need to be a valid path
parse_results = bioontologies.convert_to_obograph(inpath)

Error

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

Stacktrace
  Traceback (most recent call last):
    File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/contextlib.py", line 153, in __exit__
      self.gen.throw(typ, value, traceback)
    File "/Users/joeflack4/virtualenvs/owl-on-fhir/lib/python3.10/site-packages/bioontologies/robot.py", line 269, in _path_context
      yield Path(directory).joinpath(name)
    File "/Users/joeflack4/virtualenvs/owl-on-fhir/lib/python3.10/site-packages/bioontologies/robot.py", line 213, in convert_to_obograph
      ret = convert(
    File "/Users/joeflack4/virtualenvs/owl-on-fhir/lib/python3.10/site-packages/bioontologies/robot.py", line 295, in convert
      ret = check_output(  # noqa:S603
    File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/subprocess.py", line 421, in check_output
      return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
    File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/subprocess.py", line 503, in run
      with Popen(*popenargs, **kwargs) as process:
    File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/subprocess.py", line 971, in __init__
      self._execute_child(args, executable, preexec_fn, close_fds,
    File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/subprocess.py", line 1847, in _execute_child
      raise child_exception_type(errno_num, err_msg, err_filename)
  FileNotFoundError: [Errno 2] No such file or directory: 'robot'
  
cthoyt commented

this isn't a helpful message but it signifies that robot isn't available on the class path

@cthoyt By class path do you mean (a) something related to my Python environment, or (b) my OS PATH?

I would think you would mean 'b', but I do have robot in my OS PATH.
If 'a', I would think that this would be installed as a transitive dependency whenever I pip install bioontologies.

So I'm not sure what I can do to fix at the moment. Let me know if neither 'a' or 'b' is what you mean, or if you have any idea on how to troubleshoot.

cthoyt commented

I meant b), your OS path. ROBOT is a java program, so you're on your own to get that set up and running properly, it does not get installed via pip. Maybe we can use pystow to automatically download and get it, but this still also assumes you have java (is that reasonable?)

It's reasonable. However, as I was saying, I already do have robot installed and it is on my PATH. I've never had trouble calling it from the terminal or Python before via subprocess, so I'm not sure why bioontologies is not finding it.

FYI I took a different approach for now with owl-on-fhir. Until I get this part of bioontologies working, I'm including the robot.jar directly with my PyPi distribution so that my team doesn't have to download it separately. That locks makes for a big package size, and locks robot in to a specific version (and maybe has other pitfalls I'm not aware of?), but I'm preferring this right now.

Suddenly this is popping up elsewhere for me. I think it might have some interaction between 1 or more of (a) virtualenvwrapper, (b) my Python version, (c) PyCharm. When my virtualenv is active, my terminal correctly shows my PATH, but not so sometimes when running Python in Pycharm.