Skip to content

Commit

Permalink
Instructions for offline install in README and docs (#312)
Browse files Browse the repository at this point in the history
* Added offline installation instructions

* Typos in README.st

* README.rst readability

* Updated installation.rst

* Adding AbiPy install step

* Verbose description of Conda installation
  • Loading branch information
TeetotalingTom authored Feb 11, 2025
1 parent ea026f0 commit 5e189a7
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 2 deletions.
44 changes: 43 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Finally, install AbiPy with::

conda install abipy -c conda-forge --yes

Please note that, it is also possible to install the abinit executables in the same enviroment using
Please note that, it is also possible to install the abinit executables in the same environment using::

conda install abinit -c conda-forge --yes

Expand Down Expand Up @@ -176,6 +176,48 @@ AbiPy uses the `Git Flow <http://nvie.com/posts/a-successful-git-branching-model
The ``develop`` branch contains the latest contributions, and ``master`` is always tagged and points
to the latest stable release.

Installing without internet access
----------------------------------

Here, it is described how to set up a virtual environment with AbiPy on a cluster that cannot reach out to the internet.
One first creates a virtual environment with AbiPy on a cluster/computer with access, then ports the required files to the cluster without access, and performs an offline installation.
We use Conda for the Python installation and pip for the packages, as the former reduces the odds that incompatibilities arise, while the latter provides convenient syntax for offline package installation.

One first needs Conda on the cluster with access.
If not available by default, follow the instructions for installing Conda at the bottom of this page.
Next, set up a conda virtual environment with a designated Python version, for example 3.12::

conda create --name abienv python=3.12
conda activate abienv

We then install AbiPy in this virtual environment, followed by creating requirements.txt, and creating a folder packages/ containing all the wheels (.whl format)::

pip install abipy
pip list --format=freeze > requirements.txt
pip download -r requirements.txt -d packages/

Next, the .txt file, the folder, and the miniconda installer must be forwarded to the cluster without internet access.
You may have to use a computer that has access to both locations with the scp command.
If the offline cluster does not have Conda preinstalled, the Miniconda executable must be ported so that an offline Conda installation can be performed.
Thus, from a computer that can access both locations, execute::

scp -r connected_cluster:/file/and/folder/location/* .
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
scp -r requirements.txt packages/ Miniconda3-latest-Linux-x86_64.sh disconnected_cluster:/desired/location/

If conda is not available on the cluster that cannot access the internet, follow the instructions on the bottom of this page to install it.
Next, one can set up an **offline** virtual environment on the cluster without internet access::

conda create --name abienv --offline python=3.12
conda activate abienv

At this step, AbiPy might fail to install due to missing/incompatible packages.
Some of these issues may be solved by repeating the above steps (excluding the environment creation) for packages that are listed as missing/incompatible during the installation procedure, by updating the requirements.txt and packages/ and trying to install again.
Upon reading::

Successfully installed abipy-x.y.z

You can quickly test your installation by running ``python`` followed by ``import abipy``.

Installing Abinit
=================
Expand Down
49 changes: 48 additions & 1 deletion docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Anaconda Howto
--------------

Download the anaconda installer from the `official web-site <https://www.continuum.io/downloads>`_.
by choosing the version that matches your OS
by choosing the version that matches your OS.
You may want to use the ``wget`` utility to download the anaconda script directly from the terminal
(useful if you are installing anaconda on a cluster).

Expand Down Expand Up @@ -168,6 +168,53 @@ to the latest stable release.
If you choose to share your developments please take some time to develop some unit tests of at least the
basic functionalities of your code

.. _installing_without_internet_access:

----------------------------------
Installing without internet access
----------------------------------

Here, it is described how to set up a virtual environment with AbiPy on a cluster that cannot reach out to the internet.
One first creates a virtual environment with AbiPy on a cluster/computer with access, then ports the required files to the cluster without access, and performs an offline installation.
We use Conda for the Python installation and pip for the packages, as the former reduces the odds that incompatibilities arise, while the latter provides convenient syntax for offline package installation.

One first needs Conda on the cluster with access.
If not available by default, follow the :ref:`instructions for installing Conda <anaconda_howto>`.
Next, set up a conda virtual environment with a designated Python version, for example 3.12::

conda create --name abienv python=3.12
conda activate abienv

We then install AbiPy in this virtual environment, followed by creating requirements.txt, and creating a folder packages/ containing all the wheels (.whl format)::

pip install abipy
pip list --format=freeze > requirements.txt
pip download -r requirements.txt -d packages/

Next, the .txt file, the folder, and the miniconda installer must be forwarded to the cluster without internet access.
You may have to use a computer that has access to both locations with the scp command.
If the offline cluster does not have Conda preinstalled, the Miniconda executable must be ported so that an offline Conda installation can be performed.
Thus, from a computer that can access both locations, execute::

scp -r connected_cluster:/file/and/folder/location/* .
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
scp -r requirements.txt packages/ Miniconda3-latest-Linux-x86_64.sh disconnected_cluster:/desired/location/

If conda is not available on the cluster that cannot access the internet, follow the :ref:`Conda installation instructions <anaconda_howto>` once more.
Next, one can set up an **offline** virtual environment on the cluster without internet access::

conda create --name abienv --offline python=3.12
conda activate abienv

At this step, AbiPy might fail to install due to missing/incompatible packages.
Some of these issues may be solved by repeating the above steps (excluding the environment creation) for packages that are listed as missing/incompatible during the installation procedure, by updating the requirements.txt and packages/ and trying to install again.
Upon reading::

Successfully installed abipy-x.y.z

You can quickly test your installation by running ``python`` followed by ``import abipy``.


.. _howto_compile_python_and_bootstrap_pip:

-------------------------------------
Expand Down

0 comments on commit 5e189a7

Please sign in to comment.