[Neuroimaging] nibabel / pkg_resources /setuptools question

Matthew Brett matthew.brett at gmail.com
Fri Jul 29 12:37:16 EDT 2016


Hi,

On Fri, Jul 29, 2016 at 5:24 PM, Karl Helmer <helmer at nmr.mgh.harvard.edu> wrote:
> Hi Everyone,
>
>    I've just started to get the error message below when I "import
> nibabel" in a piece of code. I've just updated my anaconda, but was
> getting the error before then, and also used apt-get to get the latest
> python-nipype (that apt-get has anyway). I'm using Lubuntu:
> DISTRIB_DESCRIPTION="Ubuntu 14.04.4 LTS"
> and this is what it installed:
> "Preparing to unpack .../python-nibabel_2.0.2-1~nd14.04+1_all.deb ...
> Unpacking python-nibabel (2.0.2-1~nd14.04+1) ..."
> ...
> Setting up python-nibabel (2.0.2-1~nd14.04+1) ...
>
> It looks like it's not nibabel it's unhappy with, it's the setuptools
> version or maybe the interaction between the two?  Has anyone seen this
> and have a fix?
>
> thanks,
> Karl
> ---------------------------------------------------------
>
> Traceback (most recent call last):
>   File "edited_histograms.py", line 24, in <module>
>     import nibabel as nib
>   File
> "/home/karl/anaconda/lib/python2.7/site-packages/nibabel/__init__.py",
> line 45, in <module>
>     from .loadsave import load, save
>   File
> "/home/karl/anaconda/lib/python2.7/site-packages/nibabel/loadsave.py",
> line 21, in <module>
>     from .minc2 import Minc2Image
>   File "/home/karl/anaconda/lib/python2.7/site-packages/nibabel/minc2.py",
> line 30, in <module>
>     from .optpkg import optional_package
>   File
> "/home/karl/anaconda/lib/python2.7/site-packages/nibabel/optpkg.py",
> line 4, in <module>
>     import nose
>   File "/home/karl/anaconda/lib/python2.7/site-packages/nose/__init__.py",
> line 1, in <module>
>     from nose.core import collector, main, run, run_exit, runmodule
>   File "/home/karl/anaconda/lib/python2.7/site-packages/nose/core.py",
> line 11, in <module>
>     from nose.config import Config, all_config_files
>   File "/home/karl/anaconda/lib/python2.7/site-packages/nose/config.py",
> line 9, in <module>
>     from nose.plugins.manager import NoPlugins
>   File
> "/home/karl/anaconda/lib/python2.7/site-packages/nose/plugins/__init__.py",
> line 185, in <module>
>     from nose.plugins.manager import *
>   File
> "/home/karl/anaconda/lib/python2.7/site-packages/nose/plugins/manager.py",
> line 418, in <module>
>     import pkg_resources
>   File
> "/home/karl/anaconda/lib/python2.7/site-packages/distribute-0.6.17-py2.7.egg/pkg_resources.py",
> line 2729, in <module>
>     add_activation_listener(lambda dist: dist.activate())
>   File
> "/home/karl/anaconda/lib/python2.7/site-packages/distribute-0.6.17-py2.7.egg/pkg_resources.py",
> line 700, in subscribe
>     callback(dist)
>   File
> "/home/karl/anaconda/lib/python2.7/site-packages/distribute-0.6.17-py2.7.egg/pkg_resources.py",
> line 2729, in <lambda>
>     add_activation_listener(lambda dist: dist.activate())
>   File
> "/home/karl/anaconda/lib/python2.7/site-packages/distribute-0.6.17-py2.7.egg/pkg_resources.py",
> line 2229, in activate
>     self.insert_on(path)
>   File
> "/home/karl/anaconda/lib/python2.7/site-packages/distribute-0.6.17-py2.7.egg/pkg_resources.py",
> line 2330, in insert_on
>     "with distribute. Found one at %s" % str(self.location))
> ValueError: A 0.7-series setuptools cannot be installed with distribute.
> Found one at
> /home/karl/anaconda/lib/python2.7/site-packages/setuptools-20.7.0-py2.7.egg

That's a frightening mix of apt-get, neurodebian and anaconda!

Have you also been using easy_install by any chance?  I see that your
setuptools and distribute packages are in .egg directories.

If it were me, I would start by clearing out the easy_install
installs, as these can make a real mess of your imports - does
https://matthew-brett.github.io/pydagogue/un_easy_install.html help?
(you need to look in your anaconda directory rather than the system
directories, I suspect).

Do you need anaconda for anything specific, not covered by
neurodebian?  I suspect your life would be simpler if you could use
either `apt-get` or `conda` and not both.

Cheers,

Matthew


More information about the Neuroimaging mailing list