mabuchilab / QNET

Computer algebra package for quantum mechanics and photonic quantum networks
https://qnet.readthedocs.io/
MIT License
71 stars 23 forks source link

Error importing QNET package #95

Open Leo-am opened 3 years ago

Leo-am commented 3 years ago

Description

Describe what you were trying to get done. Tell us what happened, what went wrong, and what you expected to happen.

What I Did

Installed QNET package from source using:

pip install git+https://github.com/mabuchilab/qnet.git@develop#egg=qnet

Then, I tried to simply import the package using:

import qnet

Which produced the following error:

Traceback (most recent call last):

File "<stdin>", line 1, in <module>

File "/Users/leo/miniconda3/envs/test_for_clock/lib/python3.6/site-packages/qnet/__init__.py", line 14, in <module>

import qnet.algebra._rules

File "/Users/leo/miniconda3/envs/test_for_clock/lib/python3.6/site-packages/qnet/algebra/_rules.py", line 3, in <module>

from .core.circuit_algebra import (

File "/Users/leo/miniconda3/envs/test_for_clock/lib/python3.6/site-packages/qnet/algebra/core/circuit_algebra.py", line 19, in <module>

from .algebraic_properties import (

File "/Users/leo/miniconda3/envs/test_for_clock/lib/python3.6/site-packages/qnet/algebra/core/algebraic_properties.py", line 13, in <module>

from ...utils.indices import IdxSym

File "/Users/leo/miniconda3/envs/test_for_clock/lib/python3.6/site-packages/qnet/utils/indices.py", line 431, in <module>

class IndexOverList(IndexRangeBase):

File "/Users/leo/miniconda3/envs/test_for_clock/lib/python3.6/site-packages/qnet/utils/indices.py", line 438, in IndexOverList

values = attr.ib(convert=tuple)

TypeError: attrib() got an unexpected keyword argument 'convert'

The error is generated, from what I understood, due to a change of attributes in pytest from 'convert' to 'converter'. I was able to make the QNET package to work by changing the file at: /Users/leo/miniconda3/envs/test_for_clock/lib/python3.6/site-packages/qnet/utils/indices.py in line 438, where I changed:

    values = attr.ib(convert=tuple)

to

    values = attr.ib(converter=tuple)

The QNET package now works perfectly. (pytest version 6.2.5, and attrs version 21.2.0)