0
votes

I'm trying to install rpy2 using pip install rpy2 on the command shell, but I get the following ERROR:

Collecting rpy2 Using cached https://files.pythonhosted.org/packages/c7/43/401afad8556bf92b08bd7d422cacac614b0e8dd2bce31848318bbcb18f48/rpy2-3.0.5.tar.gz ERROR: Complete output from command python setup.py egg_info: ERROR: Traceback (most recent call last): File "c:\users\pablo\appdata\local\programs\python\python36-32\lib\site-packages\setuptools\msvc.py", line 477, in init self.vc_ver = self.find_available_vc_vers()[-1] IndexError: list index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "c:\users\pablo\appdata\local\programs\python\python36-32\lib\site-packages\setuptools\sandbox.py", line 157, in save_modules yield saved File "c:\users\pablo\appdata\local\programs\python\python36-32\lib\site-packages\setuptools\sandbox.py", line 198, in setup_context yield File "c:\users\pablo\appdata\local\programs\python\python36-32\lib\site-packages\setuptools\sandbox.py", line 248, in run_setup DirectorySandbox(setup_dir).run(runner) File "c:\users\pablo\appdata\local\programs\python\python36-32\lib\site-packages\setuptools\sandbox.py", line 278, in run return func() File "c:\users\pablo\appdata\local\programs\python\python36-32\lib\site-packages\setuptools\sandbox.py", line 246, in runner _execfile(setup_script, ns) File "c:\users\pablo\appdata\local\programs\python\python36-32\lib\site-packages\setuptools\sandbox.py", line 47, in _execfile exec(code, globals, locals) File "C:\Users\pablo\AppData\Local\Temp\easy_install-uj2tljdw\cffi-1.12.3\setup.py", line 127, in using R's own C-API through either: File "C:\Users\pablo\AppData\Local\Temp\easy_install-uj2tljdw\cffi-1.12.3\setup.py", line 105, in uses_msvc else: File "c:\users\pablo\appdata\local\programs\python\python36-32\lib\distutils\command\config.py", line 227, in try_compile self._compile(body, headers, include_dirs, lang) File "c:\users\pablo\appdata\local\programs\python\python36-32\lib\distutils\command\config.py", line 133, in _compile self.compiler.compile([src], include_dirs=include_dirs) File "c:\users\pablo\appdata\local\programs\python\python36-32\lib\distutils_msvccompiler.py", line 304, in compile self.initialize() File "c:\users\pablo\appdata\local\programs\python\python36-32\lib\distutils_msvccompiler.py", line 197, in initialize vc_env = _get_vc_env(plat_spec) File "c:\users\pablo\appdata\local\programs\python\python36-32\lib\site-packages\setuptools\msvc.py", line 172, in msvc14_get_vc_env return EnvironmentInfo(plat_spec, vc_min_ver=14.0).return_env() File "c:\users\pablo\appdata\local\programs\python\python36-32\lib\site-packages\setuptools\msvc.py", line 771, in init self.si = SystemInfo(self.ri, vc_ver) File "c:\users\pablo\appdata\local\programs\python\python36-32\lib\site-packages\setuptools\msvc.py", line 480, in init raise distutils.errors.DistutilsPlatformError(err) distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "", line 1, in File "C:\Users\pablo\AppData\Local\Temp\pip-install-p0dcir5m\rpy2\setup.py", line 184, in

'rpy2': ['doc/source/rpy2_logo.png', ]} File "c:\users\pablo\appdata\local\programs\python\python36-32\lib\distutils\core.py",

