dlce-eva / python-nexus

python-nexus - Generic nexus (.nex, .trees) reader/writer for python
BSD 2-Clause "Simplified" License
11 stars 3 forks source link

ImportError: cannot import name bin #10

Closed wenheping closed 6 years ago

wenheping commented 6 years ago

when I install python-nexus with python2.7, I met the problem:

Traceback (most recent call last): File "", line 1, in File "setup.py", line 3, in from nexus import version as version File "nexus/init.py", line 135, in from nexus import bin ImportError: cannot import name bin *** Error code 1

while python3 built and run.

xrotwang commented 6 years ago

Just ran into the same problem. It seems, the bin directory is missing the __init__py:

~/venvs/py2$ la lib/python2.7/site-packages/nexus/bin/
nexus_anonymise.py
nexus_anonymise.pyc
nexus_binary2multistate.py
nexus_binary2multistate.pyc
nexus_combine_nexus.py
nexus_combine_nexus.pyc
nexus_deinterleave.py
nexus_deinterleave.pyc
nexus_describecharacter.py
nexus_describecharacter.pyc
nexus_describetaxa.py
nexus_describetaxa.pyc
nexus_multistate2binary.py
nexus_multistate2binary.pyc
nexus_nexusmanip.py
nexus_nexusmanip.pyc
nexus_randomise.py
nexus_randomise.pyc
nexus_tally.py
nexus_tally.pyc
nexus_to_fasta.py
nexus_to_fasta.pyc
nexus_treemanip.py
nexus_treemanip.pyc
xrotwang commented 6 years ago

I guess the problem is this line: https://github.com/SimonGreenhill/python-nexus/blob/9d630744e34ca09b2fd778e891eb1509aa88322e/setup.py#L29 where nexus.bin isn't listed among the packages.

xrotwang commented 6 years ago

I also think - to guard against this kind of packaging bug - running the tests (at least locally) via tox helps:

py27 create: /home/forkel/venvs/py2/python-nexus/.tox/py27
py27 inst: /home/forkel/venvs/py2/python-nexus/.tox/dist/python-nexus-1.62.zip
ERROR: invocation failed (exit code 1), logfile: /home/forkel/venvs/py2/python-nexus/.tox/py27/log/py27-1.log
ERROR: actionid: py27
msg: installpkg
cmdargs: ['/home/forkel/venvs/py2/python-nexus/.tox/py27/bin/python', '-m', 'pip', 'install', '/home/forkel/venvs/py2/python-nexus/.tox/dist/python-nexus-1.62.zip[test]']

Processing ./.tox/dist/python-nexus-1.62.zip
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-req-build-mwNgDF/setup.py", line 3, in <module>
        from nexus import __version__ as version
      File "nexus/__init__.py", line 135, in <module>
        from nexus import bin
    ImportError: cannot import name bin

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-req-build-mwNgDF/

py27 installed: python-nexus==1.62
______________________________________ summary ______________________________________
SKIPPED:  py34: InterpreterNotFound: python3.4
  py35: commands succeeded
SKIPPED:  py36: InterpreterNotFound: python3.6
ERROR:   py27: InvocationError for command /home/forkel/venvs/py2/python-nexus/.tox/py27/bin/python -m pip install /home/forkel/venvs/py2/python-nexus/.tox/dist/python-nexus-1.62.zip[test] (see /home/forkel/venvs/py2/python-nexus/.tox/py27/log/py27-1.log) (exited with code 1)
SimonGreenhill commented 6 years ago

Thanks for looking into this. Should I hook tox into .travis.yml config?

xrotwang commented 6 years ago

hm. I think running tox locally is the better strategy. tox on travis was flaky, if I remember correctly.