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

Add alternative setup instructions through Anaconda #139

Closed
Closed
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
2 changes: 1 addition & 1 deletion ci/checks/style.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ logger "Run Copyright header check..."
./ci/checks/check_copyright.py

logger "Run Python formatting check..."
python -m pip install -r ./python-style-requirements.txt
python -m pip install -r ./requirements-python-style.txt
source ./style_check

logger "Run documentation generation..."
Expand Down
68 changes: 59 additions & 9 deletions docs/source/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,65 @@ Requirements
Getting Started
---------------

* Install latest development code from source
#. Run the following command to install the required libraries:

.. code-block:: bash
.. code-block:: bash

git clone --recursive https://github.com/clara-parabricks/VariantWorks.git
cd VariantWorks
pip install -r python-style-requirements.txt
pip install -r requirements.txt
pip install -e .
# Install pre-push hooks to run tests
ln -nfs $(readlink -f hooks/pre-push) .git/hooks/pre-push
apt install zlib1g-dev libcurl4-gnutls-dev libssl-dev libbz2-dev liblzma-dev

#. `htslib` is required and can be installed from source by following the instructions in: https://github.com/samtools/htslib#building-htslib


#. Install latest development code from source:

.. code-block:: bash

git clone https://github.com/clara-parabricks/VariantWorks.git
cd VariantWorks
pip install -r requirements-python-style.txt
pip install -r requirements.txt
pip install -e .
# Install pre-push hooks to run tests
ln -nfs $(readlink -f hooks/pre-push) .git/hooks/pre-push

Alternative Anaconda Installation
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

#. Clone VariantWorks repository and change directory:

.. code-block:: bash

git clone https://github.com/clara-parabricks/VariantWorks.git
cd VariantWorks


#. Create & activate a new environment with the required OS libraries:

.. code-block:: bash

conda env create --name <ENVIRONMENT_NAME> -f ./environment.yml
conda activate <ENVIRONMENT_NAME>

#. Some Python packages depends on the headers and shared libraries which were installed in the previous step,
therefore before executing `pip`, run the following command:

.. code-block:: bash
Copy link
Member Author

@ohadmo ohadmo Oct 28, 2020

Choose a reason for hiding this comment

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

Instead of defining these env variables, I tried to pass to the pip install -r requirements.txt command the following arguments:

--global-option=build_ext --global-option="-I<ENVIRONMENT_PATH>/include/" --global-option="-L<ENVIRONMENT_PATH>/lib"

or even add these arguments to the relevant entries in the requirements.txt files:

biopython==1.78
cyvcf2==0.20.1 --global-option=build_ext --global-option="-I/opt/conda/envs/<ENVIRONMENT_PATH>/include/" --global-option="-L/opt/conda/envs/<ENVIRONMENT_PATH>/lib"
h5py==2.10.0

Both of these options result in disabling the use of wheel files and build from the source all the packages in requirements.txt, as described in pypa/pip#4118 (same for the --install-option argument)

And this causes a failure to install the nemo-toolkit & pysam. ( We can overcome this issue, by using an additional requirements file- one for PyPI packages that are built from source successfully need the --global-option=build_ext command argument to build against the shared libraries and another one for packages that fails and require a precompiled .whl installation. (But in my opinion, this would confuse the user more)

Copy link
Member Author

Choose a reason for hiding this comment

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

Alternatively, we can take all the requirements from requirements.txt and find the corresponding packages in the Anaconda cloud, move them to the environment.yml file and leave inside the requirements.txt only the packages that do not have an Anaconda package. this way, a user that uses Anaconda will only only to use the conda env create command


export LDFLAGS=-L<ENVIRONMENT_PATH>/lib
export CPPFLAGS=-I<ENVIRONMENT_PATH>/include

The environment path can be queried by running:

.. code-block:: bash

conda info --envs

#. Install Python requirements and VariantWorks package from source
Copy link
Member Author

@ohadmo ohadmo Oct 28, 2020

Choose a reason for hiding this comment

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

Could not combine the pip installation step with theenvironment.yml file like so

-pip
   - -r file:requirements.txt

because we don't know the user-defined environment location prior to running the conda env create command to set LDFLAGS & CPPFLAGS.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes I think it's okay to keep them separated for now.

Copy link
Member Author

Choose a reason for hiding this comment

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

Using explicit package names in the environment.yml file:

  - bioconda::htslib
  - pip:
          - cyvcf2

also results in the following error when creating the environment:

also results in:
 -Wno-discarded-qualifiers
    htslib/bgzf.c:38:10: fatal error: zlib.h: No such file or directory
       38 | #include <zlib.h>
          |          ^~~~~~~~
    compilation terminated.
    error: command 'gcc' failed with exit status 1


.. code-block:: bash

pip install -r requirements-python-style.txt
pip install -r requirements.txt
pip install -e .
# Install pre-push hooks to run tests
ln -nfs $(readlink -f hooks/pre-push) .git/hooks/pre-push
27 changes: 27 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#
# Copyright 2020 NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

channels:
- conda-forge
dependencies:
- python=3.7
- pip
- zlib
- libcurl
- openssl
- bzip2
- xz
- bioconda::htslib
File renamed without changes.