janelia-flyem / gala

Automatic segmentation of electron microscopy volumes
BSD 3-Clause "New" or "Revised" License
76 stars 29 forks source link

errors while running py.test #77

Closed ajavvadi closed 7 years ago

ajavvadi commented 8 years ago

Hello,

I am trying to use GALA. When I run py.test, I got the following output. This might be some stupid installation problem of mine but I am not able to figure what's going wrong. I tried building NeruoProof and tried copying the libraries (for example, "libNeuroProofPriority ") to the gala-master folder and ran py.test but the output persisted.

Any help is very appreciated!

Following is the error: `==================================== ERRORS ==================================== _ ERROR collecting build/lib.linux-x8664-3.5/gala/auto.py ____ build/lib.linux-x86_64-3.5/gala/auto.py:2: in import libNeuroProofPriority as neuroproof E ImportError: No module named 'libNeuroProofPriority' _ ERROR collecting build/lib.linux-x86_64-3.5/gala/segmentation_stitch.py __ build/lib.linux-x86_64-3.5/gala/segmentation_stitch.py:20: in from . import imio, morpho, classify, evaluate, app_logger, session_manager, pixel, features, stack_np build/lib.linux-x86_64-3.5/gala/stacknp.py:2: in import libNeuroProofRag as neuroproof E ImportError: No module named 'libNeuroProofRag' ____ ERROR collecting build/lib.linux-x86_64-3.5/gala/stacknp.py build/lib.linux-x86_64-3.5/gala/stack_np.py:2: in import libNeuroProofRag as neuroproof E ImportError: No module named 'libNeuroProofRag' __ ERROR collecting build/lib.linux-x86_64-3.5/gala/stitch.py __ build/lib.linux-x86_64-3.5/gala/stitch.py:11: in from gala import single_arg_read_image_stack E ImportError: cannot import name 'single_arg_read_image_stack' _ ERROR collecting build/lib.linux-x86_64-3.5/gala/testpackage.py ../../../miniconda3/envs/gala/lib/python3.5/site-packages/py/_path/local.py:650: in pyimport import(modname) E File "/home/kalyan/Desktop/GalaDirIn/gala-master/build/lib.linux-x86_64-3.5/gala/test_package.py", line 147 E os.makedirs(writedir) E ^ E TabError: inconsistent use of tabs and spaces in indentation _ ERROR collecting build/lib.linux-x86_64-3.5/gala/testpackage.py ../../../miniconda3/envs/gala/lib/python3.5/site-packages/_pytest/python.py:610: in _importtestmodule mod = self.fspath.pyimport(ensuresyspath=importmode) ../../../miniconda3/envs/gala/lib/python3.5/site-packages/py/_path/local.py:650: in pyimport import(modname) E File "/home/kalyan/Desktop/GalaDirIn/gala-master/build/lib.linux-x86_64-3.5/gala/testpackage.py", line 147 E os.makedirs(writedir) E ^ E TabError: inconsistent use of tabs and spaces in indentation ____ ERROR collecting build/lib.linux-x86_64-3.5/gala/valprob.py __ build/lib.linux-x86_64-3.5/gala/valprob.py:2: in import libNeuroProofPriority as neuroproof E ImportError: No module named 'libNeuroProofPriority' ____ ERROR collecting gala/agglo.py ____ ../../../miniconda3/envs/gala/lib/python3.5/site-packages/py/_path/local.py:668: in pyimport raise self.ImportMismatchError(modname, modfile, self) E py._path.local.LocalPath.ImportMismatchError: ('gala.agglo', '/home/kalyan/Desktop/GalaDirIn/gala-master/build/lib.linux-x86_64-3.5/gala/agglo.py', local('/home/kalyan/Desktop/GalaDirIn/gala-master/gala/agglo.py')) _ ERROR collecting gala/agglo2.py __ ../../../miniconda3/envs/gala/lib/python3.5/site-packages/py/_path/local.py:668: in pyimport raise self.ImportMismatchError(modname, modfile, self) E py._path.local.LocalPath.ImportMismatchError: ('gala.agglo2', '/home/kalyan/Desktop/GalaDirIn/gala-master/build/lib.linux-x86_64-3.5/gala/agglo2.py', local('/home/kalyan/Desktop/GalaDirIn/gala-master/gala/agglo2.py')) ERROR collecting gala/annotefinder.py _ ../../../miniconda3/envs/gala/lib/python3.5/site-packages/py/_path/local.py:668: in pyimport raise self.ImportMismatchError(modname, modfile, self) E py._path.local.LocalPath.ImportMismatchError: ('gala.annotefinder', '/home/kalyan/Desktop/GalaDirIn/gala-master/build/lib.linux-x8664-3.5/gala/annotefinder.py', local('/home/kalyan/Desktop/GalaDirIn/gala-master/gala/annotefinder.py')) ____ ERROR collecting gala/app_logger.py __ ../../../miniconda3/envs/gala/lib/python3.5/site-packages/py/_path/local.py:668: in pyimport raise self.ImportMismatchError(modname, modfile, self) E py._path.local.LocalPath.ImportMismatchError: ('gala.app_logger', '/home/kalyan/Desktop/GalaDirIn/gala-master/build/lib.linux-x86_64-3.5/gala/app_logger.py', local('/home/kalyan/Desktop/GalaDirIn/gala-master/gala/applogger.py')) __ ERROR collecting gala/classify.py __ ../../../miniconda3/envs/gala/lib/python3.5/site-packages/py/_path/local.py:668: in pyimport raise self.ImportMismatchError(modname, modfile, self) E py._path.local.LocalPath.ImportMismatchError: ('gala.classify', '/home/kalyan/Desktop/GalaDirIn/gala-master/build/lib.linux-x86_64-3.5/gala/classify.py', local('/home/kalyan/Desktop/GalaDirIn/gala-master/gala/classify.py')) _ ERROR collecting gala/dtypes.py ____ ../../../miniconda3/envs/gala/lib/python3.5/site-packages/py/_path/local.py:668: in pyimport raise self.ImportMismatchError(modname, modfile, self) E py._path.local.LocalPath.ImportMismatchError: ('gala.dtypes', '/home/kalyan/Desktop/GalaDirIn/gala-master/build/lib.linux-x86_64-3.5/gala/dtypes.py', local('/home/kalyan/Desktop/GalaDirIn/gala-master/gala/dtypes.py')) ERROR collecting gala/evaluate.py _ ../../../miniconda3/envs/gala/lib/python3.5/site-packages/py/_path/local.py:668: in pyimport raise self.ImportMismatchError(modname, modfile, self) E py._path.local.LocalPath.ImportMismatchError: ('gala.evaluate', '/home/kalyan/Desktop/GalaDirIn/gala-master/build/lib.linux-x86_64-3.5/gala/evaluate.py', local('/home/kalyan/Desktop/GalaDirIn/gala-master/gala/evaluate.py')) ___ ERROR collecting gala/filters.py _ ../../../miniconda3/envs/gala/lib/python3.5/site-packages/py/_path/local.py:668: in pyimport raise self.ImportMismatchError(modname, modfile, self) E py._path.local.LocalPath.ImportMismatchError: ('gala.filters', '/home/kalyan/Desktop/GalaDirIn/gala-master/build/lib.linux-x8664-3.5/gala/filters.py', local('/home/kalyan/Desktop/GalaDirIn/gala-master/gala/filters.py')) ____ ERROR collecting gala/imio.py ____ ../../../miniconda3/envs/gala/lib/python3.5/site-packages/py/_path/local.py:668: in pyimport raise self.ImportMismatchError(modname, modfile, self) E py._path.local.LocalPath.ImportMismatchError: ('gala.imio', '/home/kalyan/Desktop/GalaDirIn/gala-master/build/lib.linux-x8664-3.5/gala/imio.py', local('/home/kalyan/Desktop/GalaDirIn/gala-master/gala/imio.py')) ____ ERROR collecting gala/iterprogress.py ____ ../../../miniconda3/envs/gala/lib/python3.5/site-packages/py/_path/local.py:668: in pyimport raise self.ImportMismatchError(modname, modfile, self) E py._path.local.LocalPath.ImportMismatchError: ('gala.iterprogress', '/home/kalyan/Desktop/GalaDirIn/gala-master/build/lib.linux-x8664-3.5/gala/iterprogress.py', local('/home/kalyan/Desktop/GalaDirIn/gala-master/gala/iterprogress.py')) ____ ERROR collecting gala/mergequeue.py __ ../../../miniconda3/envs/gala/lib/python3.5/site-packages/py/_path/local.py:668: in pyimport raise self.ImportMismatchError(modname, modfile, self) E py._path.local.LocalPath.ImportMismatchError: ('gala.mergequeue', '/home/kalyan/Desktop/GalaDirIn/gala-master/build/lib.linux-x86_64-3.5/gala/mergequeue.py', local('/home/kalyan/Desktop/GalaDirIn/gala-master/gala/mergequeue.py')) _ ERROR collecting gala/morpho.py ____ ../../../miniconda3/envs/gala/lib/python3.5/site-packages/py/_path/local.py:668: in pyimport raise self.ImportMismatchError(modname, modfile, self) E py._path.local.LocalPath.ImportMismatchError: ('gala.morpho', '/home/kalyan/Desktop/GalaDirIn/gala-master/build/lib.linux-x86_64-3.5/gala/morpho.py', local('/home/kalyan/Desktop/GalaDirIn/gala-master/gala/morpho.py')) __ ERROR collecting gala/ncut.py _ ../../../miniconda3/envs/gala/lib/python3.5/site-packages/py/_path/local.py:668: in pyimport raise self.ImportMismatchError(modname, modfile, self) E py._path.local.LocalPath.ImportMismatchError: ('gala.ncut', '/home/kalyan/Desktop/GalaDirIn/gala-master/build/lib.linux-x86_64-3.5/gala/ncut.py', local('/home/kalyan/Desktop/GalaDirIn/gala-master/gala/ncut.py')) ___ ERROR collecting gala/option_manager.py ../../../miniconda3/envs/gala/lib/python3.5/site-packages/py/_path/local.py:668: in pyimport raise self.ImportMismatchError(modname, modfile, self) E py._path.local.LocalPath.ImportMismatchError: ('gala.option_manager', '/home/kalyan/Desktop/GalaDirIn/gala-master/build/lib.linux-x86_64-3.5/gala/option_manager.py', local('/home/kalyan/Desktop/GalaDirIn/gala-master/gala/option_manager.py')) ____ ERROR collecting gala/pixel.py ____ ../../../miniconda3/envs/gala/lib/python3.5/site-packages/py/_path/local.py:668: in pyimport raise self.ImportMismatchError(modname, modfile, self) E py._path.local.LocalPath.ImportMismatchError: ('gala.pixel', '/home/kalyan/Desktop/GalaDirIn/gala-master/build/lib.linux-x86_64-3.5/gala/pixel.py', local('/home/kalyan/Desktop/GalaDirIn/gala-master/gala/pixel.py')) ____ ERROR collecting gala/segmentation_pipeline.py ____ ../../../miniconda3/envs/gala/lib/python3.5/site-packages/py/_path/local.py:668: in pyimport raise self.ImportMismatchError(modname, modfile, self) E py._path.local.LocalPath.ImportMismatchError: ('gala.segmentation_pipeline', '/home/kalyan/Desktop/GalaDirIn/gala-master/build/lib.linux-x86_64-3.5/gala/segmentation_pipeline.py', local('/home/kalyan/Desktop/GalaDirIn/gala-master/gala/segmentation_pipeline.py')) ____ ERROR collecting gala/serve.py ____ ../../../miniconda3/envs/gala/lib/python3.5/site-packages/py/_path/local.py:668: in pyimport raise self.ImportMismatchError(modname, modfile, self) E py._path.local.LocalPath.ImportMismatchError: ('gala.serve', '/home/kalyan/Desktop/GalaDirIn/gala-master/build/lib.linux-x86_64-3.5/gala/serve.py', local('/home/kalyan/Desktop/GalaDirIn/gala-master/gala/serve.py')) _ ERROR collecting gala/session_manager.py _____ ../../../miniconda3/envs/gala/lib/python3.5/site-packages/py/_path/local.py:668: in pyimport raise self.ImportMismatchError(modname, modfile, self) E py._path.local.LocalPath.ImportMismatchError: ('gala.session_manager', '/home/kalyan/Desktop/GalaDirIn/gala-master/build/lib.linux-x86_64-3.5/gala/session_manager.py', local('/home/kalyan/Desktop/GalaDirIn/gala-master/gala/session_manager.py')) __ ERROR collecting gala/sparselol.py __ ../../../miniconda3/envs/gala/lib/python3.5/site-packages/py/_path/local.py:668: in pyimport raise self.ImportMismatchError(modname, modfile, self) E py._path.local.LocalPath.ImportMismatchError: ('gala.sparselol', '/home/kalyan/Desktop/GalaDirIn/gala-master/build/lib.linux-x86_64-3.5/gala/sparselol.py', local('/home/kalyan/Desktop/GalaDirIn/gala-master/gala/sparselol.py')) ERROR collecting gala/util.py _ ../../../miniconda3/envs/gala/lib/python3.5/site-packages/py/_path/local.py:668: in pyimport raise self.ImportMismatchError(modname, modfile, self) E py._path.local.LocalPath.ImportMismatchError: ('gala.util', '/home/kalyan/Desktop/GalaDirIn/gala-master/build/lib.linux-x8664-3.5/gala/util.py', local('/home/kalyan/Desktop/GalaDirIn/gala-master/gala/util.py')) ____ ERROR collecting gala/viz.py _ ../../../miniconda3/envs/gala/lib/python3.5/site-packages/py/_path/local.py:668: in pyimport raise self.ImportMismatchError(modname, modfile, self) E py._path.local.LocalPath.ImportMismatchError: ('gala.viz', '/home/kalyan/Desktop/GalaDirIn/gala-master/build/lib.linux-x86_64-3.5/gala/viz.py', local('/home/kalyan/Desktop/GalaDirIn/gala-master/gala/viz.py')) ____ ERROR collecting gala/features/base.py ____ ../../../miniconda3/envs/gala/lib/python3.5/site-packages/py/_path/local.py:668: in pyimport raise self.ImportMismatchError(modname, modfile, self) E py._path.local.LocalPath.ImportMismatchError: ('gala.features.base', '/home/kalyan/Desktop/GalaDirIn/gala-master/build/lib.linux-x86_64-3.5/gala/features/base.py', local('/home/kalyan/Desktop/GalaDirIn/gala-master/gala/features/base.py')) ____ ERROR collecting gala/features/convexhull.py ____ ../../../miniconda3/envs/gala/lib/python3.5/site-packages/py/_path/local.py:668: in pyimport raise self.ImportMismatchError(modname, modfile, self) E py._path.local.LocalPath.ImportMismatchError: ('gala.features.convex_hull', '/home/kalyan/Desktop/GalaDirIn/gala-master/build/lib.linux-x86_64-3.5/gala/features/convex_hull.py', local('/home/kalyan/Desktop/GalaDirIn/gala-master/gala/features/convexhull.py')) __ ERROR collecting gala/features/default.py __ ../../../miniconda3/envs/gala/lib/python3.5/site-packages/py/_path/local.py:668: in pyimport raise self.ImportMismatchError(modname, modfile, self) E py._path.local.LocalPath.ImportMismatchError: ('gala.features.default', '/home/kalyan/Desktop/GalaDirIn/gala-master/build/lib.linux-x86_64-3.5/gala/features/default.py', local('/home/kalyan/Desktop/GalaDirIn/gala-master/gala/features/default.py')) _ ERROR collecting gala/features/graph.py ____ ../../../miniconda3/envs/gala/lib/python3.5/site-packages/py/_path/local.py:668: in pyimport raise self.ImportMismatchError(modname, modfile, self) E py._path.local.LocalPath.ImportMismatchError: ('gala.features.graph', '/home/kalyan/Desktop/GalaDirIn/gala-master/build/lib.linux-x8664-3.5/gala/features/graph.py', local('/home/kalyan/Desktop/GalaDirIn/gala-master/gala/features/graph.py')) ____ ERROR collecting gala/features/inclusion.py __ ../../../miniconda3/envs/gala/lib/python3.5/site-packages/py/_path/local.py:668: in pyimport raise self.ImportMismatchError(modname, modfile, self) E py._path.local.LocalPath.ImportMismatchError: ('gala.features.inclusion', '/home/kalyan/Desktop/GalaDirIn/gala-master/build/lib.linux-x8664-3.5/gala/features/inclusion.py', local('/home/kalyan/Desktop/GalaDirIn/gala-master/gala/features/inclusion.py')) ____ ERROR collecting gala/features/io.py ___ ../../../miniconda3/envs/gala/lib/python3.5/site-packages/py/_path/local.py:668: in pyimport raise self.ImportMismatchError(modname, modfile, self) E py._path.local.LocalPath.ImportMismatchError: ('gala.features.io', '/home/kalyan/Desktop/GalaDirIn/gala-master/build/lib.linux-x8664-3.5/gala/features/io.py', local('/home/kalyan/Desktop/GalaDirIn/gala-master/gala/features/io.py')) ____ ERROR collecting gala/features/orientation.py ____ ../../../miniconda3/envs/gala/lib/python3.5/site-packages/py/_path/local.py:668: in pyimport raise self.ImportMismatchError(modname, modfile, self) E py._path.local.LocalPath.ImportMismatchError: ('gala.features.orientation', '/home/kalyan/Desktop/GalaDirIn/gala-master/build/lib.linux-x86_64-3.5/gala/features/orientation.py', local('/home/kalyan/Desktop/GalaDirIn/gala-master/gala/features/orientation.py')) ____ ERROR collecting gala/features/squiggliness.py ____ ../../../miniconda3/envs/gala/lib/python3.5/site-packages/py/_path/local.py:668: in pyimport raise self.ImportMismatchError(modname, modfile, self) E py._path.local.LocalPath.ImportMismatchError: ('gala.features.squiggliness', '/home/kalyan/Desktop/GalaDirIn/gala-master/build/lib.linux-x86_64-3.5/gala/features/squiggliness.py', local('/home/kalyan/Desktop/GalaDirIn/gala-master/gala/features/squiggliness.py'))

jni commented 8 years ago

Hi @ajavvadi!

I don't have much experience with NeuroProof, unfortunately, but I can fix the rest of your errors. =)

Firstly, how did you build gala? In order for the tests to run, you have to build it in-place, either:

python setup.py build_ext -i

or

python setup.py develop

(The latter builds in-place and then places a symlink to the working directory in your Python site-packages directory.)

Once you've built that way, the ImportMismatchErrors should go away. That's a quirk of py.test that I haven't figured out yet how to make robust.

Next, you should make sure that you run py.test from the gala root directory, so that it picks up the setup.cfg file, which tells it to ignore a whole bunch of files, including those that depend on neuroproof.

These solutions are all a little bit makeshift and temporary, but hopefully they should get you up and running for now! Let me know if they help! (Or if they don't!)

(A good way to check, btw, is to look at the .travis.yml file, which contains build and test commands. =)

ajavvadi commented 8 years ago

Thanks for the prompt reply @jni !

I, actually,didn't do either of those two steps. I was following the instructions which said I could use "pip install gala" or "python setup.py install". I used the latter and then i installed the requirements using minconda as was pointed out. I will do this from scratch now and let you know how it turns out.

Again, thanks for the help!

ajavvadi commented 8 years ago

@jni Yup! I built the code with the second option and then ran py.test from the root directory. Some of the import errors are gone but the ones related to neuroproof errors remained. Check out the output below:

_______________________________________________________________________________________ ERROR collecting gala/auto.py _______________________________________________________________________________________ auto.py:2: in <module> import libNeuroProofPriority as neuroproof E ImportError: No module named 'libNeuroProofPriority' _______________________________________________________________________________ ERROR collecting gala/segmentation_stitch.py ________________________________________________________________________________ segmentation_stitch.py:20: in <module> from . import imio, morpho, classify, evaluate, app_logger, session_manager, pixel, features, stack_np stack_np.py:2: in <module> import libNeuroProofRag as neuroproof E ImportError: No module named 'libNeuroProofRag' _____________________________________________________________________________________ ERROR collecting gala/stack_np.py _____________________________________________________________________________________ stack_np.py:2: in <module> import libNeuroProofRag as neuroproof E ImportError: No module named 'libNeuroProofRag' ______________________________________________________________________________________ ERROR collecting gala/stitch.py ______________________________________________________________________________________ stitch.py:11: in <module> from gala import single_arg_read_image_stack E ImportError: cannot import name 'single_arg_read_image_stack' ___________________________________________________________________________________ ERROR collecting gala/test_package.py ___________________________________________________________________________________ ../../../../miniconda3/envs/gala/lib/python3.5/site-packages/py/_path/local.py:650: in pyimport __import__(modname) E File "/home/kalyan/Desktop/GalaDirIn/gala-master/gala/test_package.py", line 147 E os.makedirs(writedir) E ^ E TabError: inconsistent use of tabs and spaces in indentation ___________________________________________________________________________________ ERROR collecting gala/test_package.py ___________________________________________________________________________________ ../../../../miniconda3/envs/gala/lib/python3.5/site-packages/_pytest/python.py:610: in _importtestmodule mod = self.fspath.pyimport(ensuresyspath=importmode) ../../../../miniconda3/envs/gala/lib/python3.5/site-packages/py/_path/local.py:650: in pyimport __import__(modname) E File "/home/kalyan/Desktop/GalaDirIn/gala-master/gala/test_package.py", line 147 E os.makedirs(writedir) E ^ E TabError: inconsistent use of tabs and spaces in indentation _____________________________________________________________________________________ ERROR collecting gala/valprob.py ______________________________________________________________________________________ valprob.py:2: in <module> import libNeuroProofPriority as neuroproof E ImportError: No module named 'libNeuroProofPriority'

jni commented 8 years ago

@ajavvadi yeah those instructions assume you want to use gala, not test it. =P Ideally one would imply the other but that's not the case yet. =)

That's super weird though! What do you get when you type cat setup.cfg? It should be:

 ~/projects/gala (speedup)$ cat setup.cfg
[pytest]
; ignore files dependent on NeuroProof (--ignore gala/*.py)
; ignore scripts for generating test data (--ignore tests/**.py)
; run doctests (--doctest-modules)
; run coverage (--cov .)
; report uncovered lines (--cov-report term-missing)
addopts = --ignore doc --ignore gala/test_package.py --ignore tests/toy-data --ignore gala/auto.py --ignore gala/segmentation_stitch.py --ignore gala/stack_np.py --ignore gala/stitch.py --ignore gala/valprob.py --ignore tests/_util/generate-test-results.py --ignore tests/example-data/example.py --doctest-modules --cov . --cov-report term-missing

As indicated by the comments in that config file, those files should be ignored by pytest... What version of pytest are you on? (py.test --version)?

ajavvadi commented 8 years ago

@jni

I got the same output for cat setup.cfg. I am pasting it below...

(gala)kalyan@kalyan-XPS-L501X ~/Documents/Gala/gala-master $ cat setup.cfg [pytest] ; ignore files dependent on NeuroProof (--ignore gala/*.py) ; ignore scripts for generating test data (--ignore tests/**.py) ; run doctests (--doctest-modules) ; run coverage (--cov .) ; report uncovered lines (--cov-report term-missing) addopts = --ignore doc --ignore gala/test_package.py --ignore tests/toy-data --ignore gala/auto.py --ignore gala/segmentation_stitch.py --ignore gala/stack_np.py --ignore gala/stitch.py --ignore gala/valprob.py --ignore tests/_util/generate-test-results.py --ignore tests/example-data/example.py --doctest-modules --cov . --cov-report term-missing

The py.test version is 2.8.5.

jni commented 8 years ago

Gah! I really don't understand what's going on. Here's an idea: what happens if you run py.test with all those options manually inserted into the command-line? By the way, are you getting the coverage reports from your py.test runs?

jni commented 7 years ago

@ajavvadi I'm going to close this issue because I can't reproduce it, and it seems you've moved on. Please reopen if it is still bugging you! Thanks for using Gala!