New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows Support #54

Closed
jankatins opened this Issue Jan 19, 2015 · 29 comments

Comments

Projects
None yet
8 participants
@jankatins
Contributor

jankatins commented Jan 19, 2015

It would be nice to prepare a package for rzmq and irkernel, so that windows user can install them without setting up a mingw environment. Or upload them to cran :-)

I did get it to install the 64 bit version:

  • install.packages('RCurl') and library(devtools)
  • compile zeromg with a mingw by following this howto: http://zeromq.org/docs:windows-installations#toc2. I changed Makefile to remove perf and test from SUBDIRS to make compiling faster. This builds a 64bit libzmq.dll, but no 32 bit... I couldn't get it to compile using the rtools (setting the path to c:/rtools/bin and using C:\data\downloads\zeromq-4.0.5\zeromq-4.0.5>sh configure --prefix=C:/rtools/zeromq build_alias=x86-mingw32 "CFLAGS=-m32" "CXXFLAGS=-m32" "LDFLAGS=-m32") and also not the 32bit version with the above mingw (passing in "CFLAGS=-m32" "CXXFLAGS=-m32" "LDFLAGS=-m32" to configure...)
  • clone armstrtw/rzmq and git submodule init/update to get inst\cppzmq\zmq.hpp. Also copied zmq.h from the compiled zeromq folder into that dir, because I didn't know how to find the usr/local/include folder in rtools...
  • copied libzmq.dll together with libgcc_s_sjlj-1.dll and libstdc++-6.dll into a lot of subfolders of C:\Rtools\gcc-4.6.3 (*\bin, *\lib; not sure which was the correct one in the end) until the following worked:
  • in rzmq folder: C:/PROGRA~1/R/R-31~1.2/bin/x64/R --vanilla CMD INSTALL %CD% --library="C:/portabel/Rlibs" --no-multiarch
  • install_github("takluyver/IRdisplay")
  • clone takluyver/IRkernel and in irkernel again: C:/PROGRA~1/R/R-31~1.2/bin/x64/R --vanilla CMD INSTALL %CD% --library="C:/portabel/Rlibs" --no-multiarch
  • run C:/PROGRA~1/R/R-31~1.2/bin/x64/R and then IRkernel::installspec()
  • running a v3 ipython notebook (from git yesterday) with a r kernel didn't work at first, as the R started by ipython notebook was 32bit and zmq wasn't installed in that version (see above...), so modified the .ipython\kernels\ir\kernel.json to read {"argv": ["R","--arch", "x64", "-e","IRkernel::main()","--args","{connection_file}"], (-> added "--arch", "x64",). I couldn't find a way to set this the default R, but that's probably just again missing google foo on my side :-( Next time I will simple install only 64bit R and not both.... [EDIT: it's probably enough to setx R_ARCH x64]

And yay: there was an R kernel and I can run R code in the notebook :-)

The above was brought to you by 6 hours poking around and a lot of trial and error in the middle of the night, numerous google searches and now not enough sleep but neverless a happy R kernel user :-) Thanks a lot for your work!

@takluyver

This comment has been minimized.

Show comment
Hide comment
@takluyver

takluyver Jan 19, 2015

Member

Thanks for your hard work on this!

I think the most useful thing would be to contribute the rzmq libraries you compiled to CRAN so that other Windows users can easily install them. @armstrtw, any pointers on how to do that?

Member

takluyver commented Jan 19, 2015

Thanks for your hard work on this!

I think the most useful thing would be to contribute the rzmq libraries you compiled to CRAN so that other Windows users can easily install them. @armstrtw, any pointers on how to do that?

@jankatins

This comment has been minimized.

Show comment
Hide comment
@jankatins

jankatins Jan 20, 2015

Contributor

Reading some twitter comments on CRAN, I'd rather not... :-/

Contributor

jankatins commented Jan 20, 2015

Reading some twitter comments on CRAN, I'd rather not... :-/

@rgbkrk

This comment has been minimized.

Show comment
Hide comment
@rgbkrk

rgbkrk Jan 20, 2015

Contributor

@JanSchulz Ha! I just read the blog post related to that and no longer care that I'm going to have to maintain a fork of rzmq for the moment.

Contributor

rgbkrk commented Jan 20, 2015

@JanSchulz Ha! I just read the blog post related to that and no longer care that I'm going to have to maintain a fork of rzmq for the moment.

@armstrtw

This comment has been minimized.

Show comment
Hide comment
@armstrtw

armstrtw Jan 21, 2015

yeah. I hear you on working w/ CRAN (http://r.789695.n4.nabble.com/Request-for-help-with-UBSAN-and-total-absense-of-CRAN-response-td4701735.html). So, for CRAN to support a windows build, we really need to compile zmq libs w/ Rtools. If anyone wants to take that on, I'd be grateful. I no longer keep a windows dev machine around (because I consider it a dead architecture), so I'm not really in a position to do this myself. I did see a post somewhere about a person cross compiling some libraries on linux for win64, so that might be a possibility if a straight compile w/ Rtools/mingw isn't possible.

armstrtw commented Jan 21, 2015

yeah. I hear you on working w/ CRAN (http://r.789695.n4.nabble.com/Request-for-help-with-UBSAN-and-total-absense-of-CRAN-response-td4701735.html). So, for CRAN to support a windows build, we really need to compile zmq libs w/ Rtools. If anyone wants to take that on, I'd be grateful. I no longer keep a windows dev machine around (because I consider it a dead architecture), so I'm not really in a position to do this myself. I did see a post somewhere about a person cross compiling some libraries on linux for win64, so that might be a possibility if a straight compile w/ Rtools/mingw isn't possible.

@jankatins

This comment has been minimized.

Show comment
Hide comment
@jankatins

jankatins Jan 21, 2015

Contributor

I've tried to compile it with rtools, but it froze in the LD step (need to redo the build to get the log... No error Message). I've no clue how to debug this: any pointers?

IMO it would already be enough to put the windows packages and a howto on installing them on a website...

Contributor

jankatins commented Jan 21, 2015

I've tried to compile it with rtools, but it froze in the LD step (need to redo the build to get the log... No error Message). I've no clue how to debug this: any pointers?

IMO it would already be enough to put the windows packages and a howto on installing them on a website...

@edwindj

This comment has been minimized.

Show comment
Hide comment
@edwindj

edwindj Jan 21, 2015

Another option besides CRAN may be to use AppVeyor (appveyor.com): it allows for free automated builds on Windows of public github repos (like a travis ci for windows) and publishing the build artifacts back to github releases.

edwindj commented Jan 21, 2015

Another option besides CRAN may be to use AppVeyor (appveyor.com): it allows for free automated builds on Windows of public github repos (like a travis ci for windows) and publishing the build artifacts back to github releases.

@armstrtw

This comment has been minimized.

Show comment
Hide comment
@armstrtw

armstrtw Jan 21, 2015

Let me have another crack at Rtools. by far the best option is just to have a proper CRAN package for windows. If I can't get it to work, let's explore the options you all have mentioned.

armstrtw commented Jan 21, 2015

Let me have another crack at Rtools. by far the best option is just to have a proper CRAN package for windows. If I can't get it to work, let's explore the options you all have mentioned.

@jankatins

This comment has been minimized.

Show comment
Hide comment
@jankatins

jankatins Jan 21, 2015

Contributor

Not sure yet what is happening, but:

  • extract zmq sources (latest stable)
  • edit @BUILD_PGM_FALSE@SUBDIRS = src to only build zmq and not docs/tests/whatever...
  • run configure (with rtools\bin in path): sh configure --prefix=C:/rtools/zeromq build_alias=i686-w64-mingw32 "CFLAGS=-m32" "CXXFLAGS=-m32" "LDFLAGS=-m32"
  • run make

It will hang after printing CXXLD libzmq.la with a subprocess (actually it's not a direct child of make anymore in procexplorer...) of make/sh reading "C:\Windows\system32\cmd.exe //c echo .libs/". Killing that cmd will finish make, but no dll is produced and the following error is shown:

[...]
  CXX    libzmq_la-raw_encoder.lo
  CXXLD  libzmq.la

*** Warning: linker path does not have real file for library -lpthread.
*** I have the capability to make that library automatically link in when
*** you link to this library.  But I can only do this if you have a
*** shared version of the library, which you do not appear to have
*** because I did check the linker path looking for a file starting
*** with libpthread and none of the candidates passed a file format test
*** using a file magic. Last file checked: c:/rtools/gcc-4.6.3/bin/../lib/gcc/i6
86-w64-mingw32/4.6.3/../../../libpthread.a

*** Warning: linker path does not have real file for library -liphlpapi.
*** I have the capability to make that library automatically link in when
*** you link to this library.  But I can only do this if you have a
*** shared version of the library, which you do not appear to have
*** because I did check the linker path looking for a file starting
*** with libiphlpapi and none of the candidates passed a file format test
*** using a file magic. Last file checked: c:/rtools/gcc-4.6.3/bin/../lib/gcc/i6
86-w64-mingw32/4.6.3/../../../../i686-w64-mingw32/lib/libiphlpapi.a

*** Warning: linker path does not have real file for library -lrpcrt4.
*** I have the capability to make that library automatically link in when
*** you link to this library.  But I can only do this if you have a
*** shared version of the library, which you do not appear to have
*** because I did check the linker path looking for a file starting
*** with librpcrt4 and none of the candidates passed a file format test
*** using a file magic. Last file checked: c:/rtools/gcc-4.6.3/bin/../lib/gcc/i6
86-w64-mingw32/4.6.3/../../../../i686-w64-mingw32/lib/librpcrt4.a

*** Warning: linker path does not have real file for library -lws2_32.
*** I have the capability to make that library automatically link in when
*** you link to this library.  But I can only do this if you have a
*** shared version of the library, which you do not appear to have
*** because I did check the linker path looking for a file starting
*** with libws2_32 and none of the candidates passed a file format test
*** using a file magic. Last file checked: c:/rtools/gcc-4.6.3/bin/../lib/gcc/i6
86-w64-mingw32/4.6.3/../../../../i686-w64-mingw32/lib/libws2_32.a
*** The inter-library dependencies that have been dropped here will be
*** automatically added whenever a program is linked with this library
*** or is declared to -dlopen it.

*** Since this library must not contain undefined symbols,
*** because either the platform does not support them or
*** it was explicitly requested with -no-undefined,
*** libtool will only create a static version of it.
make[2]: Leaving directory `/cygdrive/c/Rtools/zeromq-4.0.5/src'
make[1]: Leaving directory `/cygdrive/c/Rtools/zeromq-4.0.5/src'
make[1]: Entering directory `/cygdrive/c/Rtools/zeromq-4.0.5'
make[1]: Nothing to be done for `all-am'.
make[1]: Leaving directory `/cygdrive/c/Rtools/zeromq-4.0.5'
Contributor

jankatins commented Jan 21, 2015

Not sure yet what is happening, but:

  • extract zmq sources (latest stable)
  • edit @BUILD_PGM_FALSE@SUBDIRS = src to only build zmq and not docs/tests/whatever...
  • run configure (with rtools\bin in path): sh configure --prefix=C:/rtools/zeromq build_alias=i686-w64-mingw32 "CFLAGS=-m32" "CXXFLAGS=-m32" "LDFLAGS=-m32"
  • run make

It will hang after printing CXXLD libzmq.la with a subprocess (actually it's not a direct child of make anymore in procexplorer...) of make/sh reading "C:\Windows\system32\cmd.exe //c echo .libs/". Killing that cmd will finish make, but no dll is produced and the following error is shown:

[...]
  CXX    libzmq_la-raw_encoder.lo
  CXXLD  libzmq.la

*** Warning: linker path does not have real file for library -lpthread.
*** I have the capability to make that library automatically link in when
*** you link to this library.  But I can only do this if you have a
*** shared version of the library, which you do not appear to have
*** because I did check the linker path looking for a file starting
*** with libpthread and none of the candidates passed a file format test
*** using a file magic. Last file checked: c:/rtools/gcc-4.6.3/bin/../lib/gcc/i6
86-w64-mingw32/4.6.3/../../../libpthread.a

*** Warning: linker path does not have real file for library -liphlpapi.
*** I have the capability to make that library automatically link in when
*** you link to this library.  But I can only do this if you have a
*** shared version of the library, which you do not appear to have
*** because I did check the linker path looking for a file starting
*** with libiphlpapi and none of the candidates passed a file format test
*** using a file magic. Last file checked: c:/rtools/gcc-4.6.3/bin/../lib/gcc/i6
86-w64-mingw32/4.6.3/../../../../i686-w64-mingw32/lib/libiphlpapi.a

*** Warning: linker path does not have real file for library -lrpcrt4.
*** I have the capability to make that library automatically link in when
*** you link to this library.  But I can only do this if you have a
*** shared version of the library, which you do not appear to have
*** because I did check the linker path looking for a file starting
*** with librpcrt4 and none of the candidates passed a file format test
*** using a file magic. Last file checked: c:/rtools/gcc-4.6.3/bin/../lib/gcc/i6
86-w64-mingw32/4.6.3/../../../../i686-w64-mingw32/lib/librpcrt4.a

*** Warning: linker path does not have real file for library -lws2_32.
*** I have the capability to make that library automatically link in when
*** you link to this library.  But I can only do this if you have a
*** shared version of the library, which you do not appear to have
*** because I did check the linker path looking for a file starting
*** with libws2_32 and none of the candidates passed a file format test
*** using a file magic. Last file checked: c:/rtools/gcc-4.6.3/bin/../lib/gcc/i6
86-w64-mingw32/4.6.3/../../../../i686-w64-mingw32/lib/libws2_32.a
*** The inter-library dependencies that have been dropped here will be
*** automatically added whenever a program is linked with this library
*** or is declared to -dlopen it.

*** Since this library must not contain undefined symbols,
*** because either the platform does not support them or
*** it was explicitly requested with -no-undefined,
*** libtool will only create a static version of it.
make[2]: Leaving directory `/cygdrive/c/Rtools/zeromq-4.0.5/src'
make[1]: Leaving directory `/cygdrive/c/Rtools/zeromq-4.0.5/src'
make[1]: Entering directory `/cygdrive/c/Rtools/zeromq-4.0.5'
make[1]: Nothing to be done for `all-am'.
make[1]: Leaving directory `/cygdrive/c/Rtools/zeromq-4.0.5'
@jankatins

This comment has been minimized.

Show comment
Hide comment
@jankatins

jankatins Jan 25, 2015

Contributor

It seems that the mingw compiled libs work in rtools compiled packages, so maybe simple include both versions and copy them into the build process in a windows specific makefile?

Contributor

jankatins commented Jan 25, 2015

It seems that the mingw compiled libs work in rtools compiled packages, so maybe simple include both versions and copy them into the build process in a windows specific makefile?

@stonebig

This comment has been minimized.

Show comment
Hide comment
@stonebig

stonebig Feb 22, 2015

lost cause ? where did you put your compiled libs (32 and 64 bit) ?

stonebig commented Feb 22, 2015

lost cause ? where did you put your compiled libs (32 and 64 bit) ?

@takluyver

This comment has been minimized.

Show comment
Hide comment
@takluyver

takluyver Mar 4, 2015

Member

You might want to try r2_kernel, an alternative kernel using rpy2 to drive R. rpy2 has some of its own issues on Windows, but I think it at least basically works.

Member

takluyver commented Mar 4, 2015

You might want to try r2_kernel, an alternative kernel using rpy2 to drive R. rpy2 has some of its own issues on Windows, but I think it at least basically works.

@stonebig

This comment has been minimized.

Show comment
Hide comment
@stonebig

stonebig Mar 5, 2015

hi @takluyver ,

Could you give an example of what should look like the .ipython\kernels\R\kernel.json file ?
(If it's the exact place)

stonebig commented Mar 5, 2015

hi @takluyver ,

Could you give an example of what should look like the .ipython\kernels\R\kernel.json file ?
(If it's the exact place)

@takluyver

This comment has been minimized.

Show comment
Hide comment
@takluyver
Member

takluyver commented Mar 5, 2015

@stonebig

This comment has been minimized.

Show comment
Hide comment
@stonebig

stonebig Mar 5, 2015

well,

I would have prefered a wheel package.
The setup doesn't seem to create a 'kernel.json'

Launching the notebooks give this

r2_test01

trying on qtconsole gives this:

r2_test02_qt

I suspect I didn't apply the suggested procedure well.

if I manually create a kernels\r2\kernel.json with

{"argv":[sys.executable,"-m","r2_kernel", "-f", "{connection_file}"],
 "display_name":"R",
 "language":"R"
}

things are even worse

  File "D:\WinPython\basedir34\buildFlavorRfull\winpython-3.4.2.amd64\python-3.4
.2.amd64\lib\json\decoder.py", line 343, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "D:\WinPython\basedir34\buildFlavorRfull\winpython-3.4.2.amd64\python-3.4
.2.amd64\lib\json\decoder.py", line 361, in raw_decode
    raise ValueError(errmsg("Expecting value", s, err.value)) from None
ValueError: Expecting value: line 1 column 10 (char 9)

If you suspect this is an IPython bug, please report it at:
    https://github.com/ipython/ipython/issues
or send an email to the mailing list at ipython-dev@scipy.org

You can print a more detailed traceback right now with "%tb", or use "%debug"
to interactively debug it.

Extra-detailed tracebacks for bug-reporting purposes can be enabled via:
    c.Application.verbose_crash=True

I fear I screw up too much for you to have an idea how I messed so well

stonebig commented Mar 5, 2015

well,

I would have prefered a wheel package.
The setup doesn't seem to create a 'kernel.json'

Launching the notebooks give this

r2_test01

trying on qtconsole gives this:

r2_test02_qt

I suspect I didn't apply the suggested procedure well.

if I manually create a kernels\r2\kernel.json with

{"argv":[sys.executable,"-m","r2_kernel", "-f", "{connection_file}"],
 "display_name":"R",
 "language":"R"
}

things are even worse

  File "D:\WinPython\basedir34\buildFlavorRfull\winpython-3.4.2.amd64\python-3.4
.2.amd64\lib\json\decoder.py", line 343, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "D:\WinPython\basedir34\buildFlavorRfull\winpython-3.4.2.amd64\python-3.4
.2.amd64\lib\json\decoder.py", line 361, in raw_decode
    raise ValueError(errmsg("Expecting value", s, err.value)) from None
ValueError: Expecting value: line 1 column 10 (char 9)

If you suspect this is an IPython bug, please report it at:
    https://github.com/ipython/ipython/issues
or send an email to the mailing list at ipython-dev@scipy.org

You can print a more detailed traceback right now with "%tb", or use "%debug"
to interactively debug it.

Extra-detailed tracebacks for bug-reporting purposes can be enabled via:
    c.Application.verbose_crash=True

I fear I screw up too much for you to have an idea how I messed so well

@takluyver

This comment has been minimized.

Show comment
Hide comment
@takluyver

takluyver Mar 5, 2015

Member

In the first screenshots, it appears to be working - at least, there is definitely R code being run. Why do you think there was a problem?

If you create your own kernel.json, it shouldn't literally contain sys.executable - that's a Python variable that points to the Python interpreter itself. On my system, the kernel.json looks like this:

{"argv": ["/usr/bin/python3", "-m", "r2_kernel", "-f", "{connection_file}"],
 "display_name": "R",
 "language": "R"}

On your system, you probably need to replace /usr/bin/python3 with something like C:\Python34\Python.exe - wherever your Python executable is. But if the 'setup.py install works correctly, it should create this automatically.

Because of the way wheels work, it is not possible to install the kernelspec from a wheel package. But it is on PyPI, so pip install r2_kernel is possible.

Member

takluyver commented Mar 5, 2015

In the first screenshots, it appears to be working - at least, there is definitely R code being run. Why do you think there was a problem?

If you create your own kernel.json, it shouldn't literally contain sys.executable - that's a Python variable that points to the Python interpreter itself. On my system, the kernel.json looks like this:

{"argv": ["/usr/bin/python3", "-m", "r2_kernel", "-f", "{connection_file}"],
 "display_name": "R",
 "language": "R"}

On your system, you probably need to replace /usr/bin/python3 with something like C:\Python34\Python.exe - wherever your Python executable is. But if the 'setup.py install works correctly, it should create this automatically.

Because of the way wheels work, it is not possible to install the kernelspec from a wheel package. But it is on PyPI, so pip install r2_kernel is possible.

@stonebig

This comment has been minimized.

Show comment
Hide comment
@stonebig

stonebig Mar 5, 2015

so, try2, on my specific winpython case.
kernel.json now works like the two other way of trying (strange message and R graphic window) with this:

{"argv": ["python", "-m", "r2_kernel", "-f", "{connection_file}"],
 "display_name": "R",
 "language": "R"}

re-trying with pip install r2_kernel.... (it upgrades me to IPython3.0.0).... issues related to another subject, will have to retry from scratch.

stonebig commented Mar 5, 2015

so, try2, on my specific winpython case.
kernel.json now works like the two other way of trying (strange message and R graphic window) with this:

{"argv": ["python", "-m", "r2_kernel", "-f", "{connection_file}"],
 "display_name": "R",
 "language": "R"}

re-trying with pip install r2_kernel.... (it upgrades me to IPython3.0.0).... issues related to another subject, will have to retry from scratch.

@takluyver

This comment has been minimized.

Show comment
Hide comment
@takluyver

takluyver Mar 5, 2015

Member

strange message

Possibly it's showing lower level messages that R would normally hide. They don't seem to indicate any problem.

and R graphic window

takluyver/r2_kernel#1 - I guess it's to do with the way rpy2 initialises R. Hopefully fixable.

it upgrades me to IPython3.0.0

Yeah, this requires IPython 3.

Member

takluyver commented Mar 5, 2015

strange message

Possibly it's showing lower level messages that R would normally hide. They don't seem to indicate any problem.

and R graphic window

takluyver/r2_kernel#1 - I guess it's to do with the way rpy2 initialises R. Hopefully fixable.

it upgrades me to IPython3.0.0

Yeah, this requires IPython 3.

@jankatins

This comment has been minimized.

Show comment
Hide comment
@jankatins

jankatins Mar 21, 2015

Contributor

So, my latest work is now this:

  • download and unpack zeromq windows sources: http://download.zeromq.org/zeromq-4.0.5.zip
  • open cmd and change into the zeromq sources: in my case it's in C:\rtools\zeromq-4.0.5/src
  • the next assumes that you have rtools gcc in path!
  • execute c:\Rtools\zeromq-4.0.5\src>g++ -m32 -std=c++0x -DZMQ_STATIC -DFD_SETSIZE24 -D_REENTRANT -D_THREAD_SAFE -DZMQ_FORCE_SELECT -DZMQ_HAVE_WINDOWS -c *.cpp and ar r libzmq.a *.o (from http://grokbase.com/t/zeromq/zeromq-dev/136sg6zk4s/build-zmq-as-static-library-under-mingw)
  • copy the libzmq.a file somewhere (this is the 32bit version)
  • delete all *.o and libzmq.la in zeromq-4.0.5/src
  • execute c:\Rtools\zeromq-4.0.5\src>g++ -m64 -std=c++0x -DZMQ_STATIC -DFD_SETSIZE24 -D_REENTRANT -D_THREAD_SAFE -DZMQ_FORCE_SELECT -DZMQ_HAVE_WINDOWS -c *.cpp and ar r libzmq.a *.o
  • copy the libzmq.a file somewhere (this is the 64bit version)

I added some win specific makefile and the *.a files into subdirs src\win\i386|x64 and also added src\win\zmq.h to the rzmq package (modeled after https://github.com/sneumann/mzR/blob/master/src/Makevars.win)

Makefile.win

CXX_STD = CXX11
PKG_CPPFLAGS = -I../inst/cppzmq -I./win -DZMQ_STATIC
PKG_LIBS = -L./win$(R_ARCH) -lzmq -lws2_32

and then ran

  • R CMD build rzmq
  • R CMD check rzmq_0.7.7.tar.gz
  • R CMD INSTALL --build --compile-both rzmq -> and you have an *.zip

I tested the package (more or less: opened a notebook and run a print("hello world") and that worked.

And this worked.

I will send a PR to rzmq

Contributor

jankatins commented Mar 21, 2015

So, my latest work is now this:

  • download and unpack zeromq windows sources: http://download.zeromq.org/zeromq-4.0.5.zip
  • open cmd and change into the zeromq sources: in my case it's in C:\rtools\zeromq-4.0.5/src
  • the next assumes that you have rtools gcc in path!
  • execute c:\Rtools\zeromq-4.0.5\src>g++ -m32 -std=c++0x -DZMQ_STATIC -DFD_SETSIZE24 -D_REENTRANT -D_THREAD_SAFE -DZMQ_FORCE_SELECT -DZMQ_HAVE_WINDOWS -c *.cpp and ar r libzmq.a *.o (from http://grokbase.com/t/zeromq/zeromq-dev/136sg6zk4s/build-zmq-as-static-library-under-mingw)
  • copy the libzmq.a file somewhere (this is the 32bit version)
  • delete all *.o and libzmq.la in zeromq-4.0.5/src
  • execute c:\Rtools\zeromq-4.0.5\src>g++ -m64 -std=c++0x -DZMQ_STATIC -DFD_SETSIZE24 -D_REENTRANT -D_THREAD_SAFE -DZMQ_FORCE_SELECT -DZMQ_HAVE_WINDOWS -c *.cpp and ar r libzmq.a *.o
  • copy the libzmq.a file somewhere (this is the 64bit version)

I added some win specific makefile and the *.a files into subdirs src\win\i386|x64 and also added src\win\zmq.h to the rzmq package (modeled after https://github.com/sneumann/mzR/blob/master/src/Makevars.win)

Makefile.win

CXX_STD = CXX11
PKG_CPPFLAGS = -I../inst/cppzmq -I./win -DZMQ_STATIC
PKG_LIBS = -L./win$(R_ARCH) -lzmq -lws2_32

and then ran

  • R CMD build rzmq
  • R CMD check rzmq_0.7.7.tar.gz
  • R CMD INSTALL --build --compile-both rzmq -> and you have an *.zip

I tested the package (more or less: opened a notebook and run a print("hello world") and that worked.

And this worked.

I will send a PR to rzmq

@jankatins

This comment has been minimized.

Show comment
Hide comment
@jankatins

jankatins Mar 22, 2015

Contributor

If uploaded the windows packages for R 3.1.x:

install.packages("rzmq", repos="http://janschulz.github.io/drat")
Contributor

jankatins commented Mar 22, 2015

If uploaded the windows packages for R 3.1.x:

install.packages("rzmq", repos="http://janschulz.github.io/drat")
@stonebig

This comment has been minimized.

Show comment
Hide comment
@stonebig

stonebig Mar 22, 2015

well:

  • it apparently works,
  • I don't have anymore pop-up as with r2_kernel (takluyver/r2_kernel#1)
  • it apparently can share prime time with r2_kernel, if I slightly modify my r2 kernel (in kernels\r2\kernel.json):
{"argv": ["python.exe", "-m", "r2_kernel", "-f", "{connection_file}"], "display_name": "R (r2 kernel)", "language": "R"}

r-2-r

The tiny deception, or maybe I didn't parametrize right, is that it still truncates the Dataframes to 78 characters, which is sad as we can have a nicer html display with R magic:

  • r magic look:
    r_magic_cool
  • r kernel (and r2_kernel) look:
    r_magicless_kernels

Nevertheless, Danke sehr !

stonebig commented Mar 22, 2015

well:

  • it apparently works,
  • I don't have anymore pop-up as with r2_kernel (takluyver/r2_kernel#1)
  • it apparently can share prime time with r2_kernel, if I slightly modify my r2 kernel (in kernels\r2\kernel.json):
{"argv": ["python.exe", "-m", "r2_kernel", "-f", "{connection_file}"], "display_name": "R (r2 kernel)", "language": "R"}

r-2-r

The tiny deception, or maybe I didn't parametrize right, is that it still truncates the Dataframes to 78 characters, which is sad as we can have a nicer html display with R magic:

  • r magic look:
    r_magic_cool
  • r kernel (and r2_kernel) look:
    r_magicless_kernels

Nevertheless, Danke sehr !

@stonebig

This comment has been minimized.

Show comment
Hide comment
@stonebig

stonebig Mar 22, 2015

question for @takluyver : can we hope to have an html look "à la" %R ?

stonebig commented Mar 22, 2015

question for @takluyver : can we hope to have an html look "à la" %R ?

@takluyver

This comment has been minimized.

Show comment
Hide comment
@takluyver

takluyver Mar 22, 2015

Member

See the discussion on #59.

You get a nice HTML view using the %R magic like that because it converts the R data frame to a pandas data frame, and then Python generates the HTML representation. It should be possible to do something similar on the R side.

Member

takluyver commented Mar 22, 2015

See the discussion on #59.

You get a nice HTML view using the %R magic like that because it converts the R data frame to a pandas data frame, and then Python generates the HTML representation. It should be possible to do something similar on the R side.

@stonebig

This comment has been minimized.

Show comment
Hide comment
@stonebig

stonebig Mar 22, 2015

thanks, I didn't notice this discussion before.... so you are going to stop the r2_kernel track ?

stonebig commented Mar 22, 2015

thanks, I didn't notice this discussion before.... so you are going to stop the r2_kernel track ?

@takluyver

This comment has been minimized.

Show comment
Hide comment
@takluyver

takluyver Mar 22, 2015

Member

If @JanSchulz has got the installation issues on Windows sorted out, then there's not much reason to keep r2_kernel going.

Member

takluyver commented Mar 22, 2015

If @JanSchulz has got the installation issues on Windows sorted out, then there's not much reason to keep r2_kernel going.

@kikocorreoso

This comment has been minimized.

Show comment
Hide comment
@kikocorreoso

kikocorreoso Apr 22, 2015

Hi all,

I will try to detail my experience trying to install IRkernel on windows in case it could be useful for others. I used, mainly, the instructions available in the README.md and on the discussions in this issue, but I had to solve some issues. Also, I'm using a computer with a custom windows installation (my corporate computer) so maybe some issues where related to this...

  • I had R v3.1.2 installed but it seems that rzmq is compiled using R v3.1.3 so I installed R v3.1.3 (http://cran.r-project.org/bin/windows/base/old/).
  • I installed Rtools32 as it seems it is compatible with R 3.1.x to 3.2.x. After installing it I tried to load devtools (library(devtools)) in the R console but I got a message saying that the Rtools version (RTools32) was not compatible with the R version I had. So I installed RTools31 (http://cran.r-project.org/bin/windows/Rtools/).
  • Now that you have Rv3.1.3 and RTools31 installed follow the instructions on the README.md file, open a R console and type the following:
# Need RCurl for install_github
install.packages('RCurl')
library(devtools)
install_github('armstrtw/rzmq')
install_github('IRkernel/repr')
install_github('IRkernel/IRdisplay')
install_github('IRkernel/IRkernel')

# Only if you have IPython 3 or above installed:
IRkernel::installspec()
  • All these libraries and their dependencies are installed in the 'R user lib' folder (R_LIBS_USER) but I don't know how to set that on windows. Also, the .ipython/ folder with the ir kernel specification is located in the 'R user lib' folder. If I try to run the ir kernel (ipython console --kernel ir, console can be qtconsole or notebook) it says that IRkernel::main() is not found.Following instructions from here I copied the installed libraries from the R_LIBS_USER to the R 'general' folder (C:\Program Files\R\R-3.1.3\library in my case) and I copied the ir/ folder located in the .ipython/kernels/ folder inside the R_LIBS_USER to the general .ipython/ (ipython-dir, the one obtained running import IPython; IPython.utils.path.get_ipython_dir() in a python console, see here for more info).
  • After that I was able to run ipython notebook and start a notebook with an IR kernel.

It would be great if someone can provide some hints to help with the issues I found and we could create an official windows installation.

I hope it helps.

kikocorreoso commented Apr 22, 2015

Hi all,

I will try to detail my experience trying to install IRkernel on windows in case it could be useful for others. I used, mainly, the instructions available in the README.md and on the discussions in this issue, but I had to solve some issues. Also, I'm using a computer with a custom windows installation (my corporate computer) so maybe some issues where related to this...

  • I had R v3.1.2 installed but it seems that rzmq is compiled using R v3.1.3 so I installed R v3.1.3 (http://cran.r-project.org/bin/windows/base/old/).
  • I installed Rtools32 as it seems it is compatible with R 3.1.x to 3.2.x. After installing it I tried to load devtools (library(devtools)) in the R console but I got a message saying that the Rtools version (RTools32) was not compatible with the R version I had. So I installed RTools31 (http://cran.r-project.org/bin/windows/Rtools/).
  • Now that you have Rv3.1.3 and RTools31 installed follow the instructions on the README.md file, open a R console and type the following:
# Need RCurl for install_github
install.packages('RCurl')
library(devtools)
install_github('armstrtw/rzmq')
install_github('IRkernel/repr')
install_github('IRkernel/IRdisplay')
install_github('IRkernel/IRkernel')

# Only if you have IPython 3 or above installed:
IRkernel::installspec()
  • All these libraries and their dependencies are installed in the 'R user lib' folder (R_LIBS_USER) but I don't know how to set that on windows. Also, the .ipython/ folder with the ir kernel specification is located in the 'R user lib' folder. If I try to run the ir kernel (ipython console --kernel ir, console can be qtconsole or notebook) it says that IRkernel::main() is not found.Following instructions from here I copied the installed libraries from the R_LIBS_USER to the R 'general' folder (C:\Program Files\R\R-3.1.3\library in my case) and I copied the ir/ folder located in the .ipython/kernels/ folder inside the R_LIBS_USER to the general .ipython/ (ipython-dir, the one obtained running import IPython; IPython.utils.path.get_ipython_dir() in a python console, see here for more info).
  • After that I was able to run ipython notebook and start a notebook with an IR kernel.

It would be great if someone can provide some hints to help with the issues I found and we could create an official windows installation.

I hope it helps.

@jankatins

This comment has been minimized.

Show comment
Hide comment
@jankatins

jankatins Apr 22, 2015

Contributor

I think the easiest way to install on windows is currently install.packages(c("rzmq","repr","IRkernel","IRdisplay"), repos="http://irkernel.github.io/") (has packages for 3.1 and 3.2 on windows and the source ones for linux and maybe macosx?) and then install the kernel spec.

@flying-sheep @takluyver Should this be mentioned in the readme?

Contributor

jankatins commented Apr 22, 2015

I think the easiest way to install on windows is currently install.packages(c("rzmq","repr","IRkernel","IRdisplay"), repos="http://irkernel.github.io/") (has packages for 3.1 and 3.2 on windows and the source ones for linux and maybe macosx?) and then install the kernel spec.

@flying-sheep @takluyver Should this be mentioned in the readme?

@kikocorreoso

This comment has been minimized.

Show comment
Hide comment
@kikocorreoso

kikocorreoso Apr 23, 2015

Thanks @JanSchulz

I will try to install it following your instructions on a clean windows 8 box this afternoon at home (w/o the overhead of the corporate windows I'm using now).

I will report the result later.

Thanks.

kikocorreoso commented Apr 23, 2015

Thanks @JanSchulz

I will try to install it following your instructions on a clean windows 8 box this afternoon at home (w/o the overhead of the corporate windows I'm using now).

I will report the result later.

Thanks.

@flying-sheep

This comment has been minimized.

Show comment
Hide comment
@flying-sheep

flying-sheep Apr 23, 2015

Contributor

i think that’s a good idea, if it eases life for people.

Contributor

flying-sheep commented Apr 23, 2015

i think that’s a good idea, if it eases life for people.

jankatins added a commit to jankatins/IRkernel that referenced this issue Apr 23, 2015

Update Readme with new information how to install
Make installing from the supplied packages the new default and
mention that only IPython 3.1 and above is supported.

Closes: IRkernel#54 # windows support
Closes: IRkernel#93 # IPython 3.0 (and probably 2.x) do not work

jankatins added a commit to jankatins/IRkernel that referenced this issue Apr 24, 2015

Update Readme with new information how to install
Make installing from the supplied packages the new default and
mention that only IPython 3.0 and above is supported.

Closes: IRkernel#54 # windows support

jankatins added a commit to jankatins/IRkernel that referenced this issue Apr 25, 2015

Update Readme with new information how to install
Make installing from the supplied packages the new default and
mention that only IPython 3.0 and above is supported.

Closes: IRkernel#54 # windows support

jankatins added a commit to jankatins/IRkernel that referenced this issue Apr 25, 2015

Update Readme with new information how to install
Make installing from the supplied packages the new default and
mention that only IPython 3.0 and above is supported.

Closes: IRkernel#54 # windows support
@jankatins

This comment has been minimized.

Show comment
Hide comment
@jankatins

jankatins Apr 26, 2015

Contributor

Close as the information is in the readme how to get it on windows

Contributor

jankatins commented Apr 26, 2015

Close as the information is in the readme how to get it on windows

@jankatins jankatins closed this Apr 26, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment