man <command> doesn't display anything after package installation with conda on Ubuntu 17.10

When I try to get the manpages with man it seems to display nothing and behaves as though I just pressed enter

~$ man ls
~$ man man

I have tried solutions from these pages to no avail question1 question2. This last question matches my condition exactly but the fixes doesn't seem to work. Although info seems to work.

Here are some additional information:

~$ man --version
man 2.7.6.1

~$ type -p man
/usr/bin/man

~$ type -t man
file

~$ manpath
/home/abhilash/anaconda3/man:/usr/local/man:/usr/local/share/man:/usr/share/man:/usr/lib/jvm/java-8-oracle/man

~$ uname -a
Linux abhilash-ThinkPad-T440 4.13.0-38-generic #43-Ubuntu SMP Wed Mar 14 15:20:44 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

UPDATE

~$ type -a man
man is /usr/bin/man

~$ env | grep 'PAGER\|^MAN'
~$ 

UPDATE 2

~$ ls -1 /usr/share/man/man1 | wc -l
2145

~$ ls -l "$(type -p pager)"
lrwxrwxrwx 1 abhilash abhilash 18 Apr 16 18:43 /home/abhilash/anaconda3/bin/pager -> ../lib/R/bin/pager

~$ ls -l "$(readlink "$(type -p pager)")"
ls: cannot access '../lib/R/bin/pager': No such file or directory

Solution 1:

Turns out, after the anaconda installation or some package installation through conda, the default pager is re-written. The exact cause of this is unknown. Just some more information

~$ anaconda --version
anaconda Command line client (version 1.6.9)
~$ conda --version 
conda 4.4.10
~$ history | grep conda
  108  bash Anaconda3-5.1.0-Linux-x86_64.sh 
  110  anaconda-navigator
  181  anaconda-navigator
  187  anaconda-navigator
  311  conda info --envs
  312  conda install rpy2
  313  conda search PySide
  314  conda search Python
  366  conda install findspark
  367  conda info --envs
  370  conda install findspark
  373  conda search findspark
  374  conda install -c conda-forge findspark 
  495  anaconda --version
  496  conda --version 
  497  conda list
  499  history | grep conda

My strongest guess is that rpy2 installation had this effect of changing the pager information given the time of events.

But these are the steps I took to solve the issue.

~$ update-alternatives --display pager
pager - auto mode
  link best version is /bin/less
  link currently points to /bin/less
  link pager is /usr/bin/pager
  slave pager.1.gz is /usr/share/man/man1/pager.1.gz
/bin/less - priority 77
  slave pager.1.gz: /usr/share/man/man1/less.1.gz
/bin/more - priority 50
  slave pager.1.gz: /usr/share/man/man1/more.1.gz

~$ rm /home/abhilash/anaconda3/bin/pager

Ensure that the pager defaults to the one that came with man-db by typing the following to confirm

~$ ls -l "$(type -p pager)"
lrwxrwxrwx 1 root root 23 Apr  9 13:57 /usr/bin/pager -> /etc/alternatives/pager

This solution was arrived at after going through this link in an attempt to set the pager to default.

Thanks to glenn and terdon for their inputs in solving this issue.