vvoelz / biceps

Bayesian inference of conformational populations
https://github.com/vvoelz/biceps
Other
12 stars 3 forks source link

RTD sphinx-autodoc - failed to import module named 'mdtraj' - can't read our python code #54

Closed robraddi closed 5 years ago

robraddi commented 5 years ago

RTD sphinx-autodoc - failed to import module named 'mdtraj' - can't read our python code.

We are able to see the api documentation in a local host. — cool but doesn't make a webpage

RTD wants to run the code, but fails to do so due to the inability to install the module 'mdtraj'.


Running Sphinx v1.7.9 loading translations [en]... done making output directory... loading pickled environment... not yet created [autosummary] generating autosummary for: api/BICePs.rst, examples/albo/albocycline.rst, examples/albo/alternative.ipynb, examples/index.rst, index.rst, installation.rst, reference/index.rst, theory.rst, workflow.rst WARNING: Unhandled exception in autoapi module: Traceback (most recent call last): File "/home/docs/checkouts/readthedocs.org/user_builds/biceps/envs/latest/local/lib/python2.7/site-packages/autoapi/sphinx.py", line 48, in wrapper func(app) File "/home/docs/checkouts/readthedocs.org/user_builds/biceps/envs/latest/local/lib/python2.7/site-packages/autoapi/sphinx.py", line 141, in builder_inited tree = APINode(module) File "/home/docs/checkouts/readthedocs.org/user_builds/biceps/envs/latest/local/lib/python2.7/site-packages/autoapi/apinode.py", line 128, in init self.module = import_module(name) File "/usr/lib/python2.7/importlib/init.py", line 37, in import_module import(name) File "/home/docs/checkouts/readthedocs.org/user_builds/biceps/checkouts/latest/doc/BICePs/init.py", line 4, in from Preparation import * File "/home/docs/checkouts/readthedocs.org/user_builds/biceps/checkouts/latest/doc/BICePs/Preparation.py", line 11, in import mdtraj as md ImportError: No module named mdtraj

Failed to import 'BICePs.Analysis': no module named BICePs.Analysis Failed to import 'BICePs.Analysis_new': no module named BICePs.Analysis_new Failed to import 'BICePs.J_coupling': no module named BICePs.J_coupling Failed to import 'BICePs.KarplusRelation': no module named BICePs.KarplusRelation Failed to import 'BICePs.Observable': no module named BICePs.Observable Failed to import 'BICePs.PosteriorSampler': no module named BICePs.PosteriorSampler Failed to import 'BICePs.Preparation': no module named BICePs.Preparation Failed to import 'BICePs.Restraint': no module named BICePs.Restraint Failed to import 'BICePs.init_res': no module named BICePs.init_res Failed to import 'BICePs.prep_J': no module named BICePs.prep_J Failed to import 'BICePs.prep_cs': no module named BICePs.prep_cs Failed to import 'BICePs.prep_noe': no module named BICePs.prep_noe Failed to import 'BICePs.prep_pf': no module named BICePs.prep_pf Failed to import 'BICePs.runme': no module named BICePs.runme Failed to import 'BICePs.toolbox': no module named BICePs.toolbox Failed to import 'BICePs': no module named BICePs building [mo]: targets for 0 po files that are out of date building [readthedocs]: targets for 9 source files that are out of date updating environment: 9 added, 0 changed, 0 removed reading sources... [ 11%] api/BICePs reading sources... [ 22%] examples/albo/albocycline reading sources... [ 33%] examples/albo/alternative reading sources... [ 44%] examples/index reading sources... [ 55%] index reading sources... [ 66%] installation reading sources... [ 77%] reference/index reading sources... [ 88%] theory reading sources... [100%] workflow

