Pip uninstall nupic pycapnp artifact

Maybe there are some seasoned python users who can help me out with this problem…

I can run pip install nupic --user and then pip uninstall nupic -y without problems, but if I run pip uninstall nupic -y any more times, I get an error because of NuPIC’s pycapnp dependency:

∙ pip install nupic --user
Collecting nupic
  Using cached nupic-0.8.0-py2-none-any.whl
Requirement already satisfied: mock==1.0.1 in /Users/mtaylor/Library/Python/2.7/lib/python/site-packages (from nupic)
Collecting nupic.bindings==0.7.0 (from nupic)
  Using cached nupic.bindings-0.7.0-cp27-cp27m-macosx_10_11_intel.whl
Requirement already satisfied: python-dateutil==2.1 in /Users/mtaylor/Library/Python/2.7/lib/python/site-packages (from nupic)
Requirement already satisfied: PyMySQL==0.6.2 in /Users/mtaylor/Library/Python/2.7/lib/python/site-packages (from nupic)
Requirement already satisfied: pyproj==1.9.3 in /Users/mtaylor/Library/Python/2.7/lib/python/site-packages (from nupic)
Requirement already satisfied: ordereddict==1.1 in /Users/mtaylor/Library/Python/2.7/lib/python/site-packages (from nupic)
Requirement already satisfied: unittest2==0.5.1 in /Users/mtaylor/Library/Python/2.7/lib/python/site-packages (from nupic)
Requirement already satisfied: pytest-cov==2.5.0 in /Users/mtaylor/Library/Python/2.7/lib/python/site-packages (from nupic)
Requirement already satisfied: pytest==3.0.7 in /Users/mtaylor/Library/Python/2.7/lib/python/site-packages (from nupic)
Requirement already satisfied: prettytable==0.7.2 in /Users/mtaylor/Library/Python/2.7/lib/python/site-packages (from nupic)
Collecting pycapnp==0.5.12; platform_system == "Linux" or platform_system == "Darwin" (from nupic)
Requirement already satisfied: validictory==0.9.1 in /Users/mtaylor/Library/Python/2.7/lib/python/site-packages (from nupic)
Requirement already satisfied: asteval==0.9.1 in /Users/mtaylor/Library/Python/2.7/lib/python/site-packages (from nupic)
Requirement already satisfied: pytest-xdist==1.16.0 in /Users/mtaylor/Library/Python/2.7/lib/python/site-packages (from nupic)
Requirement already satisfied: numpy==1.12.1 in /Users/mtaylor/Library/Python/2.7/lib/python/site-packages (from nupic)
Requirement already satisfied: PyYAML==3.10 in /Users/mtaylor/Library/Python/2.7/lib/python/site-packages (from nupic)
Requirement already satisfied: DBUtils==1.1 in /Users/mtaylor/Library/Python/2.7/lib/python/site-packages (from nupic)
Requirement already satisfied: psutil==1.0.1 in /Users/mtaylor/Library/Python/2.7/lib/python/site-packages (from nupic)
Requirement already satisfied: coverage==3.7.1 in /Users/mtaylor/Library/Python/2.7/lib/python/site-packages (from nupic)
Requirement already satisfied: six in /Users/mtaylor/Library/Python/2.7/lib/python/site-packages (from python-dateutil==2.1->nupic)
Requirement already satisfied: setuptools in /Users/mtaylor/Library/Python/2.7/lib/python/site-packages (from pytest==3.0.7->nupic)
Requirement already satisfied: py>=1.4.29 in /Users/mtaylor/Library/Python/2.7/lib/python/site-packages (from pytest==3.0.7->nupic)
Requirement already satisfied: execnet>=1.1 in /Users/mtaylor/Library/Python/2.7/lib/python/site-packages (from pytest-xdist==1.16.0->nupic)
Requirement already satisfied: apipkg>=1.4 in /Users/mtaylor/Library/Python/2.7/lib/python/site-packages (from execnet>=1.1->pytest-xdist==1.16.0->nupic)
Installing collected packages: pycapnp, nupic.bindings, nupic
  Found existing installation: nupic.bindings 0.7.2.dev0
    Uninstalling nupic.bindings-0.7.2.dev0:
      Successfully uninstalled nupic.bindings-0.7.2.dev0
Successfully installed nupic-0.8.0 nupic.bindings-0.7.0 pycapnp-0.5.12
❤ ★                  ↑ +829 (master ᄉ origin)      ~/nta/nupic
∙ pip uninstall nupic -y
Uninstalling nupic-0.8.0:
  Successfully uninstalled nupic-0.8.0
❤ ★                  ↑ +829 (master ᄉ origin)      ~/nta/nupic
∙ pip uninstall nupic -y
Exception:
Traceback (most recent call last):
  File "/Users/mtaylor/Library/Python/2.7/lib/python/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/Users/mtaylor/Library/Python/2.7/lib/python/site-packages/pip/commands/uninstall.py", line 76, in run
    requirement_set.uninstall(auto_confirm=options.yes)
  File "/Users/mtaylor/Library/Python/2.7/lib/python/site-packages/pip/req/req_set.py", line 346, in uninstall
    req.uninstall(auto_confirm=auto_confirm)
  File "/Users/mtaylor/Library/Python/2.7/lib/python/site-packages/pip/req/req_install.py", line 607, in uninstall
    if not self.check_if_exists():
  File "/Users/mtaylor/Library/Python/2.7/lib/python/site-packages/pip/req/req_install.py", line 1036, in check_if_exists
    self.req.name
  File "/Users/mtaylor/Library/Python/2.7/lib/python/site-packages/pip/_vendor/pkg_resources/__init__.py", line 558, in get_distribution
    dist = get_provider(dist)
  File "/Users/mtaylor/Library/Python/2.7/lib/python/site-packages/pip/_vendor/pkg_resources/__init__.py", line 432, in get_provider
    return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
  File "/Users/mtaylor/Library/Python/2.7/lib/python/site-packages/pip/_vendor/pkg_resources/__init__.py", line 968, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/Users/mtaylor/Library/Python/2.7/lib/python/site-packages/pip/_vendor/pkg_resources/__init__.py", line 859, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
ContextualVersionConflict: (pycapnp 0.5.12 (/Users/mtaylor/Library/Python/2.7/lib/python/site-packages), Requirement.parse('pycapnp==0.5.8'), set(['nupic']))

I run pip uninstall nupic -y as a part of scripts that help me bounce between versions, so I hate constantly seeing this error if I have already uninstalled.

You might have some nupic “turds” left over from past installation conflicts. As a matter of habit, I always run uninstall an extra time (I don’t use -y, but that probably doesn’t matter), just to make sure that I don’t have some old version lying around, and don’t have problems. You may need to go to your site-packages and grep for nupic as well as search for files/directories there starting with “nupic”. It may require some manual cleanup.

It’s not from previous installations. If I pip uninstall pycapnp, then subsequent pip uninstall nupic expected returns:

Cannot uninstall requirement nupic, not installed

So it is something happening in the installation that just occurred. To test I uninstalled them both and ran pip uninstall nupic and it worked fine. The error only starts after I’ve installed and uninstalled nupic.

Hmmm… I always uninstall nupic without uninstalling pycapnp and don’t recall running into this issue. Sorry, I’m not sure what’s going on.