0

I recently upgraded from Ubuntu 17.04 to 17.10 in order to be able receive the patches for meltdown. This upgrade automatically bumped me from python3.5 to python3.6, which I don't have any problem with. However, I do have to go through and reinstall all the little tools I used. One is being troublesome.

I use a tool called tmuxp, and the official install instructions are pip install --user tmuxp. However, it seems that some time ago I install tmuxp globally on my python3.5, and it now has an executable in my /user/local/bin:

➜ maynard@buddha  ~  which tmuxp
/usr/local/bin/tmuxp

This means that even after running pip install --user tmuxp, when I run tmuxp I get a DistributionNotFound error.

➜ maynard@buddha  ~  tmuxp
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 658, in _build_master
    ws.require(__requires__)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 972, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 863, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.VersionConflict: (tmuxp 1.3.5 (/home/maynard/.local/lib/python3.6/site-packages), Requirement.parse('tmuxp==1.3.2'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/tmuxp", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3049, in <module>
    @_call_aside
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3033, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3062, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 660, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 673, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 858, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'tmuxp==1.3.2' distribution was not found and
is required by the application

So the old python3.5 tmuxp binary is going and looking in the new python3.6 site-packages for an older version of itself. This should be an easy fix. Simply uninstall the python3.5 version of tmuxp. But when I use pip3.5 is tries to uninstall the python3.6 tmuxp.

pip3.5 uninstall tmuxp
Uninstalling tmuxp-1.3.5:
  /home/maynard/.local/bin/tmuxp
  /home/maynard/.local/lib/python3.6/site-packages/tmuxp-1.3.5.dist-info/DESCRIPTION.rst
  ...
  /home/maynard/.local/lib/python3.6/site-packages/tmuxp/workspacebuilder.py

In fact, a pip3.5 list doesn't even show tmuxp, but I can see it in /usr/local/lib/python3.5/dist-packages!

ls /usr/local/lib/python3.5/dist-packages
click                     kaptan                  powerline
click-6.7.dist-info       kaptan-0.5.8.egg-info   powerline_status-2.6.egg-info
colorama                  libtmux                 tmuxp
colorama-0.3.9.dist-info  libtmux-0.7.4.egg-info  tmuxp-1.3.2.egg-info

Invoking sudo doesn't work either. sudo ~/.local/bin/pip3.5 uninstall tmuxp once again tries to uninstall the python3.6 version of tmuxp.

I know I could just delete the binary in /usr/local/bin/tmuxp... But I want to know how I got myself into this mess and how I can get out of it cleanly.

  • Why not just remove `/usr/local/bin/tmuxp` and `/usr/local/lib/python3.5`? – phd Jan 30 '18 at 20:13
  • `pip3.5` is just a symlink to the `pip` executable - is it still pointing to a correct binary? Run `pip3.5 -V`, what `site-packages` directory does the output mention? – hoefling Jan 30 '18 at 23:59
  • @phd I know I could, but I'm wondering if there's a "proper" way to go through this (perhaps there are other lingering binaries that I will have missed for example) – Sam Maynard Jan 31 '18 at 04:33
  • @hoefling it mentions the python3.6 site-packages in my `/home/maynard/.local`... how do I get it to interact with `/usr/local/lib/python3.5/dist-packages` ? – Sam Maynard Jan 31 '18 at 04:34
  • @SamMaynard There is no. `pip` is not a full-blown package manager. – phd Jan 31 '18 at 05:10
  • Well, the "proper" way would be to `pip3.5 uninstall` everything before removing Python 3.5. Not sure if it's really proper way. – phd Jan 31 '18 at 05:35
  • 1
    @SamMaynard it looks like you don't have `python3.5` installed anymore. I agree with @phd - if you want to do the proper clean up, install `python3.5` alongside `python3.6`, go through the package list with `pip3.5 list`, uninstall each one, uninstall `python3.5`, install `tmuxp` with `pip3.6`. – hoefling Jan 31 '18 at 09:45

1 Answers1

0

tmuxp didn't exist officially in Ubuntu until 18.04 bionic (LTS).

/usr/lib/python3/dist-packages

Do you have tmuxp installed through apt / apt-get through some other method? If so, see what sudo apt-get remove tmuxp does.

If you don't have the apt package to tmuxp, I'm concerned about your system's python installation.

Backtracking using history(1) + grep(1)

To find out how and why the system's python packages got borked depends on the commands you ran in the past. Hopefully you still have a shell history of when you installed.

If you look in your Bash history for tmuxp by piping to grep(1), e.g. history | grep tmuxp, can you see commands for how you could have ended up with it previously?

My hunch is you may have used easy_install, which in 2022 isn't used anymore.

Cleaning up old packages

I prefer clean installs over upgrades with Ubuntu, namely to avoid issues like this. It's not as painful in recent releases.

@hoefling's comment is on track. It seems you need to install python 3.5 again. This answer has some ways to get 3.5 working again. Afterwards, you can then install it.

tony
  • 870
  • 7
  • 16
  • 1
    thanks for your reply @Tony :) I asked this question over four years ago, and have definitely moved on since then. I think you and @hoefling are probably correct that I would need to re-install `python3.5` to do the cleanup properly. – Sam Maynard May 07 '22 at 17:31