Checking-nipype-Installation

Checking nipype installation

  1. There are number of ways to check its installation as shown below.
In [2]:
import nipype; print(nipype.__version__)
1.5.0
In [1]:
import nipype; nipype.test()
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
~/anaconda3/envs/nipype/lib/python3.8/site-packages/nipype/__init__.py in __call__(self, doctests, parallel)
     36         try:
---> 37             import pytest
     38         except ImportError:

ModuleNotFoundError: No module named 'pytest'

During handling of the above exception, another exception occurred:

RuntimeError                              Traceback (most recent call last)
<ipython-input-1-bac8365228b1> in <module>
----> 1 import nipype; nipype.test()

~/anaconda3/envs/nipype/lib/python3.8/site-packages/nipype/__init__.py in __call__(self, doctests, parallel)
     37             import pytest
     38         except ImportError:
---> 39             raise RuntimeError("py.test not installed, run: pip install pytest")
     40         args = []
     41         if not doctests:

RuntimeError: py.test not installed, run: pip install pytest
  • The above simply says that pytest is not installed and using the pip install it.
  • Installed pytest using pip install pytest and run the text again. When test is run it gives the following error.
  • Docs: https://docs.pytest.org/en/latest/warnings.html ======================================================== short test summary info ========================================================= ERROR ../../../../anaconda3/envs/nipype/lib/python3.8/site-packages/nipype/sphinxext/documenter.py - ModuleNotFoundError: No module nam... ERROR ../../../../anaconda3/envs/nipype/lib/python3.8/site-packages/nipype/sphinxext/apidoc/init.py - ModuleNotFoundError: No modul... ERROR ../../../../anaconda3/envs/nipype/lib/python3.8/site-packages/nipype/sphinxext/apidoc/docstring.py - ModuleNotFoundError: No modu... !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 3 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ===================================================== 9 warnings, 3 errors in 57.98s =====================================================

  • The error above is related to the Sphinix package which comes with nipype. We wil see it later.

In [3]:
import nipype as ny
ny.get_info()
Out[3]:
{'pkg_path': '/home/sayyed/anaconda3/envs/nipype/lib/python3.8/site-packages/nipype',
 'commit_source': 'archive substitution',
 'commit_hash': '%h',
 'nipype_version': '1.5.0',
 'sys_version': '3.8.2 | packaged by conda-forge | (default, Apr 24 2020, 08:20:52) \n[GCC 7.3.0]',
 'sys_executable': '/home/sayyed/anaconda3/envs/nipype/bin/python',
 'sys_platform': 'linux',
 'numpy_version': '1.18.5',
 'scipy_version': '1.5.0',
 'networkx_version': '2.4',
 'nibabel_version': '3.1.1',
 'traits_version': '6.1.0'}

Testing the installation

In [3]:
import nipype; nipype.test()
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
~/anaconda3/envs/nipype/lib/python3.8/site-packages/nipype/__init__.py in __call__(self, doctests, parallel)
     36         try:
---> 37             import pytest
     38         except ImportError:

ModuleNotFoundError: No module named 'pytest'

During handling of the above exception, another exception occurred:

RuntimeError                              Traceback (most recent call last)
<ipython-input-3-bac8365228b1> in <module>
----> 1 import nipype; nipype.test()

~/anaconda3/envs/nipype/lib/python3.8/site-packages/nipype/__init__.py in __call__(self, doctests, parallel)
     37             import pytest
     38         except ImportError:
---> 39             raise RuntimeError("py.test not installed, run: pip install pytest")
     40         args = []
     41         if not doctests:

RuntimeError: py.test not installed, run: pip install pytest
In [ ]:
1. I installed `pytest` using `pip install pytest` it rand the test and filed on `Sphinix extension`.
2. When tried to import `nilearn` it also threw an error of not finding this package.
In [4]:
import nipype; nipype.test()
============================= test session starts ==============================
platform linux -- Python 3.8.2, pytest-5.4.3, py-1.9.0, pluggy-0.13.1
rootdir: /home/sayyed/anaconda3/envs/nipype/lib/python3.8/site-packages/nipype, inifile: pytest.ini
collected 2885 items / 2 errors / 2883 selected

