XanaduAI / QMLT

The Quantum Machine Learning Toolbox (QMLT) is a Strawberry Fields application that simplifies the optimization of variational quantum circuits (also known as parametrized quantum circuits).
https://qmlt.readthedocs.io
Apache License 2.0
114 stars 23 forks source link

AttributeError: 'tuple' object has no attribute 'type' #7

Closed Ayushprasad28 closed 5 years ago

Ayushprasad28 commented 5 years ago

I am finding the error after installing QMLT in my ubuntu 18.04.

import strawberryfields as sf

Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python3.6/dist-packages/strawberryfields/__init__.py", line 62, in <module> from .engine import Engine as _Engine File "/usr/local/lib/python3.6/dist-packages/strawberryfields/engine.py", line 133, in <module> import networkx as nx File "/usr/local/lib/python3.6/dist-packages/networkx/__init__.py", line 114, in <module> import networkx.generators File "/usr/local/lib/python3.6/dist-packages/networkx/generators/__init__.py", line 13, in <module> from networkx.generators.geometric import * File "/usr/local/lib/python3.6/dist-packages/networkx/generators/geometric.py", line 25, in <module> from scipy.spatial import cKDTree as KDTree File "/home/ayushprasad/.local/lib/python3.6/site-packages/scipy/__init__.py", line 62, in <module> from numpy import show_config as show_numpy_config File "/home/ayushprasad/.local/lib/python3.6/site-packages/numpy/__init__.py", line 142, in <module> from . import core File "/home/ayushprasad/.local/lib/python3.6/site-packages/numpy/core/__init__.py", line 57, in <module> from . import numerictypes as nt File "/home/ayushprasad/.local/lib/python3.6/site-packages/numpy/core/numerictypes.py", line 111, in <module> from ._type_aliases import ( File "/home/ayushprasad/.local/lib/python3.6/site-packages/numpy/core/_type_aliases.py", line 63, in <module> _concrete_types = {v.type for k, v in _concrete_typeinfo.items()} File "/home/ayushprasad/.local/lib/python3.6/site-packages/numpy/core/_type_aliases.py", line 63, in <setcomp> _concrete_types = {v.type for k, v in _concrete_typeinfo.items()} AttributeError: 'tuple' object has no attribute 'type'

co9olguy commented 5 years ago

This appears to be happening at the import line, i.e., before any meaningful code is run. This suggests to me that it is probably a problem/conflict within your current install. Could you try installing these packages in a clean virtual environment (e.g., anaconda), and see if you still receive the error?

also, @josh146 what are your thoughts?

josh146 commented 5 years ago

Very odd, it seems to be an issue with NumPy as well. @co9olguy I agree, it looks like @Ayushprasad28 you may need to try again in a fresh Python environment.

Ayushprasad28 commented 5 years ago

Thank you @co9olguy and @josh146 . It seems like there was some issue with my ubuntu Python environment. After reinstalling to a fresh environment it worked without any issue.