Support Python 3.X
Closed this issue · 3 comments
In the context of #4, we realized that varlens failed to build on Travis/Python 3.4. Here are the logs from the build for the records: https://travis-ci.org/hammerlab/varlens/jobs/93808242
Ideally we should support both versions 2 and 3.
In addition to the usual python 3 sorts of issues, seems like matplotlib has started failing in a virtualenv on os X (?!):
http://matplotlib.org/devdocs/faq/virtualenv_faq.html
pypa/virtualenv#54
pypa/virtualenv#609
Looks like this is some sort of ancient issue that they decided to start hard-failing on now. Through some varcode dependencies we end up importing matplotlib, and that now throws an error.
======================================================================
ERROR: Failure: RuntimeError (Python is not installed as a framework. The Mac OS X backend will not be able to function correctly if Python is not installed as a framework. See the Python documentation for more information on installing Python as a framework on Mac OS X. Please either reinstall Python as a framework, or try one of the other backends. If you are Working with Matplotlib in a virtual enviroment see 'Working with Matplotlib in Virtual environments' in the Matplotlib FAQ)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/tim/sinai/git/datacache/venv-3.4/lib/python3.4/site-packages/nose/failure.py", line 39, in runTest
raise self.exc_val.with_traceback(self.tb)
File "/Users/tim/sinai/git/datacache/venv-3.4/lib/python3.4/site-packages/nose/loader.py", line 420, in loadTestsFromName
addr.filename, addr.module)
File "/Users/tim/sinai/git/datacache/venv-3.4/lib/python3.4/site-packages/nose/importer.py", line 47, in importFromPath
return self.importFromDir(dir_path, fqname)
File "/Users/tim/sinai/git/datacache/venv-3.4/lib/python3.4/site-packages/nose/importer.py", line 94, in importFromDir
mod = load_module(part_fqname, fh, filename, desc)
File "/Users/tim/sinai/git/datacache/venv-3.4/lib/python3.4/imp.py", line 235, in load_module
return load_source(name, filename, file)
File "/Users/tim/sinai/git/datacache/venv-3.4/lib/python3.4/imp.py", line 171, in load_source
module = methods.load()
File "<frozen importlib._bootstrap>", line 1220, in load
File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
File "<frozen importlib._bootstrap>", line 1129, in _exec
File "<frozen importlib._bootstrap>", line 1471, in exec_module
File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
File "/Users/tim/sinai/git/varlens/test/test_variants.py", line 23, in <module>
from varlens.commands import variants
File "/Users/tim/sinai/git/varlens/varlens/commands/variants.py", line 22, in <module>
from .. import variants_util
File "/Users/tim/sinai/git/varlens/varlens/variants_util.py", line 20, in <module>
import varcode
File "/Users/tim/sinai/git/varcode/varcode/__init__.py", line 15, in <module>
from .variant import Variant
File "/Users/tim/sinai/git/varcode/varcode/variant.py", line 23, in <module>
from pyensembl import (
File "/Users/tim/sinai/git/datacache/venv-3.4/lib/python3.4/site-packages/pyensembl/__init__.py", line 19, in <module>
from .ensembl_release import EnsemblRelease
File "/Users/tim/sinai/git/datacache/venv-3.4/lib/python3.4/site-packages/pyensembl/ensembl_release.py", line 20, in <module>
from .genome import Genome
File "/Users/tim/sinai/git/datacache/venv-3.4/lib/python3.4/site-packages/pyensembl/genome.py", line 32, in <module>
from .sequence_data import SequenceData
File "/Users/tim/sinai/git/datacache/venv-3.4/lib/python3.4/site-packages/pyensembl/sequence_data.py", line 21, in <module>
from skbio import read
File "/Users/tim/sinai/git/datacache/venv-3.4/lib/python3.4/site-packages/skbio/__init__.py", line 14, in <module>
import skbio.io # noqa
File "/Users/tim/sinai/git/datacache/venv-3.4/lib/python3.4/site-packages/skbio/io/__init__.py", line 225, in <module>
import_module('skbio.io.format.clustal')
File "/Users/tim/sinai/git/datacache/venv-3.4/lib/python3.4/importlib/__init__.py", line 109, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/Users/tim/sinai/git/datacache/venv-3.4/lib/python3.4/site-packages/skbio/io/format/clustal.py", line 114, in <module>
from skbio.alignment import Alignment
File "/Users/tim/sinai/git/datacache/venv-3.4/lib/python3.4/site-packages/skbio/alignment/__init__.py", line 212, in <module>
from ._alignment import Alignment, SequenceCollection
File "/Users/tim/sinai/git/datacache/venv-3.4/lib/python3.4/site-packages/skbio/alignment/_alignment.py", line 21, in <module>
from skbio.stats.distance import DistanceMatrix
File "/Users/tim/sinai/git/datacache/venv-3.4/lib/python3.4/site-packages/skbio/stats/distance/__init__.py", line 194, in <module>
from ._base import (DissimilarityMatrixError, DistanceMatrixError,
File "/Users/tim/sinai/git/datacache/venv-3.4/lib/python3.4/site-packages/skbio/stats/distance/_base.py", line 14, in <module>
import matplotlib.pyplot as plt
File "/Users/tim/sinai/git/datacache/venv-3.4/lib/python3.4/site-packages/matplotlib/pyplot.py", line 114, in <module>
_backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
File "/Users/tim/sinai/git/datacache/venv-3.4/lib/python3.4/site-packages/matplotlib/backends/__init__.py", line 32, in pylab_setup
globals(),locals(),[backend_name],0)
File "/Users/tim/sinai/git/datacache/venv-3.4/lib/python3.4/site-packages/matplotlib/backends/backend_macosx.py", line 24, in <module>
from matplotlib.backends import _macosx
RuntimeError: Python is not installed as a framework. The Mac OS X backend will not be able to function correctly if Python is not installed as a framework. See the Python documentation for more information on installing Python as a framework on Mac OS X. Please either reinstall Python as a framework, or try one of the other backends. If you are Working with Matplotlib in a virtual enviroment see 'Working with Matplotlib in Virtual environments' in the Matplotlib FAQ
I see this failure too, Mac OS X 10.10.5 with brew installed python3 (python 3.5.0 from Sept 23rd 2015) running in a virtualenv. matplotlib 1.5.
Unit tests on py3 seem to be working now, although you will have to run nosetests with -s
until this issue is fixed: pysam-developers/pysam#219