Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code error for new Validation usecase #269

Closed
alex4200 opened this issue Apr 5, 2018 · 20 comments
Closed

Code error for new Validation usecase #269

alex4200 opened this issue Apr 5, 2018 · 20 comments
Assignees
Labels
Topic_Validation Issues related to validation use cases Type_BUG Label to identify a bug in a use case

Comments

@alex4200
Copy link
Contributor

alex4200 commented Apr 5, 2018

Code error in second cell (DEV environment):

ImportErrorTraceback (most recent call last)
<ipython-input-4-5c1921a4538e> in <module>()
      1 # your HBP username; not essential if running inside the Collaboratory
      2 HBP_USERNAME = ""
----> 3 testLibrary = TestLibrary(username=HBP_USERNAME, environment="dev")
      4 modelCatalog = ModelCatalog.from_existing(testLibrary)
      5 

/opt/conda/envs/python2/lib/python2.7/site-packages/hbp_validation_framework/__init__.pyc in __init__(self, username, password, environment)
    423 
    424     def __init__(self, username=None, password=None, environment="production"):
--> 425         super(TestLibrary, self).__init__(username, password, environment)
    426         self._set_app_info()
    427 

/opt/conda/envs/python2/lib/python2.7/site-packages/hbp_validation_framework/__init__.pyc in __init__(self, username, password, environment)
     86                     # if are we running in a Jupyter notebook within the Collaboratory
     87                     # the token is already available
---> 88                     self.token = oauth_token_handler.get_token()
     89             elif os.path.exists(TOKENFILE):
     90                 # check for a stored token

/opt/conda/envs/python2/lib/python2.7/site-packages/jupyter_collab_storage/oauth_token_handler.pyc in get_token()
     68                       body=urlencode(params))
     69 
---> 70     http_client = HTTPClient()
     71     try:
     72         resp = http_client.fetch(req)

/opt/conda/envs/python2/lib/python2.7/site-packages/tornado/httpclient.pyc in __init__(self, async_client_class, **kwargs)
     76         if async_client_class is None:
     77             async_client_class = AsyncHTTPClient