WARNING: autodoc: failed to import module u'BICePs.Analysis'; the following exception was raised: No module named mdtraj WARNING: autodoc: failed to import module u'BICePs.Analysis_new'; the following exception was raised: No module named mdtraj WARNING: autodoc: failed to import module u'BICePs.J_coupling'; the following exception was raised: No module named mdtraj WARNING: autodoc: failed to import module u'BICePs.KarplusRelation'; the following exception was raised: No module named mdtraj WARNING: autodoc: failed to import module u'BICePs.Observable'; the following exception was raised: No module named mdtraj WARNING: autodoc: failed to import module u'BICePs.PosteriorSampler'; the following exception was raised: No module named mdtraj WARNING: autodoc: failed to import module u'BICePs.Preparation'; the following exception was raised: No module named mdtraj WARNING: autodoc: failed to import module u'BICePs.Restraint'; the following exception was raised: No module named mdtraj WARNING: autodoc: failed to import module u'BICePs.init_res'; the following exception was raised: No module named mdtraj WARNING: autodoc: failed to import module u'BICePs.prep_J'; the following exception was raised: No module named mdtraj WARNING: autodoc: failed to import module u'BICePs.prep_cs'; the following exception was raised: No module named mdtraj WARNING: autodoc: failed to import module u'BICePs.prep_noe'; the following exception was raised: No module named mdtraj WARNING: autodoc: failed to import module u'BICePs.prep_pf'; the following exception was raised: No module named mdtraj WARNING: autodoc: failed to import module u'BICePs.runme'; the following exception was raised: No module named mdtraj WARNING: autodoc: failed to import module u'BICePs.toolbox'; the following exception was raised: No module named mdtraj WARNING: autodoc: failed to import module u'BICePs'; the following exception was raised: No module named mdtraj /home/docs/checkouts/readthedocs.org/user_builds/biceps/checkouts/latest/doc/source/examples/albo/albocycline.rst:6: WARNING: Unknown directive type "notebook".

vvoelz commented 5 years ago

Rob: Maybe you could show me how RTD compilation works in person sometime Could it be that it's using a version of python that does not have the mdtraj module in its $PYTHONPATH ?

robraddi commented 5 years ago

On my local machine it works perfectly, and I can see the site: image This is because I have mdtraj installed on my local machine.

Now, when RTD attempts to run autoapi/sphinx.py

Here's what we get after RTD


Now I'm attempting to go along the path of setup.py...

I've went into the requirements and did some tests:

pymbar & mdtraj still refuse to be installed. I've been looking at the same error message for sometime now.

Requirement already satisfied: pymbar in /home/docs/checkouts/readthedocs.org/user_builds/biceps/envs/latest/lib/python2.7/site-packages/pymbar-3.0.3-py2.7-linux-x86_64.egg (from -r doc/requirements.txt (line 1))
Collecting cython (from -r doc/requirements.txt (line 2))
  Using cached https://files.pythonhosted.org/packages/ce/6a/526ecd26f19f1c3a650924918a1364e30baaec525b7da5350d861c610495/Cython-0.29.4-cp27-cp27mu-manylinux1_x86_64.whl
Collecting mdtraj (from -r doc/requirements.txt (line 3))
  Using cached https://files.pythonhosted.org/packages/e0/9e/857f613eae8af3fb8cc73904b3edf622c58de3884c5989e4466973c3c9ee/mdtraj-1.9.2.tar.gz
    Complete output from command python setup.py egg_info:
    --------------------------------------------------------------------------------
    Error: building mdtraj requires numpy and cython>=0.19

    Try running the command ``pip install numpy cython`` or
    ``conda install numpy cython``.

    or see http://docs.scipy.org/doc/numpy/user/install.html and
    http://cython.org/ for more information.

    If you're feeling lost, we recommend downloading the (free) Anaconda python
    distribution https://www.continuum.io/downloads, because it comes with
    these components included.
    --------------------------------------------------------------------------------

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-7wHFoA/mdtraj/

Which doesn't seem to make sense. If numpy, Cython and pymbar worked (in this build), why not mdtraj? Absolutely lost...

robraddi commented 5 years ago

Here's the new error:

