1

I'm having problems with ~/.local/share/miniconda3/envs/nndl/bin/tput - it produces output different to my system version, breaking some ANSI colouring.

I'm trying to track down the package which provides this offensive version.

I've tried (source):

pip list | tail -n +3 | cut -d" " -f1 | xargs pip show -f | grep tput

But the binary is not shown.

How do I find which python package includes a binary?

Tom Hale
  • 33,125
  • 23
  • 155
  • 216
  • Unfortunately, I don't know a general solution to the problem. But in your special case it should be the ncurses package: https://packages.ubuntu.com/search?searchon=contents&keywords=tput&mode=exactfilename&suite=disco&arch=any – cel Apr 26 '19 at 09:34
  • Thanks @cel, but I use Arch Linux packages and am looking for the python package with the binary that miniconda is putting earlier in my PATH. – Tom Hale Apr 26 '19 at 09:48
  • I am very sure that it will be provided by conda's ncurses package. You can check `conda list |grep ncurses` and see whether it is installed. – cel Apr 26 '19 at 10:19
  • @cel How can I tell if you are right? pip doesn't seem to tell me. – Tom Hale Apr 26 '19 at 13:39
  • Do you *have* `ncurses` in the env? If yes then it's Occam's razor. – tripleee Apr 27 '19 at 06:36
  • @tripleee `pip list | grep -q ncurses` is false (with the broken colours environment activated). – Tom Hale Apr 27 '19 at 06:41
  • If you examine the `tput` file, is it a binary, or Python code? In the latter case the `import` should reveal which package it's from. – tripleee Apr 27 '19 at 06:43
  • @tripleee `file` says: `ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.18, not stripped` – Tom Hale Apr 27 '19 at 08:09
  • 1
    Can you run `strings` on it? – tripleee Apr 27 '19 at 08:16
  • @tripleee It seems to be a regular RedHat binary: https://pastebin.com/TxtZyGz7 – Tom Hale Apr 27 '19 at 09:11

3 Answers3

1

To find which package some file belongs to in a mixed conda/pip environment

  1. search which package installed by pip contains filename:
pip list | tail -n +3 | cut -d" " -f1 | xargs pip show -f | grep filename_to_find
  1. but if it was installed via conda you have to do this instead:
grep filename_to_find  ~/anaconda3/envs/ENVNAME/conda-meta/*
  • replace filename_to_find with the filename you need
  • replace ~/anaconda3 with the path where your conda resides
  • replace ENVNAME with the conda env name you want

(the first recipe is from OP)

stason
  • 4,417
  • 3
  • 28
  • 44
0

One ugly solution is:

  1. Rename the file
  2. Re-install all installed packages one-by-one until the file reappears
Tom Hale
  • 33,125
  • 23
  • 155
  • 216
-1
which python

It should give you the right path

Albe
  • 111
  • 4