Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove PySCF from the plugin setup.py #103

Merged
merged 3 commits into from
Sep 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
run: python -m pytest tests --cov=pennylane_qiskit --cov-report=term-missing --cov-report=xml -p no:warnings --tb=native

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1.0.7
uses: codecov/codecov-action@v1
with:
file: ./coverage.xml

Expand Down Expand Up @@ -80,6 +80,6 @@ jobs:
pl-device-test --device=qiskit.aer --tb=short --skip-ops --analytic=True --device-kwargs backend=unitary_simulator

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1.0.7
uses: codecov/codecov-action@v1
with:
file: ./coverage.xml
16 changes: 8 additions & 8 deletions pennylane_qiskit/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,19 +231,19 @@ def _function(params: dict = None, wires: list = None):

def load_qasm(qasm_string: str):
"""Loads a PennyLane template from a QASM string.
Args:
qasm_string (str): the name of the QASM string
Returns:
function: the new PennyLane template
Args:
qasm_string (str): the name of the QASM string
Returns:
function: the new PennyLane template
"""
return load(QuantumCircuit.from_qasm_str(qasm_string))


def load_qasm_from_file(file: str):
"""Loads a PennyLane template from a QASM file.
Args:
file (str): the name of the QASM file
Returns:
function: the new PennyLane template
Args:
file (str): the name of the QASM file
Returns:
function: the new PennyLane template
"""
return load(QuantumCircuit.from_qasm_file(file))
5 changes: 4 additions & 1 deletion pennylane_qiskit/qiskit_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,10 @@ def compile(self):
memory = str(compile_backend) not in self._state_backends

return assemble(
experiments=compiled_circuits, backend=compile_backend, shots=self.shots, memory=memory,
experiments=compiled_circuits,
backend=compile_backend,
shots=self.shots,
memory=memory,
)

def run(self, qobj):
Expand Down
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
"numpy",
"networkx>=2.2;python_version>'3.5'",
# Networkx 2.4 is the final version with python 3.5 support.
"networkx>=2.2,<2.4;python_version=='3.5'",
"pyscf<=1.7.2"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not necessary? how come it was in there?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PySCF has been a buggy for a while; they have released a couple of versions with broken binaries.

PennyLane and Qiskit require mutually exclusive versions of PySCF, and this causes the PennyLane-qiskit plugin to fail at pip installation if Qiskit is already installed (PL-qchem required <=1.7.2, and Qiskit required >1.7.3). We have two options:

  • Including this here forces pip to downgrade pyscf if previously installed by qiskit, allowing qiskit + pl-qiskit + pl-qchem to all be installed together. The downside is that pyscf setup.py file has a bug on windows

  • Removing this will no longer allow qiskit + pl-qiskit + pl-qchem to all be installed together. However, it will allow pennylane-qiskit to be installed on windows.

In retrospect, this is mostly pip's fault at not being able to properly resolve dependencies, and there isn't a good solution.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would pyscf had to be removed from requirements.txt too?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops! I missed that

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made a quick patch #104 :)

"networkx>=2.2,<2.4;python_version=='3.5'"
]

info = {
Expand Down