/home/docs/checkouts/readthedocs.org/user_builds/biceps/envs/latest/bin/python -m pip install --exists-action=w --cache-dir /home/docs/checkouts/readthedocs.org/user_builds/biceps/.cache/pip -r doc/requirements.txt
Requirement already satisfied: cython==0.19 in /home/docs/checkouts/readthedocs.org/user_builds/biceps/envs/latest/lib/python2.7/site-packages (from -r doc/requirements.txt (line 1)) (0.19)
Requirement already satisfied: numpy in /home/docs/.pyenv/versions/2.7.14/lib/python2.7/site-packages (from -r doc/requirements.txt (line 2)) (1.16.0)
Requirement already satisfied: ipykernel in /home/docs/checkouts/readthedocs.org/user_builds/biceps/envs/latest/lib/python2.7/site-packages (from -r doc/requirements.txt (line 3)) (4.10.0)
Requirement already satisfied: nbsphinx in /home/docs/checkouts/readthedocs.org/user_builds/biceps/envs/latest/lib/python2.7/site-packages (from -r doc/requirements.txt (line 4)) (0.4.2)
Requirement already satisfied: matplotlib in /home/docs/.pyenv/versions/2.7.14/lib/python2.7/site-packages (from -r doc/requirements.txt (line 5)) (2.2.3)
Requirement already satisfied: jupyter in /home/docs/checkouts/readthedocs.org/user_builds/biceps/envs/latest/lib/python2.7/site-packages (from -r doc/requirements.txt (line 6)) (1.0.0)
Requirement already satisfied: notebook in /home/docs/checkouts/readthedocs.org/user_builds/biceps/envs/latest/lib/python2.7/site-packages (from -r doc/requirements.txt (line 7)) (5.7.4)
Requirement already satisfied: jinja2 in /home/docs/checkouts/readthedocs.org/user_builds/biceps/envs/latest/lib/python2.7/site-packages (from -r doc/requirements.txt (line 8)) (2.10)
Requirement already satisfied: nbconvert in /home/docs/checkouts/readthedocs.org/user_builds/biceps/envs/latest/lib/python2.7/site-packages (from -r doc/requirements.txt (line 9)) (5.4.1)
Requirement already satisfied: pyparsing in /home/docs/checkouts/readthedocs.org/user_builds/biceps/envs/latest/lib/python2.7/site-packages (from -r doc/requirements.txt (line 10)) (2.3.1)
Requirement already satisfied: sphinx-autoapi in /home/docs/checkouts/readthedocs.org/user_builds/biceps/envs/latest/lib/python2.7/site-packages (from -r doc/requirements.txt (line 11)) (0.7.1)
Requirement already satisfied: autoapi in /home/docs/checkouts/readthedocs.org/user_builds/biceps/envs/latest/lib/python2.7/site-packages (from -r doc/requirements.txt (line 12)) (1.3.1)
Requirement already satisfied: sphinx in /home/docs/checkouts/readthedocs.org/user_builds/biceps/envs/latest/lib/python2.7/site-packages (from -r doc/requirements.txt (line 13)) (1.7.9)
Requirement already satisfied: sphinx_rtd_theme in /home/docs/checkouts/readthedocs.org/user_builds/biceps/envs/latest/lib/python2.7/site-packages (from -r doc/requirements.txt (line 14)) (0.4.2)
Requirement already satisfied: scikit-learn in /home/docs/checkouts/readthedocs.org/user_builds/biceps/envs/latest/lib/python2.7/site-packages (from -r doc/requirements.txt (line 15)) (0.20.2)
Requirement already satisfied: numpydoc in /home/docs/checkouts/readthedocs.org/user_builds/biceps/envs/latest/lib/python2.7/site-packages (from -r doc/requirements.txt (line 16)) (0.8.0)
Collecting mdtraj (from -r doc/requirements.txt (line 17))
  Downloading https://files.pythonhosted.org/packages/e0/9e/857f613eae8af3fb8cc73904b3edf622c58de3884c5989e4466973c3c9ee/mdtraj-1.9.2.tar.gz (2.0MB)
    Complete output from command python setup.py egg_info:
    Using built-in specs.
    COLLECT_GCC=gcc
    COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper
    OFFLOAD_TARGET_NAMES=nvptx-none
    OFFLOAD_TARGET_DEFAULT=1
    Target: x86_64-linux-gnu
    Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.3.0-27ubuntu1~18.04' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
    Thread model: posix
    gcc version 7.3.0 (Ubuntu 7.3.0-27ubuntu1~18.04)

    Error compiling Cython file:
    ------------------------------------------------------------
    ...
                    int64_t *n)

        # Units
        tng_function_status tng_distance_unit_exponential_get(
                    const tng_trajectory_t tng_data,
                    int64_t *exp);
                                ^
    ------------------------------------------------------------

    mdtraj/formats/tng/tng.pyx:56:29: Syntax error in C variable declaration
    C compiler:
    Attempting to autodetect OpenMP support... Compiler supports OpenMP
    Attempting to autodetect SSE3   support... Compiler supports SSE3
    Attempting to autodetect SSE4.1 support... Compiler supports SSE4.1

    missing cimport in module 'xdrlib': mdtraj/formats/xtc/xtc.pyx
    Compiling mdtraj/formats/xtc/xtc.pyx because it depends on /home/docs/checkouts/readthedocs.org/user_builds/biceps/envs/latest/lib/python2.7/site-packages/Cython/Includes/cpython/object.pxd.
    missing cimport in module 'trrlib': mdtraj/formats/xtc/trr.pyx
    missing cimport in module 'xdrlib': mdtraj/formats/xtc/trr.pyx
    Compiling mdtraj/formats/xtc/trr.pyx because it depends on /home/docs/checkouts/readthedocs.org/user_builds/biceps/envs/latest/lib/python2.7/site-packages/Cython/Includes/cpython/object.pxd.
    Compiling mdtraj/formats/tng/tng.pyx because it depends on /home/docs/checkouts/readthedocs.org/user_builds/biceps/envs/latest/lib/python2.7/site-packages/Cython/Includes/cpython/object.pxd.
    missing cimport in module 'dcdlib': mdtraj/formats/dcd/dcd.pyx
    Compiling mdtraj/formats/dcd/dcd.pyx because it depends on /home/docs/checkouts/readthedocs.org/user_builds/biceps/envs/latest/lib/python2.7/site-packages/Cython/Includes/cpython/object.pxd.
    missing cimport in module 'binposlib': mdtraj/formats/binpos/binpos.pyx
    Compiling mdtraj/formats/binpos/binpos.pyx because it depends on /home/docs/checkouts/readthedocs.org/user_builds/biceps/envs/latest/lib/python2.7/site-packages/Cython/Includes/cpython/object.pxd.
    missing cimport in module 'dtrlib': mdtraj/formats/dtr/dtr.pyx
    Compiling mdtraj/formats/dtr/dtr.pyx because it depends on /home/docs/checkouts/readthedocs.org/user_builds/biceps/envs/latest/lib/python2.7/site-packages/Cython/Includes/cpython/object.pxd.
    Compiling mdtraj/rmsd/_rmsd.pyx because it depends on /home/docs/checkouts/readthedocs.org/user_builds/biceps/envs/latest/lib/python2.7/site-packages/Cython/Includes/cpython/tuple.pxd.
    Compiling mdtraj/rmsd/_lprmsd.pyx because it depends on /home/docs/checkouts/readthedocs.org/user_builds/biceps/envs/latest/lib/python2.7/site-packages/Cython/Includes/cpython/tuple.pxd.
    Compiling mdtraj/geometry/src/_geometry.pyx because it depends on /home/docs/checkouts/readthedocs.org/user_builds/biceps/envs/latest/lib/python2.7/site-packages/Cython/Includes/cpython/object.pxd.
    Compiling mdtraj/geometry/neighbors.pyx because it depends on /home/docs/checkouts/readthedocs.org/user_builds/biceps/envs/latest/lib/python2.7/site-packages/Cython/Includes/libcpp/vector.pxd.
    Compiling mdtraj/geometry/neighborlist.pyx because it depends on /home/docs/checkouts/readthedocs.org/user_builds/biceps/envs/latest/lib/python2.7/site-packages/Cython/Includes/libcpp/vector.pxd.
    Cythonizing mdtraj/geometry/neighborlist.pyx
    Cythonizing mdtraj/geometry/neighbors.pyx
    Cythonizing mdtraj/formats/binpos/binpos.pyx
    Cythonizing mdtraj/formats/dcd/dcd.pyx
    Cythonizing mdtraj/formats/dtr/dtr.pyx
    Cythonizing mdtraj/formats/tng/tng.pyx
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-70zOE5/mdtraj/setup.py", line 285, in <module>
        ext_modules=cythonize(extensions),
      File "/home/docs/checkouts/readthedocs.org/user_builds/biceps/envs/latest/lib/python2.7/site-packages/Cython/Build/Dependencies.py", line 713, in cythonize
        cythonize_one(*args[1:])
      File "/home/docs/checkouts/readthedocs.org/user_builds/biceps/envs/latest/lib/python2.7/site-packages/Cython/Build/Dependencies.py", line 780, in cythonize_one
        raise CompileError(None, pyx_file)
    Cython.Compiler.Errors.CompileError: mdtraj/formats/tng/tng.pyx

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-70zOE5/mdtraj/
Command time: 5s Return: 1
robraddi commented 5 years ago

Fixed: Placed MDTraj in a separate requirements.txt file