rpy2 install on windows 7

前端 未结 9 895
轮回少年
轮回少年 2020-11-27 02:50

I\'m trying to install rpy2 on my computer, but I wasn\'t able to do it.

I downloaded the source package and I tryed to install Rpy2 (rpy2-2.3.2) using the command <

9条回答
  •  抹茶落季
    2020-11-27 03:16

    EDIT Finally I managed to get it to work!!! See below:

    I have been banging my head to get this to work and still haven't figured it out completely. What I have found out is that the error

    'sh' is not recognized as an internal or external command, operable program or batch file

    is caused by the absence of mingw and Rtools (and other unix like helper programs). (http://sourceforge.net/p/rpy/mailman/message/26549197/)

    I went passed this stage by installing Rtools (http://cran.r-project.org/bin/windows/Rtools/) and mingw (http://sourceforge.net/projects/mingw-w64/) (But since the mingw-w64 project on sourceforge.net is moving to mingw-w64.org i suggest to use mingw-w64.org)

    I went passed the R.exe CMD config --ldflags error but got stuck with

    TypeError: object of type 'NoneType' has no len()

    error. I am still searching for a solution!!

    Hope this helps someone at some point.

    UPDATE : So it seems that there are couple of problems associated with the installation. The setup.py is not able to find the correct version of R and the compilers have issues.

    So, the way to proceed :

    1. Download the source code from https://pypi.python.org/pypi/rpy2.
    2. Update your environment variables - In the user variables
      • PATH : append the path to ur R installation eg ;C:\Program Files\R\R-3.0.2\bin\x64
      • R_HOME : a new variable with path to R: C:\Program Files\R\R-3.0.2
      • R_USER : user user name eg john
    3. Install Rtools (http://cran.r-project.org/bin/windows/Rtools/) and mingw (http://mingw-w64.org)
    4. around line 123 before

      return self._version I added self._version = [3, 0] to force the version to be 3.0 (may be someone can solve this better)

    5. In the file unixccompiler.py either in python27/lib/distutils or in my case C:\Users(user_name)\AppData\Local\Continuum\Anaconda\Lib\distutils comment line 227

    compiler = os.path.basename(sysconfig.get_config_var("CC")) with # (#compiler = os.path.basename(sysconfig.get_config_var("CC")))

    and add line

    compiler = 'gcc'

    Some other things - use the command prompt cmd for installing. Use

    python setup.py build install

    Install the Rtools and mingw accepting all defaults. In Rtools select the

    extra to build 64 bit R

    and

    edit the system PATH

    Thats it!! Got it to work..

    Hope this helps!!

提交回复
热议问题