eclipse-qrisp / Qrisp

Qrisp - a framework for high-level programming of Quantum computers
https://www.qrisp.eu/
Eclipse Public License 2.0
84 stars 23 forks source link

Can't get past first import #8

Closed bsiegelwax closed 1 year ago

bsiegelwax commented 1 year ago
from qrisp import QuantumVariable
qv = QuantumVariable(5)

results in

SystemError: initialization of _internal failed without raising an exception

Additional info:

---------------------------------------------------------------------------
SystemError                               Traceback (most recent call last)
Cell In[2], line 1
----> 1 from qrisp import QuantumVariable
      2 qv = QuantumVariable(5)

File ~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\qrisp\__init__.py:13
      1 """
      2 /*********************************************************************
      3 * Copyright (c) 2023 the Qrisp Authors
   (...)
     10 **********************************************************************/
     11 """
---> 13 from qrisp.core import *
     15 from qrisp.misc import *
     16 from qrisp.circuit import *

File ~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\qrisp\core\__init__.py:15
      1 """
      2 /*********************************************************************
      3 * Copyright (c) 2023 the Qrisp Authors
   (...)
     10 **********************************************************************/
     11 """
     14 from qrisp.core.session_merging_tools import *
---> 15 from qrisp.core.compilation import *
     16 from qrisp.core.quantum_variable import QuantumVariable
     17 from qrisp.core.quantum_session import QuantumSession

File ~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\qrisp\core\compilation.py:16
     14 import numpy as np
     15 import networkx as nx
---> 16 from numba import njit, prange
     18 from qrisp.circuit import QuantumCircuit, Qubit, PTControlledOperation, ControlledOperation, transpile, QubitAlloc, Instruction, fast_append
     19 from qrisp.misc import get_depth_dic, retarget_instructions, reduce_depth

File ~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\numba\__init__.py:43
     39 from numba.core.decorators import (cfunc, generated_jit, jit, njit, stencil,
     40                                    jit_module)
     42 # Re-export vectorize decorators and the thread layer querying function
---> 43 from numba.np.ufunc import (vectorize, guvectorize, threading_layer,
     44                             get_num_threads, set_num_threads)
     46 # Re-export Numpy helpers
     47 from numba.np.numpy_support import carray, farray, from_dtype

File ~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\numba\np\ufunc\__init__.py:3
      1 # -*- coding: utf-8 -*-
----> 3 from numba.np.ufunc.decorators import Vectorize, GUVectorize, vectorize, guvectorize
      4 from numba.np.ufunc._internal import PyUFunc_None, PyUFunc_Zero, PyUFunc_One
      5 from numba.np.ufunc import _internal, array_exprs

File ~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\numba\np\ufunc\decorators.py:3
      1 import inspect
----> 3 from numba.np.ufunc import _internal
      4 from numba.np.ufunc.parallel import ParallelUFuncBuilder, ParallelGUFuncBuilder
      6 from numba.core.registry import TargetRegistry
positr0nium commented 1 year ago

This seems to be a numba specific problem. Some posters suggested installing an older numpy version: pip install numpy==1.23.0 I couldn't reproduce with an up to date numpy version though. What platform are you on?

positr0nium commented 1 year ago

Do you still face this problem with 0.2 or can we close this issue?

bsiegelwax commented 1 year ago

It's still an issue with 0.2.1.

numpy==1.24.1 Python version 3.9.13 Python compiler MSC v.1929 64 bit (AMD64) Python build tags/v3.9.13:6de2ca5, May 17 2022 16:36:42 OS Windows

positr0nium commented 1 year ago

The bug has presumably been fixed last week and is published with the newest version of numba. Can you run pip install --upgrade numba If it still doesn't work you can try conda install numba or install from source: Create a new folder and navigate to it git clone git://github.com/numba/numba.git python setup.py install

bsiegelwax commented 1 year ago

I tried something different and got a result instead of an error, so I guess you can close this issue. I'll tinker with it some more over the coming days and weeks.

positr0nium commented 1 year ago

Awesome! Have fun💃