widdowquinn / pyani

Application and Python module for average nucleotide identity analyses of microbes.
http://widdowquinn.github.io/pyani/
MIT License
185 stars 54 forks source link

`fastani` is not installed under Python 3.9 #377

Closed widdowquinn closed 2 years ago

widdowquinn commented 2 years ago

Summary:

The third-party dependency fastani cannot be installed with conda or mamba under Python 3.9.

Description:

fastani is an item in requirements-thirdparty.txt but is not installable under Python 3.9:

$ python --version
Python 3.9.9
$ conda install fastani
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
[...]                                                                                                                                                                                       UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:

Specifications:

  - fastani -> python[version='2.7.*|3.5.*|3.6.*|>=2.7,<2.8.0a0|>=3.8,<3.9.0a0|>=3.6,<3.7.0a0|>=3.7,<3.8.0a0|>=3.5,<3.6.0a0']

Your python: python=3.9

If python is on the left-most side of the chain, that's the version you've asked for.
When python appears to the right, that indicates that the thing on the left is somehow
not available for the python version you are constrained to. Note that conda will not
change your python version to a different minor version unless you explicitly specify
that.

Consequently, the pytest -v test fails:

$ pytest -v
========================================== test session starts ==========================================
platform darwin -- Python 3.9.9, pytest-6.2.5, py-1.11.0, pluggy-1.0.0 -- /Users/lpritc/opt/anaconda3/envs/pyani_py39/bin/python
cachedir: .pytest_cache
rootdir: /Users/lpritc/Development/GitHub/pyani, configfile: pytest.ini
plugins: ordering-0.6, cov-3.0.0
collected 118 items
[...]
tests/test_subcmd_09_fastani.py::TestfastANISubcommand::test_fastani FAILED                       [ 97%]
[...]
=============================================== FAILURES ================================================
__________________________________ TestfastANISubcommand.test_fastani ___________________________________

self = <test_subcmd_09_fastani.TestfastANISubcommand testMethod=test_fastani>

    def test_fastani(self):
        """Test fastani run."""
        print(self.argsdict["fastani"])
>       subcommands.subcmd_fastani(self.argsdict["fastani"])

tests/test_subcmd_09_fastani.py:88: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pyani/scripts/subcommands/subcmd_fastani.py:289: in subcmd_fastani
    run_fastani_jobs(job, args)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
[...]

Reproducible Steps:

  1. Attempt to install pyani under Python 3.9 in any standard way (e.g. git clone then pip install -e ., etc.) - fastani will not be installed.
  2. Attempt to run pytest -v (if cloned) or a pyani fastani command

Current Output:

Failed tests under pytest, errors with pyani fastani.

Expected Output:

  1. The fastani tests should be skipped in pytest if fastani is unavailable.
  2. pyani fastani should report that fastani is not installed, and fail gracefully.

pyani Version:

v0.3.0 (commit b8722f0)

Python Version:

3.9

Operating System:

macOS

widdowquinn commented 2 years ago

With respect to this, we should be flagging the unavailability of fastani via conda under Python 3.9 in the documentation, and pointing users to the fastani installation instructions, e.g. https://github.com/ParBLiSS/FastANI

widdowquinn commented 2 years ago

The current situation as I see it is that:

When installing manually on macOS/Python3.9 according to instructions at https://github.com/ParBLiSS/FastANI an incorrect compile string is produce by the configure script.

$ make
c++ -O3 -DNDEBUG -std=c++11 -Isrc -I ${CONDA_PREFIX}/lib/include  -mmacosx-version-min=10.7 -stdlib=libc++ -Xpreprocessor -fopenmp -lomp -DUSE_BOOST src/cgi/core_genome_identity.cpp -o fastANI ${CONDA_PREFIX}/lib/lib/libboost_math_c99.a -lstdc++ -lz -lm 

Specifically, an extra lib/ is inserted into the $PATH to the boost library, and it expects a .a suffix rather than the .dylib. The correct compile string is:

$ make
c++ -O3 -DNDEBUG -std=c++11 -Isrc -I ${CONDA_PREFIX}/lib/include  -mmacosx-version-min=10.7 -stdlib=libc++ -Xpreprocessor -fopenmp -lomp -DUSE_BOOST src/cgi/core_genome_identity.cpp -o fastANI ${CONDA_PREFIX}/lib/libboost_math_c99.dylib -lstdc++ -lz -lm 

and this compiles a working fastANI binary, in my hands.

NOTE: if fastani is in a requirements.txt file then all installations in that file fail, when fastani fails.

I think we have three options:

  1. put fastani in the requirements-thirdparty.txt file and, when it fails for people, have documentation informing them that they need to remove fastani from that file and install it themselves
  2. remove fastani from the requirements-thirdparty.txt file and have documentation informing users that they need to install it themselves
  3. have a requirements-fastani.txt file containing only fastani so that the other requirements can install OK, but have documentation informing users that they need to install it themselves if the installation of fastani fails.
baileythegreen commented 2 years ago

See branch issue_377.