line 108, in setup _setup_distribution = dist = klass(attrs) File "c:\users\pablo\appdata\local\programs\python\python36-32\lib\site-packages\setuptools\dist.py", line 315, in init self.fetch_build_eggs(attrs['setup_requires']) File "c:\users\pablo\appdata\local\programs\python\python36-32\lib\site-packages\setuptools\dist.py", line 361, in fetch_build_eggs replace_conflicting=True, File "c:\users\pablo\appdata\local\programs\python\python36-32\lib\site-packages\pkg_resources__init__.py", line 850, in resolve dist = best[req.key] = env.best_match(req, ws, installer) File "c:\users\pablo\appdata\local\programs\python\python36-32\lib\site-packages\pkg_resources__init__.py", line 1122, in best_match return self.obtain(req, installer) File "c:\users\pablo\appdata\local\programs\python\python36-32\lib\site-packages\pkg_resources__init__.py", line 1134, in obtain return installer(requirement) File "c:\users\pablo\appdata\local\programs\python\python36-32\lib\site-packages\setuptools\dist.py", line 429, in fetch_build_egg return cmd.easy_install(req) File "c:\users\pablo\appdata\local\programs\python\python36-32\lib\site-packages\setuptools\command\easy_install.py", line 665, in easy_install return self.install_item(spec, dist.location, tmpdir, deps) File "c:\users\pablo\appdata\local\programs\python\python36-32\lib\site-packages\setuptools\command\easy_install.py", line 695, in install_item dists = self.install_eggs(spec, download, tmpdir) File "c:\users\pablo\appdata\local\programs\python\python36-32\lib\site-packages\setuptools\command\easy_install.py", line 876, in install_eggs return self.build_and_install(setup_script, setup_base) File "c:\users\pablo\appdata\local\programs\python\python36-32\lib\site-packages\setuptools\command\easy_install.py", line 1115, in build_and_install self.run_setup(setup_script, setup_base, args) File "c:\users\pablo\appdata\local\programs\python\python36-32\lib\site-packages\setuptools\command\easy_install.py", line 1101, in run_setup run_setup(setup_script, args) File "c:\users\pablo\appdata\local\programs\python\python36-32\lib\site-packages\setuptools\sandbox.py", line 251, in run_setup raise File "c:\users\pablo\appdata\local\programs\python\python36-32\lib\contextlib.py", line 100, in exit self.gen.throw(type, value, traceback) File "c:\users\pablo\appdata\local\programs\python\python36-32\lib\site-packages\setuptools\sandbox.py", line 198, in setup_context yield File "c:\users\pablo\appdata\local\programs\python\python36-32\lib\contextlib.py", line 100, in exit self.gen.throw(type, value, traceback) File "c:\users\pablo\appdata\local\programs\python\python36-32\lib\site-packages\setuptools\sandbox.py", line 169, in save_modules saved_exc.resume() File "c:\users\pablo\appdata\local\programs\python\python36-32\lib\site-packages\setuptools\sandbox.py", line 144, in resume six.reraise(type, exc, self._tb) File "c:\users\pablo\appdata\local\programs\python\python36-32\lib\site-packages\pkg_resources_vendor\six.py", line 685, in reraise raise value.with_traceback(tb) File "c:\users\pablo\appdata\local\programs\python\python36-32\lib\site-packages\setuptools\sandbox.py", line 157, in save_modules yield saved File "c:\users\pablo\appdata\local\programs\python\python36-32\lib\site-packages\setuptools\sandbox.py", line 198, in setup_context yield File "c:\users\pablo\appdata\local\programs\python\python36-32\lib\site-packages\setuptools\sandbox.py", line 248, in run_setup DirectorySandbox(setup_dir).run(runner) File "c:\users\pablo\appdata\local\programs\python\python36-32\lib\site-packages\setuptools\sandbox.py", line 278, in run return func() File "c:\users\pablo\appdata\local\programs\python\python36-32\lib\site-packages\setuptools\sandbox.py", line 246, in runner _execfile(setup_script, ns) File "c:\users\pablo\appdata\local\programs\python\python36-32\lib\site-packages\setuptools\sandbox.py", line 47, in _execfile exec(code, globals, locals) File "C:\Users\pablo\AppData\Local\Temp\easy_install-uj2tljdw\cffi-1.12.3\setup.py", line 127, in using R's own C-API through either: File "C:\Users\pablo\AppData\Local\Temp\easy_install-uj2tljdw\cffi-1.12.3\setup.py", line 105, in uses_msvc else: File "c:\users\pablo\appdata\local\programs\python\python36-32\lib\distutils\command\config.py", line 227, in try_compile self._compile(body, headers, include_dirs, lang) File "c:\users\pablo\appdata\local\programs\python\python36-32\lib\distutils\command\config.py", line 133, in _compile self.compiler.compile([src], include_dirs=include_dirs) File "c:\users\pablo\appdata\local\programs\python\python36-32\lib\distutils_msvccompiler.py", line 304, in compile self.initialize() File "c:\users\pablo\appdata\local\programs\python\python36-32\lib\distutils_msvccompiler.py", line 197, in initialize vc_env = _get_vc_env(plat_spec) File "c:\users\pablo\appdata\local\programs\python\python36-32\lib\site-packages\setuptools\msvc.py", line 172, in msvc14_get_vc_env return EnvironmentInfo(plat_spec, vc_min_ver=14.0).return_env() File "c:\users\pablo\appdata\local\programs\python\python36-32\lib\site-packages\setuptools\msvc.py", line 771, in init self.si = SystemInfo(self.ri, vc_ver) File "c:\users\pablo\appdata\local\programs\python\python36-32\lib\site-packages\setuptools\msvc.py", line 480, in init raise distutils.errors.DistutilsPlatformError(err) distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools ---------------------------------------- ERROR: Command "python setup.py egg_info" failed with error code 1 in C:\Users\pablo\AppData\Local\Temp\pip-install-p0dcir5m\rpy2\

2

2 Answers

1
votes

From the looks of it you are missing Microsoft Visual Build Tools. Try installing it: https://visualstudio.microsoft.com/visual-cpp-build-tools/

Then, restart your computer and update setup tools.

pip install --upgrade setuptools 

Once that it done, try installing rpy2 again.

Hope this help!

0
votes

you can download the binary file of rpy2 from https://www.lfd.uci.edu/~gohlke/pythonlibs/ by searching it in the web page and use pip install 'that binary file' download binary file according to your python version