JeffersonLab / chroma

The Chroma Software System for Lattice QCD
http://jeffersonlab.github.io/chroma
Other
58 stars 50 forks source link

Cannot import chroma in latest pip release #53

Closed jose-manuel closed 2 years ago

jose-manuel commented 5 years ago

Hi, pip install chroma has installed chroma-0.2.0 in my python 3.6.6 environment on Kubuntu 18.04.

However, when I try to import chroma, I get this error:

  Traceback (most recent call last):

  File "/home/gally/Software/anaconda3/envs/npfc/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 3267, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)

  File "<ipython-input-85-dd9842f76628>", line 1, in <module>
    import chroma

  File "/home/gally/Software/anaconda3/envs/npfc/lib/python3.6/site-packages/chroma/__init__.py", line 9, in <module>
    from .core import *

  File "/home/gally/Software/anaconda3/envs/npfc/lib/python3.6/site-packages/chroma/core.py", line 273
    except Exception, e:
                    ^
SyntaxError: invalid syntax

Did I do something wrong or is this project compatible only with python 2?

If so, maybe you could specify it in the requirements.

Cheers, Jose Manuel

martin-ueding commented 5 years ago

I was not even aware that something for Python existed for chroma. But except Exception, e is Python 2 syntax. In Python 3 is must be except Exception as e. So I'd say that it is only compatible with Python 2. You might be able to port it with the 2to3 program.

jose-manuel commented 5 years ago

Dear Martin, thank you for your reply, I suspected as much. However I don't plan to dive further into chroma at the moment. I'll try again when/if a new version is released for Python 3.