qiskit / qiskit-aer Goto Github PK
View Code? Open in Web Editor NEWAer is a high performance simulator for quantum circuits that includes noise models
Home Page: https://qiskit.github.io/qiskit-aer/
License: Apache License 2.0
Aer is a high performance simulator for quantum circuits that includes noise models
Home Page: https://qiskit.github.io/qiskit-aer/
License: Apache License 2.0
One cannot build the Aer simulator without OpenMP (on vanilla osx, for example) because the variable 'num_threads_circuit'
is only defined inside and omp ifdef section, but used outside.
Windows builds, using VS2017 complain because the #pragmas for parallelizing for loops have different requirements than those for Linux/Mac. The variables showing in the loop need to be signed
(e.g: int32_t
instead of uint32_t
)
Run a build.
As all of the loops involved are using the number of qubits for incrementing a variable, it's safe to move from uint32_t
to int32_t
.
It could be helpful to add a backend based on something like the simulator described in 'Fast simulation of stabilizer circuits using a graph state representation' (to my knowledge, that is the best known algorithm)'
I saw that there was previously a stabilizer simulator based on the tableau in Terra.
The qiskit-aer 0.1.1 package on pypi is missing the sdist. This prevents installing it on any environment where there is no published wheel file. Which includes non-x86 arches and OS combinations not covered by the wheel files on: https://pypi.org/project/qiskit-aer/#files
Try running pip install qiskit-aer==0.1.1
on a system where there is no wheel file published.
It will download the sdist and build aer for the system.
Upload an sdist file for 0.1.1 (as was done in the 0.1.0 release).
Adding a simulation method for the QasmSimulator
based on the techinques in Bravyi & Gosset (2016) for simulating Clifford + T circuits with low T gate depth.
Note This issue is to track the work already underway by @padraic-padraic
Running the tutorials gives the following error
OMP: Error #15: Initializing libiomp5.dylib, but found libomp.a already initialized.
OMP: Hint This means that multiple copies of the OpenMP runtime have been linked into the program. That is dangerous, since it can degrade performance or cause incorrect results. The best thing to do is to ensure that only a single OpenMP runtime is linked into the process, e.g. by avoiding static linking of the OpenMP runtime in any library. As an unsafe, unsupported, undocumented workaround you can set the environment variable KMP_DUPLICATE_LIB_OK=TRUE to allow the program to continue to execute, but that may cause crashes or silently produce incorrect results. For more information, please see http://www.intel.com/software/products/support/.
No error
Add Aer support for an explicit initialize instruction to the Statevector State
class for use in the StatevectorSimulator
and QasmSimulator
to work with the Terra PR 1896.
The qobj instruction for initialize should be something like:
{"name": "initialize", "qubits": list[int], "params": complex_vector}
And should act to reset all qubits in the "qubits"
field to the zero state (to remove any entanglement with other qubits in the system), and then set the statevector for those qubits to the vector in "params"
.
If the system is already in the zero-state or all qubits are being initialize the reset operations could be skipped and the state set directly.
Consider a 2-qubit circuit, where I want to initialize qubit-0 to the |1> state, and qubit-3 to the |+> state:
state is psi3 \otimes psi0
[{"name": "initialize", "qubits": [0, 3],
"params": [[0, 0], [0.70710678, 0], [0, 0], [0.70710678, 0]]}]
state is psi0 \otimes psi3
[{"name": "initialize", "qubits": [3, 0],
"params": [[0, 0], [0, 0], [0.70710678, 0, 0], [0.70710678, 0]]}]
[{"name": "initialize", "qubits": [0], "params": [[0, 0], [1, 0]]},
{"name": "initialize", "qubits": [3], "params": [[0.70710678, 0], [0.70710678, 0]]}]
The make system used for Aer defaults to the compilers in XCode (See #20) even if the choice of compiler is overridden via path modification or aliasing.
It should be possible to select which compiler is used to build Aer.
Qiskit Terra: master
pip install qiskit-aer
is putting the Aer
provider into the qiskit
meta package and not into the terra providers module:
/miniconda3/lib/python3.7/site-packages/qiskit/providers/aer/*
So terra cannot find it:
ImportError: cannot import name 'Aer' from 'qiskit' (/miniconda3/lib/python3.7/site-packages/qiskit_terra-0.8.0-py3.7-macosx-10.7-x86_64.egg/qiskit/__init__.py)
Before raising an issue here I've asked Stack Overflow:
https://stackoverflow.com/questions/53929599/cannot-import-aer-from-qiskit-0-7
In Python interpreter, typing from qiskit import Aer
raises an ImportError.
-Install Python 3
-Set up a new virtual environment: python -m venv C:\myenv
-activate this environment and pip install qiskit
-run python interpreter
-from qiskit import Aer
It also appears that doing the same on Ubuntu doesn't cause any problems
Expected that it would import
Distributing a wheel package with an executable/library statically linked makes things easier for our users as they don't need to install external dependencies. It has it's drawbacks as well but in general, and for our specific use case the balance tilts towards static linking.
On Windows platforms, we are not building statically yet, so this is issue is to track this progress.
If I found any stopper to not building statically, I'd document it here.
@padraic-padraic this may be related to issue #98, or something different. While trying to debug that issue with Sergey I found that the CH simulator will cause a segmentation fault sometimes for circuits for a test circuit with a u1
gate in it.
Run the following script, at a random point in the iteration loop it may crash with a segmentation fault (though not always).
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister, execute
from qiskit.providers.aer import QasmSimulator
import numpy as np
qr = QuantumRegister(2, 'qr')
cr = ClassicalRegister(2, 'cr')
circ = QuantumCircuit(qr, cr)
circ.h(qr[0])
circ.cx(qr[0], qr[1])
circ.u1(np.pi / 100, qr[0])
circ.measure(qr, cr)
for j in range(100):
result = execute(circ, QasmSimulator(), backend_options={"method": "ch"}).result()
print("Execution {}:".format(j), result.get_counts(circ))
It also returns the incorrect output (same as #98 )
The execution doesn't cause a segmentation fault.
None yet.
The make system does not find the OpenBLAS libraries in their default location in OSX. Instead, the Apple Accelerate libs are always used.
The installer should find the OpenBLAS libs if they are installed in the default dirs.
Since we have to pass an important configuration parameter (runtime path) to the MacOS simulator, I have noticed that we have to explicitly call the controller::set_config( qobj["config"] )
function before calling execute
. The thing is that execute
already takes the qobj
(so the qobj["config"]
) as a parameter, so there's no virtual need for calling controller::set_config()
explicitly.
We need to redesign how configuration is loaded in the simulators, having simplicity for the user in mind (he should not call any function if it's not strictly necessary).
Related to Qiskit/qiskit#84
Make sure Aer's CONTRIBUTING file stands on its own, so Aer's install doc can be removed.
We want to synthesize install instructions for all Qiskit packages into a global Install Qiskit doc section, where the global install doc refers Qiskit contributors to each package's CONTRIBUTING file for details on how to install from source.
Currently, Aer's doc includes 'Install from Source' instructions here. This was an initial (incomplete) attempt to hone the current instructions in Aer's CONTRIBUTING file.
Aer's CONTRIBUTING file should be updated to stand on its own.
After Aer's CONTRIBUTING file is updated, the Installing Aer section of the doc will be removed.
Building Aer on OSX requires having XCode installed. This is 6Gb of docs and other things that are not needed. It should be possible to build Aer using only the Apple command line tools, homebrew llvm, or homebrew gcc.
I'd like Aer to have documentation similar to Terra's, shown here: https://qiskit.org/documentation/
I'm treating this as a bug, because while I was trying to make our code compatible with OpenMP 2 (unfortunate Windows constraints), I saw that we are abusing of uint64_t
(and it's variants) types.
Event though modern 64 bits processors can handle 64 bits without any penalty, there's an extra amount of memory we are wasting because of this, and because we need to be compatible with OpenMP 2, so we can't use unsigned
type variables in the for
loops being parallelized, I'd recommend thinking very carefully whether our data structures require to be 64 bit unsigned or not.
For now, there are some dangerous conversions from uint64_t
to unsigned
(which is promoted to a uint32_t
) that we have to fix.
I saw this code in the new CH simulator, but we have to review all the codebase.
Fortunately, the compiler warns about this situation, so it's easy to detect and fix.
This seems to be a good candidate for an introductory issue, and get used to our workflow, so if there's any intrepid contributor who wants to takeover this issue, I'll mentor!
There should be now warnings about suspicious implicit castings, with possible lost of data.
Move unsigned
index variables to signed
and manually convert back from signed
to a temporary unsinged
that will be finally used as the index, but only in loops being parallelized with OpenMP:
For example:
#pragma omp parallel for
for(unt_t i=0; i<dim; i++){ // <--- This is not allowed per OpenMP 2
vector[i] = ...
Fix:
#include <limits>
#pragma omp parallel for
for(int_t i = std::numeric_limits<int_t>::min(); i < dim; i++){
vector[from_signed_to_unsigned(i)] = ...
The free function:
template<typename unsigned_type, typename signed_type>
unsigned_type from_signed_to_unsigned( signed_type i );
... should transform a negative number to it's corresponding positive number, for example:
std::cout << from_signed_to_unsigned<uint_t, int_t>(std::numeric_limits<int_t>::min());
... should print: 0
.
We need to have this framework in place for the 0.2 release.
As we do in other Qiskit-related packages, like Terra (see below), we should provide the URL of the Qiskit AER homepage in the setup.py
. That URL is shown as part of the installation info and in other dependencies-related tools. In this sense, we are using the GitHub repo URL as the homepage for all the Qiskit packages.
This issue is to track development of the tensor network simulator (currently in MPS form). WIP PR will follow soon by @eladgoldman
Fully interface with Qiskit - be a backend / provider
Implement all relevant base functions for simulator
Currently known bugs to fix: miscompares in special cases with Qasm simulator, some memory fails
Test suites
Runtime and memory performance profiling and optimizations
Documentation in code, readme, and tutorials/notebooks
Compilation files (make)
Random circuits (including T's), parametrized by number of number of qubits, depth, and percentage of CXs
Structured circuits
Relevant benchmarks from the test library https://github.com/Qiskit/qiskit/tree/master/test/benchmarks
Aqua usecases
Find the qubit limit - currently we stopped at 23 for confidence reasons (needed to compare full statevectors to reference) but appears can go much higher when asking only for expectation values
Native interface for input observable(s) to get their expectation value at output
Native dealing with non-nearest-neighbors CX's (i.e., without hidden SWAPs). This is possible as long as no CX-cycles, so need to add SWAPs only when encountering cycles in input (today SWAPing on any non-nearest neighbor)
Consider possibilities to use incrementally - taking advantage of previous results on sub-circuit
Consider possibilities to parallelize (@hhorii we hope you could help here when the code matures)
I get a crash when I run the simulator from Jupyter notebook, with an error message that I don't understand. The same code runs alright outside of Jupyter notebook.
Someone else has already encountered the same and provided an accurate description: https://stackoverflow.com/questions/50611414/jupyter-notebook-always-gives-brokenprocesspool-error-while-executing-qiskit-cod
Do not crash, or at least crash with a meaningful message.
I want to compile the cpp_simulator.
Now, I want to execute:
python setup.py build
and get the error:
/opt/rh/devtoolset-7/root/usr/libexec/gcc/x86_64-redhat-linux/7/ld: /opt/xsite/cte/tools/python/3.6.4/lib/libpython3.6m.a(getcopyright.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
I have build cmake, OpenBlas and Boost. After that, I have tried to execute:
python setup.py build
Using BasicAer qasm_simulator, the behavior of a circuit changes depending on the order in which quantum registers are added to the circuit.
from qiskit import QuantumRegister,ClassicalRegister,QuantumCircuit
from qiskit import BasicAer,execute
from qiskit.tools.visualization import plot_histogram
q = QuantumRegister(2, 'cntl')
qout = QuantumRegister(1, 'tgt')
c = ClassicalRegister(1, 'c')
qc = QuantumCircuit(qout, q, c) # here's where we create the circuit
qc.h(q[0]) # Toffoli gate with two |+> inputs
qc.h(q[1])
qc.ccx(q[0],q[1],qout[0])
qc.measure(qout,c)
backend = BasicAer.get_backend('qasm_simulator')
job = execute(qc, backend, shots=512)
result = job.result()
print(result.get_counts()) # produces expected outcome -- 75% zero and 25% one
q2 = QuantumRegister(2, 'cntl') # now we do the same thing, but create the circuit differently
qout2 = QuantumRegister(1, 'tgt')
c2 = ClassicalRegister(1)
qc2 = QuantumRegister(q2, qout2, c2) # just changed the order of q and qout
qc2.h(q2[0]) # Toffoli gate with two |+> inputs
qc2.h(q2[1])
qc2.ccx(q2[0],q2[1],qout2[0])
qc2.measure(qout2,c2)
backend = BasicAer.get_backend('qasm_simulator')
job = execute(qc2, backend, shots=512)
result = job.result()
print(result.get_counts()) # result is 100% zero
The output should be the same in both cases. I see the expected behavior when using the Aer provider, and when running on hardware.
Currently, a BLAS implementation is needed Aer to build. However NumPy, which is a requirement, is already linked to a BLAS library. Under Anaconda, for example, this is the Intel MKL. It is possible to use this BLAS for Aer as well, a la Cython and the old qasm_simulator
that used it.
According to the spec "Qiskit Backend Specifications for OpenQASM and OpenPulse Experiments", all backends are required to have a coupling_map
in their backend.configuration()
. The Aer
backends do not.
Runtime error at statement: from qiskit import Aer
ImportError: cannot import name 'Aer' from 'qiskit' (/home/claude/anaconda3/envs/QiskitDevenv/lib/python3.7/site-packages/qiskit/init.py)
My install sequence:
conda create -y -n QiskitDevenv python=3
source activate QiskitDevenv
download zip https://github.com/Qiskit/qiskit-aqua.git
cd /home/claude/Downloads/qiskit-aqua/qiskit-aqua-master
pip install -r requirements.txt
pip install -r requirements-dev.txt
pip install git+https://github.com/Qiskit/qiskit.git
pip install git+https://github.com/Qiskit/qiskit-aer.git
pip install git+https://github.com/Qiskit/qiskit-terra.git
pip install git+https://github.com/Qiskit/qiskit-aqua.git
pip install git+https://github.com/Qiskit/qiskit-chemistry.git
conda install -n QiskitDevenv -c anaconda anaconda-navigator
conda install -n QiskitDevenv nbconvert
~/anaconda-navigator
launch Jupyter, execute notebook with chemistry pilot sample
pip list
..
qiskit 0.8.0
qiskit-aer 0.1.1
qiskit-aqua 0.4.2
qiskit-chemistry 0.4.3
qiskit-ignis 0.1.0
qiskit-terra 0.8.0
..
Successful import of class Aer from the installed qiskit package.
Running the simulator with a noise model which consists of the following single error:
noise_model.add_all_qubit_quantum_error(depolarizing_error(0.002, 2), 'bla')
Currently the simulator succeeds. Of course no noise occurs.
I think it would be better to raise an error, accompanied by a message: attempt to attach noise to gate 'bla', but gate 'bla' does not exist.
qiskit 0.7.0
qiskit-aer 0.1.0
qiskit-terra 0.8.0
Windows 10
When running this line:
from qiskit.providers.aer import noise
I got:
from qasm_controller_wrapper import qasm_controller_execute
ImportError: DLL load failed: The specified module could not be found.
There are additional error messages:
from .aerprovider import AerProvider
File "C:\Users\xyz\AppData\Local\Programs\Python\Python36\lib\site-packages\qiskit\providers\aer\aerprovider.py", line 15, in
from .backends.qasm_simulator import QasmSimulator
File "C:\Users\xyz\AppData\Local\Programs\Python\Python36\lib\site-packages\qiskit\providers\aer\backends_init_.py", line 10, in
from .qasm_simulator import QasmSimulator
File "C:\Users\xyz\AppData\Local\Programs\Python\Python36\lib\site-packages\qiskit\providers\aer\backends\qasm_simulator.py", line 16, in
Running this line:
from qiskit.providers.aer import noise
Qiskit Aer: 0.1.1
Python 3.6
Ubuntu 18.04
When the qasm_simulator executable has an error it returns a 0 exit code, which traditionally means success.
Download and unzip the following test file (or any other file that causes a failure) -
fail.json.gz
run: ./qasm_simulator fail.json
echo $?
The return code will be 0, even though you'll get "success": false, and "status": "ERROR: ..."
exit code that is not 0
In some build environment, json_t
is not converted to std::string
.
qiskit-aer/src/simulators/ch/ch_runner.hpp
Line 615 in 72863e8
qiskit-aer/src/third-party/headers/nlohmann_json.hpp:1201:9: error: static_assert failed "could not find from_json() method in T's namespace" [clang-diagnostic-error]
static_assert(sizeof(BasicJsonType) == 0,
^
qiskit-aer/src/third-party/headers/nlohmann_json.hpp:1216:16: note: in instantiation of function template specialization 'nlohmann::detail::from_json_fn::call<nlohmann::basic_json<std::map, std::vector, std::__1::basic_string<char>, bool, long long, unsigned long long, double, std::allocator, adl_serializer>, std::__1::basic_string_view<char, std::__1::char_traits<char> > >' requested here
return call(j, val, priority_tag<1> {});
^
qiskit-aer/src/third-party/headers/nlohmann_json.hpp:9669:9: note: in instantiation of function template specialization 'nlohmann::detail::from_json_fn::operator()<nlohmann::basic_json<std::map, std::vector, std::__1::basic_string<char>, bool, long long, unsigned long long, double, std::allocator, adl_serializer>, std::__1::basic_string_view<char, std::__1::char_traits<char> > >' requested here
::nlohmann::from_json(std::forward<BasicJsonType>(j), val);
^
qiskit-aer/src/third-party/headers/nlohmann_json.hpp:12094:36: note: in instantiation of function template specialization 'nlohmann::adl_serializer<std::__1::basic_string_view<char, std::__1::char_traits<char> >, void>::from_json<const nlohmann::basic_json<std::map, std::vector, std::__1::basic_string<char>, bool, long long, unsigned long long, double, std::allocator, adl_serializer> &, std::__1::basic_string_view<char, std::__1::char_traits<char> > >' requested here
JSONSerializer<ValueType>::from_json(*this, ret);
^
qiskit-aer/src/third-party/headers/nlohmann_json.hpp:12355:16: note: in instantiation of function template specialization 'nlohmann::basic_json<std::map, std::vector, std::__1::basic_string<char>, bool, long long, unsigned long long, double, std::allocator, adl_serializer>::get<std::__1::basic_string_view<char, std::__1::char_traits<char> >, std::__1::basic_string_view<char, std::__1::char_traits<char> >, 0>' requested here
return get<ValueType>();
^
/usr/local/Cellar/llvm/7.0.0/bin/../include/c++/v1/string:875:29: note: in instantiation of function template specialization 'nlohmann::basic_json<std::map, std::vector, std::__1::basic_string<char>, bool, long long, unsigned long long, double, std::allocator, adl_serializer>::operator basic_string_view<std::__1::basic_string_view<char, std::__1::char_traits<char> >, 0>' requested here
{__self_view __sv = __t; return assign(__sv);}
^
qiskit-aer/src/simulators/ch/ch_runner.hpp:615:26: note: in instantiation of function template specialization 'std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::operator=<nlohmann::basic_json<std::map, std::vector, std::__1::basic_string<char>, bool, long long, unsigned long long, double, std::allocator, adl_serializer>, void>' requested here
serialized_states[i] = serialize_state(i);
^
Build standalone.
mkdir build
cd build
cmake -DCMAKE_CXX_COMPILER=g++-8 ..
make
Build finishes without errors.
serialized_states[i] = serialize_state(i).dump();
Debian install Python stuff in dist-package
directory, instead of site-packages
, so our current wheels installation doesn't work on these distros.
Install Qiskit
Try to import Aer:
from qiskit import Aer
This will fail.
We would love to support as many Linux distros as possible.
When I call qiskit.providers.aer.noise.device.basic_device_noise_model
with thermal_relaxation=False
, UnboundLocalError
occurs.
It is because relax_params
is defined only when thermal_relaxation=True
.
See https://github.com/Qiskit/qiskit-aer/blob/master/qiskit/providers/aer/noise/device/models.py#L158
Run the following code.
from qiskit import IBMQ
from qiskit.providers.aer.noise.device.models import basic_device_noise_model
IBMQ.load_accounts()
properties = IBMQ.get_backend('ibmq_16_melbourne').properties()
basic_device_noise_model(properties, thermal_relaxation=False)
Get the following output.
C:\home\ima\envs\vqe2\lib\site-packages\marshmallow\schema.py:364: ChangedInMarshmallow3Warning: strict=False is not recommended. In marshmallow 3.0, schemas will always be strict. See https://marshmallow.readthedocs.io/en/latest/upgrading.html#schemas-are-always-strict
ChangedInMarshmallow3Warning
Traceback (most recent call last):
File "a.py", line 6, in <module>
basic_device_noise_model(properties, thermal_relaxation=False)
File "C:\home\ima\envs\vqe2\lib\site-packages\qiskit\providers\aer\noise\device\models.py", line 104, in basic_device_noise_model
standard_gates=standard_gates)
File "C:\home\ima\envs\vqe2\lib\site-packages\qiskit\providers\aer\noise\device\models.py", line 185, in basic_device_gate_errors
relax_params,
UnboundLocalError: local variable 'relax_params' referenced before assignment
No error occurs.
Initialize relax_params
.
See #52
Error when importing Aer in trinket and Google Colab.
I've also seen people have the problems on Windows. I suggested installation from source, but they had no desire to take that step.
See the above links.
Aer should be importable.
I get a SchemaValidationError
qiskit.qobj._schema_validation._SummaryValidationError: 'Original message too long to be useful: {\'qobj_id\': \'db850989-a583-4578-a0d6-8b4b275af261\', \'config\': {\'shots\': 1024, \'memory_slots\': 0, \'max_credits\': 10, \'memory\': False, \'n_qubits\': 1}, \'experiments\': [{\'instructions\': [], \'header\': {\'n_qubits\': 1, \'memory_slots\': 0, \'qubit_labels\': [[\'q0\', 0]], \'clbit_labels\': [], \'qreg_sizes\': [[\'q0\', 1]], \'creg_sizes\': [], \'name\': \'circuit0\', \'compiled_circuit_qasm\': \'OPENQASM 2.0;\\ninclude "qelib1.inc";\\nqreg q0[1];\\n\'}, \'config\': {\'memory_slots\': 0, \'n_qubits\': 1}}], \'header\': {\'backend_name\': \'statevector_simulator\'}, \'type\': \'QASM\', \'schema_version\': \'1.0.0\'} is not valid under any of the given schemas\n\nFailed validating \'oneOf\' in schema:\n {\'$schema\': \'http://json-schema.org/draft-04/schema#\',\n \'definitions\': {\'bfunc\': {\'properties\': {\'mask\': {\'type\': \'string\'},\n \'memory\': {\'minimum\': 0,\n \'type\': \'integer\'},\n \'name\': {\'enum\': [\'bf[...]'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "initialize_bug.py", line 9, in <module>
job_sim = execute(qc, backend)
File "~/envs/quantum/lib/python3.7/site-packages/qiskit/tools/compiler.py", line 110, in execute
return backend.run(qobj, **kwargs)
File "~/envs/quantum/lib/python3.7/site-packages/qiskit/providers/aer/backends/aerbackend.py", line 80, in run
aer_job.submit()
File "~/envs/quantum/lib/python3.7/site-packages/qiskit/providers/aer/aerjob.py", line 73, in submit
validate_qobj_against_schema(self._qobj)
File "~/envs/quantum/lib/python3.7/site-packages/qiskit/qobj/_validation.py", line 23, in validate_qobj_against_schema
err_msg='Qobj failed validation. '
File "~/envs/quantum/lib/python3.7/site-packages/qiskit/qobj/_schema_validation.py", line 148, in validate_json_against_schema
raise newerr
qiskit.qobj._schema_validation.SchemaValidationError: 'Qobj failed validation. Set Qiskit log level to DEBUG for further information.'
from qiskit import QuantumCircuit, QuantumRegister, execute
from qiskit.providers.aer import Aer
backend = Aer.get_backend('statevector_simulator')
q = QuantumRegister(1)
qc = QuantumCircuit(q)
job_sim = execute(qc, backend)
print(job_sim.result().get_statevector())
[1.+0.j 0.+0.j]
$ pip install qiskit-aer==0.1.1
Collecting qiskit-aer==0.1.1
Could not find a version that satisfies the requirement qiskit-aer==0.1.1 (from versions: 0.1.0)
No matching distribution found for qiskit-aer==0.1.1
pip install qiskit
Installation of qiskit 0.8.0 should install qiskit-aer 0.1.1.
Find out what got broken at PyPi.
We want to know what version are we using in the standalone simulator via: qasm_simulator -v
Only the version number information will be shown for now:
Qiskit Aer: 0.1.1
"from qiskit.providers.aer import noise" leads to the following:
ModuleNotFoundError Traceback (most recent call last)
in
----> 1 from qiskit.providers.aer import noise
/usr/local/lib/python3.6/dist-packages/qiskit/providers/aer/init.py in
8 """Aer Backends."""
9
---> 10 from .aerprovider import AerProvider
11 from .aerjob import AerJob
12 from .aererror import AerError
/usr/local/lib/python3.6/dist-packages/qiskit/providers/aer/aerprovider.py in
13 from qiskit.providers.providerutils import filter_backends
14
---> 15 from .backends.qasm_simulator import QasmSimulator
16 from .backends.statevector_simulator import StatevectorSimulator
17 from .backends.unitary_simulator import UnitarySimulator
/usr/local/lib/python3.6/dist-packages/qiskit/providers/aer/backends/init.py in
8 """Aer Backends."""
9
---> 10 from .qasm_simulator import QasmSimulator
11 from .statevector_simulator import StatevectorSimulator
12 from .unitary_simulator import UnitarySimulator
/usr/local/lib/python3.6/dist-packages/qiskit/providers/aer/backends/qasm_simulator.py in
15 from qiskit.providers.models import BackendConfiguration
16 from .aerbackend import AerBackend
---> 17 from qasm_controller_wrapper import qasm_controller_execute
18 from ..aererror import AerError
19 from ..version import version
ModuleNotFoundError: No module named 'qasm_controller_wrapper'
Due to our directory structure, and our dependency with Qiskit-Terra, we have a far from ideal testing workflow, which is very error-prone and confusing many times.
We have to figure out a way to improve this situation and make testing seamless again.
We need a density matrix simulator to perform noisy simulations of experiments for small-size systems.
pip install qiskit-aer --no-binary :all:
does not install qiskit-aer.
$ apt-get install software-properties-common -y
$ apt-get install python3.6 python3.6-dev wget -y
$ wget https://bootstrap.pypa.io/get-pip.py
$ python3.6 get-pip.py
wget https://github.com/Kitware/CMake/releases/download/v3.13.4/cmake-3.13.4.tar.gz
cd cmake-3.13.4
./configure
make
make install
pip3 install scikit-build -y
pip3 install cmake cython -y
pip3 install qiskit
pip3 uninstall qiskit-aer
pip3 install qiskit-aer --no-binary :all:
qiskit-aer is installed correctly.
BUG TEMPLATE
it crashed during the configuration when I try to build (python ./setup.py build) under my virtualenv
install qiskit from source
wget https://github.com/Qiskit/qiskit/archive/0.7.2.tar.gz
tar xzvf 0.7.2.tar.gz
pip ...
uninstall qiskit-terra qiskit-aer
pip install qiskit-terra/0.8.0 from source
python ./setup.py build
from source of aer
the error message:
CMake Error at CMakeLists.txt:13 (project):
Running
'/tmp/pip-build-env-w2x28op_/bin/ninja' '--version'
failed with:
No such file or directory
it installs correctly the package
FEATURE REQUEST TEMPLATE
ENHANCEMENT REQUEST TEMPLATE
Aer's Terra-integrated tests not running, i.e.:
python -m unittest discover -s test -v
python -m unittest discover -s test -v
Tests run.
Fix the offending line of code in test/terra/utils/common.py
While running it in my local machine/HPC, I get multiple warnings for OpenBLAS Warning: Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option.
How do I get rid of it? Does this warning affect my results/speed in any way?
original issue from @tigerjack: Qiskit/qiskit#1590
I got an exception on two different machines, but I'm not sure if it's related to qiskit-terra
or python
itself. The exception arise when I invoke the job.result()
method.
File "/home/simone/LinuxData/virtualenvs/qiskit_env/lib/python3.7/site-packages/qiskit/providers/aer/aerjob.py", line 39, in _wrapper
return func(self, *args, **kwargs)
File "/home/simone/LinuxData/virtualenvs/qiskit_env/lib/python3.7/site-packages/qiskit/providers/aer/aerjob.py", line 98, in result
return self._future.result(timeout=timeout)
File "/usr/lib64/python3.7/concurrent/futures/_base.py", line 432, in result
return self.__get_result()
File "/usr/lib64/python3.7/concurrent/futures/_base.py", line 384, in __get_result
raise self._exception
concurrent.futures.process.BrokenProcessPool: A process in the process pool was terminated abruptly while the future was running or pending.
I found other similar issue which suggested to use the if __name__ == "__main__":
statement, but this is already there: the whole program code is under this statement.
The problem appears randomly when I run my qiskit program. It's a huge project, and sometimes the program works seamlessly, while others fail with this message.
The program should always run without problems.
@padraic-padraic I noticed some unusual behaviour while testing the CH simulator. If I run a bell preparation circuit and insert a t
gate (which should not change the output) instead of returning {'00': shots / 2, '11': shots / 2}
, it appears to return {'00' : shots}
or {'11': shots}
.
Test circuit that should return counts = {'00': shots / 2, '11': shots / 2}
since the final t-gate commutes with the last measurement.
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister, execute
from qiskit.providers.aer import QasmSimulator
import numpy as np
# Test Circuit
qr = QuantumRegister(2, 'qr')
cr = ClassicalRegister(2, 'cr')
circ = QuantumCircuit(qr, cr)
circ.h(qr[0])
circ.cx(qr[0], qr[1])
circ.t(qr[0])
circ.measure(qr, cr)
# Execute
result = execute(circ, QasmSimulator(), backend_options={"method": "ch"}).result()
counts = result.get_counts(circ)
This returns either counts ={'00' : 1024}
or counts = {'11' : 1024}
with roughly even probability.
It should return something close to counts ={'00' : 512, '11': 512}
.
I'm not sure, I mentioned the problem to Sergey and he is also looking into.
I'm having again the same problem presented here .
Basically, this is the exception
Traceback (most recent call last):
File "permutations_16.py", line 62, in <module>
result = job.result()
File "/mnt/residential_zone/home/sperriello/virtual_envs/qiskit_beta/lib64/python3.6/site-packages/qiskit/providers/aer/aerjob.py", line 38, in _wrapper
return func(self, *args, **kwargs)
File "/mnt/residential_zone/home/sperriello/virtual_envs/qiskit_beta/lib64/python3.6/site-packages/qiskit/providers/aer/aerjob.py",
line 95, in result return self._future.result(timeout=timeout)
File "/usr/lib64/python3.6/concurrent/futures/_base.py", line 432, in result
return self.__get_result()
File "/usr/lib64/python3.6/concurrent/futures/_base.py", line 384, in __get_result
raise self._exception concurrent.futures.process.BrokenProcessPool: A process in the process pool was terminated abruptly while the future was running or pending.
The program uses a total of 31 qubits on a server with 125GiB of RAM, with an Hadamard gate on 15 of them and just a controlled swap based on the previous Hadamard result on the other. I am using the statevector_simulator
backend.
I also tried to reinstall qiskit-aer from the latest version through pip install git+https://github.com/Qiskit/qiskit-aer/
, but I get a different problem related to a coupling map being none, so I returned to the stable version.
The program should run without problems.
Seems like the packages we are distributing via PyPi don't work as expected on Minicionda3 AND Python 3.7
Everything seems to be working with Python 3.5 and 3.6
In the previous simulator, we had a job.qobj. I know @ajavadia wanted this for the IBMQ. I am not sure we need this for simulators but I'm putting it here as I think we need to either add job.qobj here or remove job.qobj from basic. I don't mind which way we go but i would like the two simulators to have the same methods with aer having more not less.
In testing Qiskit/qiskit#1778 with the Aer provider, submitting a conditional circuit with a qobj-compliant conditional raises a AerBackend: simulation failed
error from
qiskit-aer/src/base/controller.hpp
Line 284 in dac153d
{'job_id': None,
'date': None,
'backend_name': None,
'qobj_id': None,
'status': 'ERROR: Failed to load qobj: [json.exception.type_error.302] type must be array, but is number',
'backend_version': None,
'success': False}
Checkout Qiskit/qiskit#1778 and run any conditional circuit. e.g.
qr = qk.QuantumRegister(2)
cr1 = qk.ClassicalRegister(1)
cr2 = qk.ClassicalRegister(1)
qc = qk.QuantumCircuit(qr, cr1, cr2)
qc.h(qr[0])
qc.measure(qr[0],cr1)
qc.x(qr[1]).c_if(cr1, 1)
qc.measure(qr[1],cr2)
The resulting qobj
{'config': {'memory_slots': 2, 'n_qubits': 2},
'experiments': [{'config': {'memory_slots': 2, 'n_qubits': 2},
'header': {'clbit_labels': [['c0', 0], ['c1', 0]],
'creg_sizes': [['c0', 1], ['c1', 1]],
'memory_slots': 2,
'n_qubits': 2,
'name': 'circuit0',
'qreg_sizes': [['q0', 2]],
'qubit_labels': [['q0', 0], ['q0', 1]]},
'instructions': [{'name': 'h', 'qubits': [0]},
{'memory': [0],
'name': 'measure',
'qubits': [0],
'register': [0]},
{'mask': '0x1',
'name': 'bfunc',
'register': 2,
'relation': '==',
'val': '0x1'},
{'conditional': 2,
'name': 'x',
'qubits': [1]},
{'memory': [1],
'name': 'measure',
'qubits': [1],
'register': [1]}]}],
'header': {},
'qobj_id': '94b4fbcc-e12e-47bc-898c-4106b4686867',
'schema_version': '1.0.0',
'type': 'QASM'}
contains a bfunc
with register: 2
, which is causing the JSON parser to throw.
It looks like the JSON->op parser ( https://github.com/Qiskit/qiskit-aer/blob/master/src/framework/operations.hpp#L474 ) expects memory and register to be arrays ( https://github.com/Qiskit/qiskit-aer/blob/master/src/framework/operations.hpp#L38 ) but in the qobj-spec, bfunc
instructions are a special case where they are singleton integers.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.