==================================== ERRORS ====================================
________________ ERROR collecting sphinxext/apidoc/__init__.py _________________
/home/sayyed/anaconda3/envs/nipype/lib/python3.8/site-packages/nipype/sphinxext/apidoc/__init__.py:5: in <module>
    from sphinxcontrib.napoleon import (
E   ModuleNotFoundError: No module named 'sphinxcontrib.napoleon'
________________ ERROR collecting sphinxext/apidoc/docstring.py ________________
/home/sayyed/anaconda3/envs/nipype/lib/python3.8/site-packages/py/_path/local.py:704: in pyimport
    __import__(modname)
/home/sayyed/anaconda3/envs/nipype/lib/python3.8/site-packages/nipype/sphinxext/apidoc/__init__.py:5: in <module>
    from sphinxcontrib.napoleon import (
E   ModuleNotFoundError: No module named 'sphinxcontrib.napoleon'
=========================== short test summary info ============================
ERROR ../../../../../anaconda3/envs/nipype/lib/python3.8/site-packages/nipype/sphinxext/apidoc/__init__.py
ERROR ../../../../../anaconda3/envs/nipype/lib/python3.8/site-packages/nipype/sphinxext/apidoc/docstring.py
!!!!!!!!!!!!!!!!!!! Interrupted: 2 errors during collection !!!!!!!!!!!!!!!!!!!!
============================== 2 errors in 17.92s ==============================
---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
<ipython-input-4-bac8365228b1> in <module>
----> 1 import nipype; nipype.test()

~/anaconda3/envs/nipype/lib/python3.8/site-packages/nipype/__init__.py in __call__(self, doctests, parallel)
     48             args.append("-n auto")
     49         args.append(os.path.dirname(__file__))
---> 50         pytest.main(args=args)
     51 
     52 

~/anaconda3/envs/nipype/lib/python3.8/site-packages/_pytest/config/__init__.py in main(args, plugins)
    122         else:
    123             try:
--> 124                 ret = config.hook.pytest_cmdline_main(
    125                     config=config
    126                 )  # type: Union[ExitCode, int]

~/anaconda3/envs/nipype/lib/python3.8/site-packages/pluggy/hooks.py in __call__(self, *args, **kwargs)
    284                     stacklevel=2,
    285                 )
--> 286         return self._hookexec(self, self.get_hookimpls(), kwargs)
    287 
    288     def call_historic(self, result_callback=None, kwargs=None, proc=None):

~/anaconda3/envs/nipype/lib/python3.8/site-packages/pluggy/manager.py in _hookexec(self, hook, methods, kwargs)
     91         # called from all hookcaller instances.
     92         # enable_tracing will set its own wrapping function at self._inner_hookexec
---> 93         return self._inner_hookexec(hook, methods, kwargs)
     94 
     95     def register(self, plugin, name=None):

~/anaconda3/envs/nipype/lib/python3.8/site-packages/pluggy/manager.py in <lambda>(hook, methods, kwargs)
     82             )
     83         self._implprefix = implprefix
---> 84         self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
     85             methods,
     86             kwargs,

    [... skipping hidden 3 frame]

~/anaconda3/envs/nipype/lib/python3.8/site-packages/_pytest/main.py in pytest_cmdline_main(config)
    238 
    239 def pytest_cmdline_main(config):
--> 240     return wrap_session(config, _main)
    241 
    242 

~/anaconda3/envs/nipype/lib/python3.8/site-packages/_pytest/main.py in wrap_session(config, doit)
    233                     session.exitstatus = exc.returncode
    234                 sys.stderr.write("{}: {}\n".format(type(exc).__name__, exc))
--> 235         config._ensure_unconfigure()
    236     return session.exitstatus
    237 

~/anaconda3/envs/nipype/lib/python3.8/site-packages/_pytest/config/__init__.py in _ensure_unconfigure(self)
    823         if self._configured:
    824             self._configured = False
--> 825             self.hook.pytest_unconfigure(config=self)
    826             self.hook.pytest_configure._call_history = []
    827         while self._cleanup:

~/anaconda3/envs/nipype/lib/python3.8/site-packages/pluggy/hooks.py in __call__(self, *args, **kwargs)
    284                     stacklevel=2,
    285                 )
--> 286         return self._hookexec(self, self.get_hookimpls(), kwargs)
    287 
    288     def call_historic(self, result_callback=None, kwargs=None, proc=None):

~/anaconda3/envs/nipype/lib/python3.8/site-packages/pluggy/manager.py in _hookexec(self, hook, methods, kwargs)
     91         # called from all hookcaller instances.
     92         # enable_tracing will set its own wrapping function at self._inner_hookexec
---> 93         return self._inner_hookexec(hook, methods, kwargs)
     94 
     95     def register(self, plugin, name=None):

~/anaconda3/envs/nipype/lib/python3.8/site-packages/pluggy/manager.py in <lambda>(hook, methods, kwargs)
     82             )
     83         self._implprefix = implprefix
---> 84         self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
     85             methods,
     86             kwargs,

    [... skipping hidden 3 frame]

~/anaconda3/envs/nipype/lib/python3.8/site-packages/nipype/conftest.py in pytest_unconfigure(config)
     42 def pytest_unconfigure(config):
     43     # Delete temp folder after session is finished
---> 44     shutil.rmtree(temp_folder)

~/anaconda3/envs/nipype/lib/python3.8/shutil.py in rmtree(path, ignore_errors, onerror)
    704             orig_st = os.lstat(path)
    705         except Exception:
--> 706             onerror(os.lstat, path, sys.exc_info())
    707             return
    708         try:

~/anaconda3/envs/nipype/lib/python3.8/shutil.py in rmtree(path, ignore_errors, onerror)
    702         # lstat()/open()/fstat() trick.
    703         try:
--> 704             orig_st = os.lstat(path)
    705         except Exception:
    706             onerror(os.lstat, path, sys.exc_info())

FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmpqoloi4y8'
In [2]:
# Import the nipype module
import nipype
# Optional: Use the following lines to increase verbosity of output
nipype.config.set('logging', 'workflow_level', 'CRITICAL')
nipype.config.set('logging', 'interface_level', 'CRITICAL')
nipype.logging.update_logging(nipype.config)
# Run the test: Increase verbosity parameter for more info
nipype.test()
ERROR: usage: ipykernel_launcher.py [options] [file_or_dir] [file_or_dir] [...]
ipykernel_launcher.py: error: unrecognized arguments: --doctest-modules
  inifile: /home/sayyed/anaconda3/envs/nipype/lib/python3.8/site-packages/nipype/pytest.ini
  rootdir: /home/sayyed/anaconda3/envs/nipype/lib/python3.8/site-packages/nipype

In [ ]:
 

Comments