myQLM / myqlm-issues

4 stars 1 forks source link

qat.lang.AQASM not working (python 3.11 / windows) #26

Closed MarionQuandela closed 11 months ago

MarionQuandela commented 1 year ago

Just trying to import Program from qat.lang.AQASM: from qat.lang.AQASM import Program

Python 3.11.5 (tags/v3.11.5:cce6ba9, Aug 24 2023, 14:38:34) [MSC v.1936 64 bit (AMD64)] on win32

from qat.lang.AQASM import Program Traceback (most recent call last): File "", line 1, in File "init.py", line 19, in init qat.init File "init.py", line 55, in init qat.modules.init File "init.py", line 16, in init qat.core.init File "init.py", line 16, in init qat.core.wrappers.init File "job.py", line 29, in init qat.core.wrappers.job File "res_data.py", line 17, in init qat.core.wrappers.res_data File "utils.py", line 15, in init qat.comm.utils ImportError: generic_type: cannot initialize type "ValuesView[float]": an object with that name is already defined

I recommend using a simple ci/cd pipeline just checking imports for your supported os & python versions

hvermaQ commented 12 months ago

In my experience, this error stems from installing many versions of qlm. For example, installing myqlm in the base environment and installing it again in a particular environment.

MarionQuandela commented 12 months ago

I don't have myqlm (qat) in the "base" environment, see my logs:

PS C:\Dev\Perceval> py -3.11 -m pip freeze
asttokens==2.2.1
backcall==0.2.0
bottle==0.12.25
certifi==2023.5.7
cfgv==3.3.1
charset-normalizer==3.1.0
colorama==0.4.6
comm==0.1.3
conan==1.59.0
debugpy==1.6.7
decorator==5.1.1
distlib==0.3.6
executing==1.2.0
fasteners==0.18
filelock==3.12.2
identify==2.5.24
idna==3.4
ipykernel==6.23.3
ipython==8.14.0
jedi==0.18.2
Jinja2==3.1.2
jupyter_client==8.3.0
jupyter_core==5.3.1
MarkupSafe==2.1.3
matplotlib-inline==0.1.6
nest-asyncio==1.5.6
node-semver==0.6.1
nodeenv==1.8.0
packaging==23.1
parso==0.8.3
patch-ng==1.17.4
pickleshare==0.7.5
platformdirs==3.6.0
pluginbase==1.0.1
pre-commit==3.3.3
prompt-toolkit==3.0.38
psutil==5.9.5
pure-eval==0.2.2
Pygments==2.15.1
PyJWT==2.7.0
python-dateutil==2.8.2
pywin32==306
PyYAML==6.0
pyzmq==25.1.0
requests==2.31.0
six==1.16.0
stack-data==0.6.2
tornado==6.3.2
tqdm==4.65.0
traitlets==5.9.0
urllib3==1.26.16
virtualenv==20.23.1
wcwidth==0.2.6

PS C:\Dev\Perceval> .\venv\Scripts\Activate.ps1       

(venv) PS C:\Dev\Perceval> pip freeze            
anytree==2.9.0
bitarray==2.8.1
bitstring==4.1.2
certifi==2023.7.22
cffi==1.15.1
charset-normalizer==3.2.0
colorama==0.4.6
contourpy==1.1.1
coverage==7.3.1
cryptography==41.0.4
cvxpy==1.3.2
cycler==0.11.0
Deprecated==1.2.14
dill==0.3.7
drawsvg==2.3.0
ecos==2.0.12
execnet==2.0.2
exqalibur==0.2.1
flake8==6.1.0
fonttools==4.42.1
idna==3.4
iniconfig==2.0.0
jax==0.4.16
jaxlib==0.4.16
kiwisolver==1.4.5
latexcodec==2.0.1
matplotlib==3.8.0
mccabe==0.7.0
ml-dtypes==0.3.1
mpmath==1.3.0
multipledispatch==1.0.0
myqlm==1.9.3
myqlm-clinalg==0.1.1
myqlm-contrib==1.9.1
myqlm-fermion==1.1.0
myqlm-simulators==1.9.2
networkx==3.1
numpy==1.26.0
opt-einsum==3.3.0
osqp==0.6.3
packaging==23.1
pbr==5.11.1
perceval-quandela @ file:///C:/Dev/Perceval
Pillow==10.0.1
platformdirs==3.10.0
pluggy==1.3.0
ply==3.11
prettytable==3.9.0
prompt-toolkit==3.0.39
protobuf==4.24.3
psutil==5.9.5
py-cpuinfo==9.0.0
pycodestyle==2.11.0
pycparser==2.21
pyDOE==0.3.8
pyflakes==3.1.0
pyOpenSSL==23.2.0
pyparsing==3.1.1
pytest==7.4.2
pytest-benchmark==4.0.0
pytest-cov==4.1.0
pytest-xdist==3.3.1
python-dateutil==2.8.2
qat-comm==1.4.3
qat-core==1.8.1
qat-devices==0.2.1
qat-hardware==1.3.1
qat-lang==3.0.1
qat-quops==1.3.0
qat-variational==1.4.1
qdldl==0.1.7.post0
qiskit==0.44.1
qiskit-terra==0.25.1
qlmaas==1.9.1
qutip==4.7.3
requests==2.31.0
rustworkx==0.13.1
scipy==1.11.2
scs==3.2.3
six==1.16.0
stevedore==5.1.0
svgwrite==1.4.3
sympy==1.12
tabulate==0.9.0
thrift==0.16.0
tqdm==4.66.1
urllib3==2.0.5
Wand==0.6.11
wcwidth==0.2.6
windows-curses==2.3.1
wrapt==1.15.0

(venv) PS C:\Dev\Perceval> python
Python 3.11.5 (tags/v3.11.5:cce6ba9, Aug 24 2023, 14:38:34) [MSC v.1936 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import qat
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "__init__.py", line 19, in init qat.__init__
  File "__init__.py", line 55, in init qat.modules.__init__
  File "__init__.py", line 16, in init qat.core.__init__
  File "__init__.py", line 16, in init qat.core.wrappers.__init__
  File "job.py", line 29, in init qat.core.wrappers.job
  File "res_data.py", line 17, in init qat.core.wrappers.res_data
  File "utils.py", line 15, in init qat.comm.utils
ImportError: generic_type: cannot initialize type "ValuesView[float]": an object with that name is already defined

I do have other virtual environment with myqlm but with different version on python (3.8 to 3.11)

hvermaQ commented 11 months ago

For me, removing the qlm and related packages (which couldn't be removed in one go, had to try multiple times, and check through pip freeze), and removing the environment, then reinstalling everything in a new environment worked.

JayaPoluri commented 11 months ago

If this is still a problem, please try again with myqlm 1.9.4. This should work; and if it doesn't work, please let us know.

MarionQuandela commented 11 months ago

1.9.4 fix the problem, thanks 👍