tanghaibao / goatools

Python library to handle Gene Ontology (GO) terms
BSD 2-Clause "Simplified" License
773 stars 211 forks source link

Installation issue: Invalid syntax #207

Closed ThHarbig closed 1 year ago

ThHarbig commented 3 years ago

Hi, I've been using goatools for a while. Now I tried to install it on a different system and there the installation does not work with the following error message:

Downloading https://files.pythonhosted.org/packages/09/eb/1674d7fd11d703a551590f5d7bcf7649ee4afbd7edd587d33a56b236a6ea/goatools-1.0.15.tar.gz (15.1MB) 100% |████████████████████████████████| 15.1MB 78.6MB/s Complete output from command python setup.py egg_info: Traceback (most recent call last): File "", line 1, in File "/tmp/pip-build-eO4LNF/goatools/setup.py", line 11, in from setup_helper import SetupHelper File "setup_helper.py", line 53 ) from stop_exception ^ SyntaxError: invalid syntax

The corresponding line of code can be found here: https://github.com/tanghaibao/goatools/blob/d58f9ec92dca9d69a88f5e68622718aa336f18e3/setup_helper.py#L53

Since I've never seen this syntax before I assume that it's a real syntax problem. Why this only occurs on the new system is a mystery to me (I'm using the same python version). Let me know if you need any other information!

Thanks!

tanghaibao commented 3 years ago

@ThHarbig

This syntax is "Exception Chaining" https://docs.python.org/3.9/library/exceptions.html and should work from Python 3.5 to 3.9. Would you please help checking your Python version (python --version)?

When raising a new exception (rather than using a bare raise to re-raise the exception currently being handled), the implicit exception context can be supplemented with an explicit cause by using from with raise:

raise new_exc from original_exc

risserlin commented 3 years ago

I am getting the same error. I am using the package with python 2.7 because of other dependencies. I rolled back to using a previous version of goatools because I can't get the latest version to work with python 2.7. (specifically goatools 1.0.14 and lower works with python 2.7 and anything newer fails with the above error.

I would simply use the previous version but I am now getting a different error when I use it: Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/goatools/anno/init/reader_gaf.py", line 85, in _read_gaf_nts datobj = GafData(ver, allow_missing_symbol) File "/usr/local/lib/python2.7/dist-packages/goatools/anno/init/reader_gaf.py", line 164, in init self.flds = self.gaf_columns[self.ver] KeyError: '2.2'

**FATAL-gaf: '2.2'

I manually went in and changed /usr/local/lib/python2.7/dist-packages/goatools/anno/init/reader_gaf.py but this is part of docker pipeline and I would really like if the latest version of python 2.7 compatible, if that was possible.

Is there a way to turn off the tests when I install perhaps?

tanghaibao commented 1 year ago

Switched to pyproject.toml based installation so setup_helper.py is no longer needed. However, we do not have plans to support Python 2.x moving forward. Closing issue.