Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I often find myself wanting to install something, but I'm unsure of what package it's in. This is a very common occurrence for me:

$ make html
sphinx-build -b djangohtml -d _build/doctrees   . _build/html
make: sphinx-build: Command not found
make: *** [html] Error 127

$ sudo apt-get install sphinx
E: Unable to locate package sphinx

$ sudo apt-get install sphinx-build
E: Unable to locate package sphinx-build

googles

$ sudo apt-get install python-sphinx

Is there a better way?

share|improve this question
add comment

6 Answers 6

up vote 23 down vote accepted

Install apt-file and run apt-file update

Then use apt-file search sphinx-build to search for packages contanining a file named sphinx-build

share|improve this answer
    
Nice one! I have always resorted to packages.ubuntu.com, but a command line app is always best :D –  Egil Apr 12 '11 at 15:16
add comment

Ubuntu is pretty smart. Just try to run it.

sphinx-build

The program 'sphinx-build' is currently not installed. You can install it by typing: sudo apt-get install python-sphinx

share|improve this answer
2  
Does anyone know exactly how this "smartness" is implemented in Ubuntu? e.g., which package provides this? –  entropo Apr 12 '11 at 22:12
4  
@entropo: The package that provides this functionality is "command-not-found". –  Tweek Apr 12 '11 at 23:52
    
@tweek: Awesome, thank you! –  entropo Apr 12 '11 at 23:54
1  
This should be used very carefully as a command that doesn't work from a script or makefile may work if called from your shell (e.g. because the script is using another $PATH or you have a alias with the same name in your shell) and could have undesired effects. –  Florian Diesch Apr 13 '11 at 17:08
add comment

I don't know if apt-get can do it, but I prefer to use aptitude anyway.

Using its search command, you get a list of packages that contains the string you are searching for, however that still does not fully answer your question, as it does not reveal which package contains the binary you are looking for.

Example:

sudo aptitude search sphinx
p   gstreamer0.10-pocketsphinx      - lightweight speech recognition - GStreamer
p   libpocketsphinx-dev             - lightweight speech recognition - developme
p   libpocketsphinx1                - lightweight speech recognition - library  
p   libsphinx-search-perl           - Perl module for Sphinx search engine      
p   libsphinx2-dev                  - speech recognition library - development k
p   libsphinx2g0                    - speech recognition library                
p   libsphinxbase-dev               - Sphinx base libraries - development files 
p   libsphinxbase1                  - Sphinx base libraries                     
p   pocketsphinx-hmm-tidigits       - lightweight speech recognition - TIDIGITS 
p   pocketsphinx-hmm-wsj1           - lightweight speech recognition - WSJ1 acou
p   pocketsphinx-lm-wsj             - lightweight speech recognition - WSJ langu
p   pocketsphinx-utils              - lightweight speech recognition - command-l
p   python-pocketsphinx             - lightweight speech recognition - Python mo
p   python-pocketsphinx-dbg         - lightweight speech recognition - Python mo
p   python-repoze.sphinx.autointerf - Sphinx extension that auto-generates API d
p   python-sphinx                   - tool for producing documentation for Pytho
p   python-sphinxbase               - Sphinx base libraries - Python module     
p   python-sphinxbase-dbg           - Sphinx base libraries - Python module (deb
v   python2.6-pocketsphinx          -                                           
v   python2.6-pocketsphinx-dbg      -                                           
v   python2.6-sphinxbase            -                                           
v   python2.6-sphinxbase-dbg        -                                           
v   python2.7-pocketsphinx          -                                           
v   python2.7-pocketsphinx-dbg      -                                           
v   python2.7-sphinxbase            -                                           
v   python2.7-sphinxbase-dbg        -                                           
p   sphinx2-bin                     - speech recognition utilities              
p   sphinx2-hmm-6k                  - speech recognition library - default acous
p   sphinxbase-utils                - Sphinx base libraries - utilities         
p   sphinxsearch                    - Fast standalone full-text SQL search engine
share|improve this answer
    
This helps somewhat, but after that you would need to run something like 'dpkg -L packagename | grep bin' to find what commands a package actually provides. –  Tanath Apr 12 '11 at 20:41
add comment

I like to use http://packages.ubuntu.com/ -- there's "Search the contents of packages" inside. Debian also has similar interface at http://packages.debian.org.

This has the advantage that you can use it without CLI access to Ubuntu itself, f.e. explaining things over a phone.

share|improve this answer
add comment

you can use the apt group of commands or aptitude which i recommend above apt. Here is the list to search

APT

To search for something similar to the command you want: apt-cache search X for example apt-cache search cheese will give you everything related to cheese.
To show what dependencies and stuff it has you would do apt-cache show cheese.
Of course to install would be apt-get install cheese.

APTITUDE

To search: aptitude search cheese which will show a more nicer list than apt
To show: aptitude show cheese which again will show a more nicer and friendlier list
To install: aptitude install cheese to install it. Again nicer.

Also aptitude gives more relevant information to what you are looking for, for example:

apt-cache search phi VS aptitude search phi
apt-cache search sphi VS aptitude search sphi

If you want a GUI version i recommend Synaptic Package Manager or a simpler Software Center. In Synaptic you can look for something similar to what you are looking for and it will show it to you.

share|improve this answer
add comment

auto-apt

auto-apt is a package that comes in handy a lot, especially with Makefiles and configure scripts that reference things you might not have and don't know where to find, which is often tricky with header files. You invoked make in this case, and it tried to invoke sphinx-build, but failed when it couldn't find it.

auto-apt run [...] will run the command specified, then guide you through installing packages containing missing files that it knows apt-get can find and install.

So, just invoke auto-apt run make html and see what happens :)

For more information, see the the documentation for auto-apt

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.