Skip to content

Commit

Permalink
Change installation (#320)
Browse files Browse the repository at this point in the history
* remove no_pyscf, attempt windows test
* updated psi4 test

---------

Co-authored-by: Valentin Senicourt <[email protected]>
  • Loading branch information
JamesB-1qbit and ValentinS4t1qbit authored Jun 23, 2023
1 parent 3f403fb commit 922d531
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 66 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/continuous_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@ jobs:
if: always()

- name: tangelo install
# Note: the NO_PYSCF install is temporary we will soon make it an optional dependency
env:
NO_PYSCF: 1
run: |
python -m pip install .
if: always()
Expand All @@ -73,9 +70,6 @@ jobs:
if: always()

- name: Install pyscf
# Note: the NO_PYSCF install is temporary we will soon make it an optional dependency
env:
NO_PYSCF: 0
run: |
python -m pip install pyscf
python -m pip install git+https://github.com/pyscf/semiempirical
Expand Down
11 changes: 1 addition & 10 deletions .github/workflows/run_psi4_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ name: psi4 test

on: [pull_request]

env:
NO_PYSCF: 1

jobs:
build:

Expand All @@ -29,42 +26,36 @@ jobs:
- name: Install psi4
shell: bash -el {0}
run: |
conda create -n p4env psi4 -c psi4
conda install psi4 python=3.8 -c psi4
conda init
conda activate p4env
if: always()

- name: Install pip, wheel, pytest, jupyter
run: |
conda activate p4env
python -m pip install --upgrade pip
pip install wheel
pip install pytest
pip install pytest-cov
- name: Install qulacs
run: |
conda activate p4env
pip install qulacs
if: always()

- name: tangelo install
run: |
conda activate p4env
python -m pip install .
if: always()

- name: tangelo psi4 integral tests
run: |
cd tangelo/toolboxes/molecular_computation/tests
conda activate p4env
pytest --doctest-modules --junitxml=junit/psi4-test-results.xml test_psi4.py
if: always()

- name: tangelo psi4 classical tests
run: |
cd tangelo/algorithms/classical/tests
conda activate p4env
pytest --doctest-modules --junitxml=junit/psi4-classical-test-results.xml
if: always()

Expand Down
62 changes: 16 additions & 46 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -96,55 +96,31 @@ separately with ``pip``\ , before trying again.
With Docker
^^^^^^^^^^^

Use our Docker file to deploy Tangelo in a Linux environment, either retrieved from pip or mounted locally.
Comment / uncomment the relevant sections of the Dockerfile to control installation and dependencies.
Use our Docker file to deploy Tangelo in a Linux environment, either retrieved from pip or mounted locally. Comment / uncomment the relevant sections of the Dockerfile to control installation and dependencies.

"No install" notebook method
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

A good alternative for users that simply want to quickly get a working environment ready, especially for quick tests, demos, tutorials.
Check out the tutorial section below to see how services such as Google Colab may help you circumvent local installation challenges or go beyond the limitations of your personal computer if you feel short of compute power or memory.
Check out the tutorial section below to see how services such as Google Colab, Binder or JupyterLab may help you circumvent local installation challenges or go beyond the compute capabilities of your laptop.

Optional dependencies: Quantum Simulators
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Optional dependencies
^^^^^^^^^^^^^^^^^^^^^
Tangelo enables users to target various backends. In particular, it integrates quantum circuit simulators such as ``qulacs``\ , ``qiskit``\ , ``cirq`` or ``qdk``. We leave it to you to install the packages of your choice, and refer to their own documentation. Most packages can be installed through pip or conda in a straightforward way.

Tangelo enables users to target various backends. In particular, it integrates quantum circuit simulators such as
``qulacs``\ , ``qiskit``\ , ``cirq`` or ``qdk``. We leave it to you to install the packages of your choice, and refer to their own documentation.
Most packages can be installed through pip in a straightforward way:

.. code-block::
pip install qulacs
pip install qiskit
pip install cirq
...
Depending on your OS and environment, some of these packages may be more challenging to install. For installing Microsoft's QDK
or any issue regarding the above packages, please check their respective documentation.

Optional dependencies: Classical Quantum Chemistry Packages
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Having trouble with PySCF?
Tangelo can be used without having a classical quantum chemistry package installed but many algorithms, by default, depend on one being installed. The two quantum chemistry packages that are natively supported are `PySCF <https://pyscf.org/>`_ and `Psi4 <https://psicode.org/>`_.

Although PySCF is installed by default, this behaviour can be turned off by defining the environment variable `NO_PYSCF=1` and then
installing using pip by `pip install git+https://github.com/goodchemistryco/Tangelo.git@main` or using the "From source, using setuptools"
method.

The classical solvers `CCSDSolver`, `MP2Solver`, `FCISolver` and `MINDO3Solver` as well as `DMETProblemDecomposition` require
PySCF at this time.

Psi4 is supported everywhere except `CCSDSolver`, `MP2Solver`, `FCISolver` and `MINDO3Solver` and `DMETProblemDecomposition`.
You are also welcome to provide your own interface to a quantum chemistry package of your choice by defining a subclass of `IntegralSolver <https://github.com/goodchemistryco/Tangelo/blob/develop/tangelo/toolboxes/molecular_computation/integral_solver.py>`_. An example of this can be found in `this test <https://github.com/goodchemistryco/Tangelo/blob/develop/tangelo/toolboxes/molecular_computation/tests/test_molecule.py#L167>`_.


Quick note for Windows users
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Our installation instructions will work on Linux and MacOS systems. If you are using Windows, we recommend
you install the `Windows Linux Subsystem <https://docs.microsoft.com/en-us/windows/wsl/install>`_, which allows you
to run Ubuntu as an application. Once it has been installed, you can type ``explorer.exe`` in your Ubuntu terminal to
drag and drop files between your Windows and Linux environment.

Here are a few essentials to install inside a brand new Ubuntu environment, before trying to install Tangelo:
Depending on your OS and environment, some of the optional packages may be more challenging to install. If you are using Windows, we recommend you install the `Windows Linux Subsystem <https://docs.microsoft.com/en-us/windows/wsl/install>`_, which allows you to run Ubuntu as an application. Once it has been installed, you can type ``explorer.exe`` in your Ubuntu terminal to drag and drop files between your Windows and Linux environment. Here are a few essentials to install inside a brand new Ubuntu environment, before trying to install Tangelo:

.. code-block::
Expand All @@ -157,21 +133,17 @@ Here are a few essentials to install inside a brand new Ubuntu environment, befo
Optional: environment variables
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Some environment variables can impact performance (ex: using GPU for quantum circuit simulation, or changing
the number of CPU threads used) or are used to connect to web services providing access to some compute backends.
Some environment variables can impact performance (ex: using GPU for quantum circuit simulation, or changing the number of CPU threads used) or are used to connect to web services providing access to some compute backends.

See the list of relevant environment variables and their use in ``env_var.sh``. In order for these variables to be set to
the desired values in your environment, you can run this shell script in Linux with the following command line:
``source env_var.sh`` (you may need to set execution permissions with ``chmod +x set_env_var.sh`` first), or you can set
them in whatever way your OS supports it, or even inside your python script using the ``os`` package.
See the list of relevant environment variables and their use in ``env_var.sh``. In order for these variables to be set to the desired values in your environment, you can run this shell script in Linux with the following command line:
``source env_var.sh`` (you may need to set execution permissions with ``chmod +x set_env_var.sh`` first), or you can set them in whatever way your OS supports it, or even inside your python script using the ``os`` package.

Tutorials and examples
----------------------

We have a `dedicated repository <https://github.com/goodchemistryco/Tangelo-Examples>`_ for examples and tutorials !

We wrote a number of them, and tried to provide material that doesn't just explain how to use the software, but provides insights into the complex topics of chemistry, quantum computing, and digs into the challenges we encountered in our previous hardware experiments.
Nothing prevents users from contributing and showcasing what they have been doing with Tangelo.
We wrote a number of them, and tried to provide material that doesn't just explain how to use the software, but provides insights into the complex topics of chemistry, quantum computing, and digs into the challenges we encountered in our previous hardware experiments. Nothing prevents users from contributing and showcasing what they have been doing with Tangelo.

You can visualize notebooks directly on Github, most of them have been pre-run.
If you'd like to be able to run them locally, we suggest you use `Jupyter notebooks inside a virtual environment <https://janakiev.com/blog/jupyter-virtual-envs/>`_.
Expand All @@ -193,8 +165,7 @@ Check out our `tutorials <./TUTORIALS.rst>`_ file for more details.
Tests
-----

Unit tests can be found in the ``tests`` folders, located in the various toolboxes they are related to. To automatically
find and run all tests (assuming you are in the ``tangelo`` subfolder that contains the code of the package):
Unit tests can be found in the ``tests`` folders, located in the various toolboxes they are related to. To automatically find and run all tests (assuming you are in the ``tangelo`` subfolder that contains the code of the package):

.. code-block::
Expand All @@ -210,8 +181,7 @@ You do not need to be a seasoned software developer or expert in your field to m
However we need some guidelines and processes to ensure that we build something of quality for the community. We describe them in the `contributions <./CONTRIBUTIONS.rst>`_ file.
There are many ways you can contribute, but in case you're considering contributing to the codebase: don't be scared of the infamous pull request process ! It can feel intimidating, but we've had a few researchers or high-schoolers go through their first one and... they came back for more ! Mostly.

You can use the `Issue tab <https://github.com/goodchemistryco/Tangelo/issues>`_ to open a bug report or feature request.
If you're not sure, starting a discussion in the `Discussion tab <https://github.com/goodchemistryco/Tangelo/discussions>`_ is a good start: we'll figure it out from there.
You can use the `Issue tab <https://github.com/goodchemistryco/Tangelo/issues>`_ to open a bug report or feature request. If you're not sure, starting a discussion in the `Discussion tab <https://github.com/goodchemistryco/Tangelo/discussions>`_ is a good start: we'll figure it out from there.

By joining the Tangelo community and sharing your ideas and developments, you are creating an opportunity for us to learn and grow together, and take ideas to the finish line and beyond.

Expand Down
6 changes: 2 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,14 @@
def install(package):
subprocess.check_call([sys.executable, "-m", "pip", "install", package])


with open("tangelo/_version.py") as f:
version = f.readlines()[-1].split()[-1].strip("\"'")

with open('README.rst', 'r') as f:
long_description = f.read()

install('wheel')
if os.environ.get("NO_PYSCF", "0") == "0":
install('pyscf')
install('git+https://github.com/pyscf/semiempirical')

description = "Maintained by Good Chemistry Company, focusing on the development of end-to-end materials simulation workflows on quantum computers."

Expand All @@ -26,7 +24,7 @@ def install(package):
version=version,
description=description,
long_description=description,
#long_description_content_type=description,
# long_description_content_type=description,
url="https://github.com/goodchemistryco/Tangelo",
packages=setuptools.find_packages(),
test_suite="tangelo",
Expand Down

0 comments on commit 922d531

Please sign in to comment.