Skip to content
This repository has been archived by the owner on Dec 7, 2021. It is now read-only.

Make pyscf an optional dependency #1140

Merged
merged 9 commits into from
Jul 24, 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
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ jobs:
- sudo apt-get -y install libgfortran5
# Installing pyquante2 master branch...
- pip install https://github.com/rpmuller/pyquante2/archive/master.zip --progress-bar off
- pip install cplex
- pip install cplex pyscf
before_script:
- export PYTHON="coverage3 run --source qiskit/aqua,qiskit/chemistry,qiskit/finance,qiskit/ml,qiskit/optimization --omit */gauopen/* --parallel-mode"
script:
Expand All @@ -266,6 +266,7 @@ jobs:
- sudo apt-get -y install libgfortran5
# Installing pyquante2 master branch...
- pip install https://github.com/rpmuller/pyquante2/archive/master.zip --progress-bar off
- pip install pyscf
script:
- stestr --test-path test/chemistry run 2> >(tee /dev/stderr out.txt > /dev/null)
- python tools/extract_deprecation.py -file out.txt -output chemistry38.dep
Expand Down
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ these on a quantum backend, whether a real device or simulator.
* **IBM CPLEX** may be [installed](https://qiskit.org/documentation/apidoc/qiskit.aqua.algorithms.minimum_eigen_solvers.cplex.html)
to allow use of the `ClassicalCPLEX` classical solver algorithm. `pip install cplex` may be used
as an alternative.
* **PyTorch**, may be installed either using command `pip install qiskit-aqua[torch]` to install the
* **PyTorch**, may be installed either using command `pip install torch` to install the
package or refer to PyTorch [getting started](https://pytorch.org/get-started/locally/). PyTorch
being installed will enable the neural networks `PyTorchDiscriminator` component to be used with
the QGAN algorithm.
Expand Down Expand Up @@ -161,10 +161,6 @@ Several, as listed below, are supported, and while logic to interface these prog
the chemistry module via the above pip installation, the dependent programs/libraries themselves need
to be installed separately.

Note: As `PySCF` can be installed via pip the installation of Qiskit (Aqua) will install PySCF
where it's supported (MacOS and Linux x86). For other platforms see the PySCF information as to
whether this might be possible manually.

1. [Gaussian 16™](https://qiskit.org/documentation/apidoc/qiskit.chemistry.drivers.gaussiand.html), a commercial chemistry program
2. [PSI4](https://qiskit.org/documentation/apidoc/qiskit.chemistry.drivers.psi4d.html), a chemistry program that exposes a Python interface allowing for accessing internal objects
3. [PySCF](https://qiskit.org/documentation/apidoc/qiskit.chemistry.drivers.pyscfd.html), an open-source Python chemistry program
Expand Down
3 changes: 0 additions & 3 deletions qiskit/chemistry/drivers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,6 @@
the relevant installation instructions below for your program/library that you intend
to use.

Note: `PySCF` is automatically installed for `macOS` and `Linux` platforms when Qiskit
is installed. For other platforms again consult the relevant installation instructions below.

.. toctree::
:maxdepth: 1

Expand Down
4 changes: 0 additions & 4 deletions qiskit/chemistry/drivers/pyscfd/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@
the preferred installation method is via the pip package management system. Doing so,
while in the Python virtual environment where Qiskit's chemistry module is also installed, will
automatically make PySCF available to Qiskit at run time.

Note: `PySCF` is automatically installed for `macOS` and `Linux` platforms when Qiskit is
installed via the pip package management system.

"""

from .pyscfdriver import PySCFDriver, InitialGuess
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ fastdtw
setuptools>=40.1.0
h5py
networkx>=2.2
pyscf; sys_platform != 'win32'
pandas
quandl
yfinance
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
"setuptools>=40.1.0",
"h5py",
"networkx>=2.2",
"pyscf; sys_platform != 'win32'",
"pandas",
"quandl",
"yfinance",
Expand Down Expand Up @@ -88,6 +87,7 @@
'torch': ["torch; sys_platform == 'linux' or (python_version < '3.8' and sys_platform != 'win32')"],
'cplex': ["cplex; python_version >= '3.6' and python_version < '3.8'"],
'cvx': ['cvxpy>1.0.0,<1.1.0'],
'pyscf': ["pyscf; sys_platform != 'win32'"],
},
zip_safe=False
)
20 changes: 11 additions & 9 deletions test/chemistry/test_driver_fcidump_dumper.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,18 +115,20 @@ def setUp(self):
charge=0,
spin=0,
basis='sto3g')
except QiskitChemistryError:
self.skipTest('PYSCF driver does not appear to be installed')

qmolecule = driver.run()
qmolecule = driver.run()

dump = tempfile.NamedTemporaryFile()
FCIDumpDriver.dump(qmolecule, dump.name)
dump = tempfile.NamedTemporaryFile()
FCIDumpDriver.dump(qmolecule, dump.name)

from pyscf.tools import fcidump as pyscf_fcidump # pylint: disable=import-outside-toplevel
self.dumped = pyscf_fcidump.read(dump.name)
# pylint: disable=import-outside-toplevel
from pyscf.tools import fcidump as pyscf_fcidump
self.dumped = pyscf_fcidump.read(dump.name)

dump.close()
dump.close()
except QiskitChemistryError:
self.skipTest('PYSCF driver does not appear to be installed.')
except ImportError:
self.skipTest('PYSCF driver does not appear to be installed.')


if __name__ == '__main__':
Expand Down