---> 78         # Create the client while our IOLoop is "current", without
     79         # clobbering the thread's real current IOLoop (if any).
     80         self._async_client = self._io_loop.run_sync(

/opt/conda/envs/python2/lib/python2.7/site-packages/tornado/httpclient.pyc in __new__(cls, io_loop, force_instance, **kwargs)
    166             instance_cache = None
    167         else:
--> 168             instance_cache = cls._async_clients()
    169         if instance_cache is not None and io_loop in instance_cache:
    170             return instance_cache[io_loop]

/opt/conda/envs/python2/lib/python2.7/site-packages/tornado/util.pyc in __new__(cls, *args, **kwargs)
    281 
    282     Configurable subclasses must define the class methods
--> 283     `configurable_base` and `configurable_default`, and use the instance
    284     method `initialize` instead of ``__init__``.
    285 

/opt/conda/envs/python2/lib/python2.7/site-packages/tornado/util.pyc in configured_class(cls)
    345         # type: (Any, **Any) -> None
    346         """Sets the class to use when the base class is instantiated.
--> 347 
    348         Keyword arguments will be saved and added to the arguments passed
    349         to the constructor.  This can be used to set global defaults for

/opt/conda/envs/python2/lib/python2.7/site-packages/tornado/httpclient.pyc in configurable_default(cls)
    147     @classmethod
    148     def configurable_base(cls):
--> 149         return AsyncHTTPClient
    150 
    151     @classmethod

/opt/conda/envs/python2/lib/python2.7/site-packages/tornado/simple_httpclient.py in <module>()
     11 from tornado.log import gen_log
     12 from tornado import stack_context
---> 13 from tornado.tcpclient import TCPClient
     14 from tornado.util import PY3
     15 

/opt/conda/envs/python2/lib/python2.7/site-packages/tornado/tcpclient.py in <module>()
     23 import datetime
     24 
---> 25 from tornado.concurrent import Future, future_add_done_callback
     26 from tornado.ioloop import IOLoop
     27 from tornado.iostream import IOStream

ImportError: cannot import name future_add_done_callback
@alex4200 alex4200 added Type_BUG Label to identify a bug in a use case Topic_Validation Issues related to validation use cases labels Apr 5, 2018
@alex4200 alex4200 added this to the Issues for 2018-04 milestone Apr 5, 2018
@appukuttan-shailesh
Copy link
Collaborator

@alex4200 : I am not sure of the origin of this error, and have the feeling this is a Collab environment issue. I have once in the past got this error when testing through a different account. But in all others it works. Could you try using a different account? And maybe ask someone from the Collab team on the cause, and how to avoid it?

p.s. Note: This is a two-phase validation test.... only the first phase is currently implemented in the Jupyter notebook (The second part titled "2. ===== Soft Constraints Validation =====" will be added soon after testing). I wanted to have the UseCase structure in place for testing.

@alex4200
Copy link
Contributor Author

alex4200 commented Apr 6, 2018

@appukuttan-shailesh : Even with a different user I get the same error. And a google search does not bring a single hit.

I am using tornado version 4.5.3. Maybe there is a mismatch in the version you are using.

Here is the full pip-freeze list:

asn1crypto==0.24.0
backports-abc==0.5
backports.functools-lru-cache==1.5
backports.shutil-get-terminal-size==1.0.0
backports.ssl-match-hostname==3.5.0.1
bbp-client==0.4.4
bbp-services==0.0.15
beautifulsoup4==4.6.0
bleach==2.1.3
bluepyopt==1.6.11
bokeh==0.12.14
bs4==0.0.1
certifi==2018.1.18
cffi==1.11.5
chardet==3.0.4
click==6.7
cloudpickle==0.2.2
configparser==3.5.0
ConnPlotter==0.7a0
cryptography==2.2.1
cycler==0.10.0
cypy==0.2.0
Cython==0.25.2
cytoolz==0.9.0.1
dask==0.17.2
deap==1.2.2
decorator==4.2.1
dill==0.2.7.1
distributed==1.21.4
efel==2.13.6
elephant==0.4.3
entrypoints==0.2.3
enum34==1.1.6
fastcache==1.0.2
fpdf==1.7.2
funcsigs==1.0.2
functools32==3.2.3.post2
future==0.16.0
futures==3.2.0
gdist==1.0.3
gitdb2==2.0.3
GitPython==2.1.9
greenlet==0.4.13
h5py==2.7.1
hbp-service-client==1.1.0
hbp-validation-framework==0.3.0
heapdict==1.0.0
html5lib==1.0.1
httplib2==0.11.1
idna==2.6
ipaddress==1.0.18
ipykernel==4.8.2
ipyparallel==6.1.1
ipython==5.6.0
ipython-genutils==0.2.0
ipywidgets==5.2.2
Jinja2==2.10
jsonschema==2.6.0
jupyter-client==5.2.3
jupyter-collab-storage==0.0.9
jupyter-core==4.4.0
kiwisolver==1.0.1
lazyarray==0.2.10
LFPy==1.1.3
llvmlite==0.15.0
locket==0.2.0
lxml==4.2.1
MarkupSafe==1.0
matplotlib==2.2.2
mechanize==0.2.5
mistune==0.8.3
morphounit==0.3
mpi4py==2.0.0
msgpack-python==0.5.5
nbconvert==5.3.1
nbformat==4.4.0
neo==0.6.1
networkx==2.1
neurom==1.4.3
NEURON==7.4
nibabel==2.1.0
notebook==5.4.1
numba==0.30.0+0.gca133d2.dirty
numexpr==2.6.4
numpy==1.14.2
olefile==0.45.1
ordereddict==1.1
packaging==17.1
pandas==0.22.0
pandocfilters==1.4.2
partd==0.3.8
pathlib2==2.3.0
patsy==0.4.1
pexpect==4.4.0
pickleshare==0.7.4
Pillow==4.2.1
plotly==2.2.2
prompt-toolkit==1.0.15
psutil==5.4.3
ptyprocess==0.5.2
pycparser==2.18
pydicom==1.0.2
Pygments==2.2.0
PyJWT==1.6.1
pylru==1.0.9
PyNEST==2.12.0
PyNN==0.9.2
pyOpenSSL==17.5.0
pyparsing==2.2.0
PyPDF2==1.26.0
PySocks==1.6.8
python-dateutil==2.7.2
python-swiftclient==3.4.0
pytz==2018.3
pyunicore==0.2.1
PyYAML==3.10
pyzmq==17.0.0
quantities==0.12.1
requests==2.18.4
scandir==1.7
scikit-image==0.12.3
scikit-learn==0.18.2
scipy==1.0.1
sciunit==0.19
scoop==0.7.1.1
seaborn==0.7.1
Send2Trash==1.5.0
simplegeneric==0.8.1
singledispatch==3.4.0.3
six==1.11.0
smmap2==2.0.3
sortedcontainers==1.5.9
SQLAlchemy==1.1.13
statsmodels==0.8.0
subprocess32==3.2.7
sympy==1.0
tabulate==0.8.2
task-types==0.0.10
tblib==1.3.2
terminado==0.8.1
testpath==0.3.1
toolz==0.9.0
Topology==2.12.0
tornado==5.0.1
tqdm==4.19.8
traitlets==4.3.2
tvb==1.5.1
urllib3==1.22
validators==0.12.1
vincent==0.4.4
wcwidth==0.1.7
webencodings==0.5.1
wget==3.2
widgetsnbextension==1.2.6
xlrd==1.1.0
zict==0.1.3

Otherwise I suggest to create a ticket on the 'tornado' github page.

@apdavison
Copy link
Collaborator

This is happening within the jupyter_collab_storage package, which is maintained by the Collaboratory team. Probably best to tell them before creating a ticket on tornado, because it might be an installation problem and/or they could change the version of tornado used in the notebook VMs.

@appukuttan-shailesh
Copy link
Collaborator

appukuttan-shailesh commented Apr 6, 2018

Temporarily, you could do the following for testing:

pip uninstall tornado
pip install tornado==4.5.3

I am not sure if this should be checked inside the usecase. It is quite generic and probably needs to be resolved by the Collaboratory team across all environments.

@appukuttan-shailesh
Copy link
Collaborator

I am using tornado version 4.5.3. Maybe there is a mismatch in the version you are using.

p.s. note that your pip freeze states:

tornado==5.0.1

@alex4200
Copy link
Contributor Author

alex4200 commented Apr 6, 2018

@appukuttan-shailesh Thanks for noticing that. I just did a tornado.version and got the 4.5.3. I will play around and let you know...

@appukuttan-shailesh
Copy link
Collaborator

@alex4200
Copy link
Contributor Author

alex4200 commented Apr 9, 2018

The correct version of tornado to be used is 4.5.3.

@alex4200
Copy link
Contributor Author

alex4200 commented Apr 9, 2018

@appukuttan-shailesh : I have found the part that seems to update tornado.

I have run the use case Basal Ganglia Morphology Validation and made sure the version 4.5.3 was installed (according to pip freeze). Then after executing the pieces of the first cell in that notebook step-by-step I found the line that is responsible for installing tornado version 5.0.2:

!pip install --upgrade --quiet git+https://github.com/appukuttan-shailesh/morphounit.git@morph_checks
After executing this command the version of tornado is 5.0.2...

@appukuttan-shailesh
Copy link
Collaborator

@alex4200 : I am a bit surprised that it has popped-up there. Because I have previously encountered the same issue in other modules not using morphounit. And also this module itself does not make use of tornado. Shall see if any dependencies in-turn might be causing this.

@alex4200
Copy link
Contributor Author

@appukuttan-shailesh : I just retested that use case "Basal Ganglia Morphology Validation" from scratch, i.e. with the user alextestuser003 after I had its container reset (i.e. standard default configuration/installation for that user). I get the following error:

NameErrorTraceback (most recent call last)
<ipython-input-1-42da676d38a5> in <module>()
     31     get_ipython().system(u'pip install --upgrade --quiet git+https://github.com/appukuttan-shailesh/morphounit.git@morph_checks')
     32 import morphounit
---> 33 from morphounit.utils import neuroM_loader
     34 
     35 try:

/opt/conda/envs/python2/lib/python2.7/site-packages/morphounit/utils.py in <module>()
     18 # ==============================================================================
     19 
---> 20 class NeuroM_MorphStats(sciunit.Model, Versioned):
     21     """A class to interact with morphology files via the morphometrics-NeuroM's API (morph_stats)"""
     22 

NameError: name 'Versioned' is not defined

You can ask fabrice.gaillard@epfl.ch to reset your container. He needs your User ID (in your Collab Profile). Then you should get the same error...

@appukuttan-shailesh
Copy link
Collaborator

@alex4200 : I realize why this has come up. I think that it might be better for you to test the usecase once the second part (by @pedroernesto) is added. I shall update you of the same. Apologies for the mix-up.

@pedroernesto
Copy link
Collaborator

@alex4200 : error corrected, however you will have new updates soon from our side before the usecase is completed and ready to use

@appukuttan-shailesh
Copy link
Collaborator

Regarding the initial error involving 'tornado', I found that it was related to this issue:
pypa/pip#304
(For future reference: the dependency in context here was: sciunit -> ipykernel -> tornado>=4.0)

I have now resolved this by changing pip install --upgrade ... and pip install -U ... to:
pip install --upgrade-strategy only-if-needed ...

@alex4200 : Shall let you know when the usecase is ready.

@jdcourcol
Copy link
Collaborator

My suggestion is to use:
pip install my_lib==1.0.0 (if 1.0.0 is the version to use).
instead of going for:
pip install --upgrade my_lib

@appukuttan-shailesh
Copy link
Collaborator

@jdcourcol : currently I was doing upgrade to accommodate usecase related changes in my package. Once this is finalized (probably tomorrow), I shall do as you suggested and install with a specific version number. Thanks.

@pedroernesto
Copy link
Collaborator

pedroernesto commented Apr 25, 2018

@alex4200 : the usecase is ready at: https://collab.humanbrainproject.eu/#/collab/8123/nav/78914

A second part (soft-constraints check) has been added to test some morphological features in FS inter-neurons. The other cell types considered in the first part of the test (hard-constraints check), i.e. D1- and D2- MSNs, may also be tested as soon as more experimental data is available.

Just one feature can be time-consuming when testing "big" cells: the field's diameter for axon and basal dendrite. So, for a quick check, better to use small SWC files (<1Mb) amongst the ones listed in the first part of the test. For instance:

10 - C170897A-I1-rep-cor.swc
14 - C310106C-rep-cor.swc
35 - RP100428-12-IDL-rep-cor.swc
46 - TKB060508A2-CH5-BC-H-ZK-60X-1-rep-cor.swc

@alex4200
Copy link
Contributor Author

@pedroernesto : In the cell in Part I I get the following error. It seems the package 'tabulate' is missing...

----------------------------------------------
('Model name: ', '61-2-DE-rep-ax-cor')
('Model type: ', <class 'morphounit.utils.neuroM_loader'>)
----------------------------------------------

ImportErrorTraceback (most recent call last)
<ipython-input-7-fdfcfc02ce2e> in <module>()
     13     else:
     14         test_alias = "basalg_fs_morph_hardChecks"
---> 15     result_id = utils.run_test(hbp_username=HBP_USERNAME, environment="dev", model=morph_model, test_alias=test_alias, test_version="1.0", storage_collab_id=collab_id, register_result=True, client_obj=testLibrary)
     16     result_uuids.append(result_id)
     17 

/opt/conda/envs/python2/lib/python2.7/site-packages/hbp_validation_framework/utils.pyc in run_test(hbp_username, environment, model, test_instance_id, test_id, test_alias, test_version, storage_collab_id, register_result, model_metadata, client_obj, **test_kwargs)
    156         raise Exception("test_instance_id or (test_id, test_version) or (test_alias, test_version) needs to be provided for finding test.")
    157     else:
--> 158         test = test_library.get_validation_test(instance_id=test_instance_id, test_id=test_id, alias=test_alias, version=test_version, **test_kwargs)
    159 
    160     print("----------------------------------------------")

/opt/conda/envs/python2/lib/python2.7/site-packages/hbp_validation_framework/__init__.pyc in get_validation_test(self, test_path, instance_path, instance_id, test_id, alias, version, **params)
    575         cls_name = path_parts[-1]
    576         module_name = ".".join(path_parts[:-1])
--> 577         test_module = import_module(module_name)
    578         test_cls = getattr(test_module, cls_name)
    579 

/opt/conda/envs/python2/lib/python2.7/importlib/__init__.pyc in import_module(name, package)
     35             level += 1
     36         name = _resolve_name(name[level:], package, level)
---> 37     __import__(name)
     38     return sys.modules[name]

/opt/conda/envs/python2/lib/python2.7/site-packages/morphounit/tests/__init__.py in <module>()
     12 
     13 for module in modules:
---> 14     exec("from %s import *" % module)

<string> in <module>()

/opt/conda/envs/python2/lib/python2.7/site-packages/morphounit/tests/test_NeuroM_SomaDiamTest_Range.py in <module>()
      3 import morphounit.scores
      4 import morphounit.capabilities as cap
----> 5 import morphounit.plots as plots
      6 
      7 import quantities

/opt/conda/envs/python2/lib/python2.7/site-packages/morphounit/plots/__init__.py in <module>()
     12 
     13 for module in modules:
---> 14     exec("from %s import *" % module)

<string> in <module>()

/opt/conda/envs/python2/lib/python2.7/site-packages/morphounit/plots/plot_txt_table.py in <module>()
      1 # Currently meant only for CellDensityTest
      2 # Will be made generic soon
----> 3 from tabulate import tabulate
      4 
      5 #==============================================================================

ImportError: No module named tabulate

@appukuttan-shailesh
Copy link
Collaborator

appukuttan-shailesh commented Apr 26, 2018

@alex4200 : resolved now.

p.s. Is there an easy way to reset Jupyter container (without having to contact Collab support)? Just to be able to do on a more frequent basis as and when needed.

@alex4200
Copy link
Contributor Author

@appukuttan-shailesh : Seems to work now.

And no, there is no easy way (yet) to reset one's container. This might be a feature of an updated collaboratory (after SGA1)...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Topic_Validation Issues related to validation use cases Type_BUG Label to identify a bug in a use case
Projects
None yet
Development

No branches or pull requests

5 participants