Unhelpful error message when installing rpy and running R<3.3

Issue #420 resolved
Martijn Bastiaan
created an issue

The command pip install rpy2 quits with an unhelpful error message when running R<3.3 and Python 3.5:

Traceback (most recent call last):
  File "setup.py", line 419, in <module>
    'rpy2': ['doc/source/rpy2_logo.png', ]}
  File "/usr/lib/python3.5/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/lib/python3.5/distutils/dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python3.5/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/home/martijn/code/amcat/env/lib/python3.5/site-packages/setuptools/command/install.py", line 67, in run
    self.do_egg_install()
  File "/home/martijn/code/amcat/env/lib/python3.5/site-packages/setuptools/command/install.py", line 109, in do_egg_install
    self.run_command('bdist_egg')                                                                                                     
  File "/usr/lib/python3.5/distutils/cmd.py", line 313, in run_command                                                                
    self.distribution.run_command(command)                                                                                            
  File "/usr/lib/python3.5/distutils/dist.py", line 974, in run_command                                                               
    cmd_obj.run()                                                                                                                     
  File "/home/martijn/code/amcat/env/lib/python3.5/site-packages/setuptools/command/bdist_egg.py", line 152, in run                   
    self.run_command("egg_info")                                                                                                      
  File "/usr/lib/python3.5/distutils/cmd.py", line 313, in run_command                                                                
    self.distribution.run_command(command)                                                                                            
  File "/usr/lib/python3.5/distutils/dist.py", line 974, in run_command                                                               
    cmd_obj.run()                                                                                                                     
  File "/home/martijn/code/amcat/env/lib/python3.5/site-packages/setuptools/command/egg_info.py", line 186, in run                    
    self.find_sources()                                                                                                               
  File "/home/martijn/code/amcat/env/lib/python3.5/site-packages/setuptools/command/egg_info.py", line 209, in find_sources           
    mm.run()                                                                                                                          
  File "/home/martijn/code/amcat/env/lib/python3.5/site-packages/setuptools/command/egg_info.py", line 293, in run                    
    self.add_defaults()                                                                                                               
  File "/home/martijn/code/amcat/env/lib/python3.5/site-packages/setuptools/command/egg_info.py", line 322, in add_defaults           
    sdist.add_defaults(self)                                                                                                          
  File "/home/martijn/code/amcat/env/lib/python3.5/site-packages/setuptools/command/sdist.py", line 132, in add_defaults              
    build_ext = self.get_finalized_command('build_ext')                                                                               
  File "/usr/lib/python3.5/distutils/cmd.py", line 299, in get_finalized_command                                                      
    cmd_obj.ensure_finalized()                                                                                                        
  File "/usr/lib/python3.5/distutils/cmd.py", line 107, in ensure_finalized                                                           
    self.finalize_options()                                                                                                           
  File "setup.py", line 143, in finalize_options                                                                                      
    " (and the we found R told '%s')." %'.'.join(rexec.version))                                                                      
TypeError: sequence item 0: expected str instance, int found 

This is caused by join not accepting anything but iterables of strings (instead of coercing implicitly like in Python 2). Can be fixed by changing line 142-143 of setup.py to:

                raise SystemExit("Error: R >= 3.3 required"
                                 " (and the we found R told '%s')." % '.'.join(map(str, rexec.version)))