Environment Setup - JunjieW/PythonML-DL GitHub Wiki
How to setup Jupyter in Cygwin (Updated 2016/11/02)
0. Cygwin install packages:
make sure install both binary ****and source, or you will probably get compiling errors.
- python
- python-devel (maybe if you download python source, you won't need this)
- libX11-devel
- libfreetype-devel
- pnglib
- (maybe others which were installed with existed packages, you might run into different error message if any missing)
1. In Cygwin, use pip
to install Jupyter and matplotlib
$ pip install jupyter
$ pip install matplotlib
, if you correctly install/download the required package and most importantly the python source from Cygwin package manager, you will be free with headache. What I encountered is error message "Python.h: no such file or directory" at the last stage of compilation when used pip to install matplotlib. That why I mentioned the necessity of choosing source when installing packages.
2. Start Jupyter notebook server
To start the Jupyter notebook server, in Cygwin, type $ jupyter notebook
or without browser $ jupyter notebook --no-browser
(guidance from Jupyter website), then some info will show with a localhost address from which you can access to the notebook. You will see
$ jupyter notebook --no-browser
[I 23:59:12.696 NotebookApp] The port 8888 is already in use, trying another port.
[I 23:59:12.788 NotebookApp] Serving notebooks from local directory: /usr/include/python2.7
[I 23:59:12.788 NotebookApp] 0 active kernels
[I 23:59:12.788 NotebookApp] The Jupyter Notebook is running at: http://localhost:8889/
[I 23:59:12.789 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
Note: if you're not running wiht X11, you will get a warning if you start with the default mode with browser, but it still works.
One more thing to mention is that, the current dir you start Jupyter Notebook server will be the startup folder shown on the Notebook web interface, more guidance can be found in the Jupyter Quick Start Guide.
3. Enjoy
Then you can now open a browser in windows, and use the address shown.
It's not from Cygwin, but the same thing, if you have X11 running with a browser installed in Cygwin, you can also access the notebook from Cygwin, but for now, I don't want to install a browser in Cygwin and start X11 everytime I want to use the notebook)
Install TensorFlow Package
0. New Compilation Problem:
gcc: numpy/core/src/multiarray/numpyos.c
numpy/core/src/multiarray/numpyos.c:18:21: fatal error: xlocale.h: No such file or directory
compilation terminated.
numpy/core/src/multiarray/numpyos.c:18:21: fatal error: xlocale.h: No such file or directory
compilation terminated.
error: Command "gcc -fno-strict-aliasing -ggdb -O2 -pipe -Wimplicit-function-declaration -fdebug-prefix-map=/usr/src/ports/python/python-2.7.12-1.x86_64/build=/usr/src/debug/python-2.7.12-1 -fdebug-prefix-map=/usr/src/ports/python/python-2.7.12-1.x86_64/src/Python-2.7.12=/usr/src/debug/python-2.7.12-1 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DHAVE_NPY_CONFIG_H=1 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -Ibuild/src.cygwin-2.6.0-x86_64-2.7/numpy/core/src/private -Inumpy/core/include -Ibuild/src.cygwin-2.6.0-x86_64-2.7/numpy/core/include/numpy -Inumpy/core/src/private -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/usr/include/python2.7 -Ibuild/src.cygwin-2.6.0-x86_64-2.7/numpy/core/src/private -Ibuild/src.cygwin-2.6.0-x86_64-2.7/numpy/core/src/private -Ibuild/src.cygwin-2.6.0-x86_64-2.7/numpy/core/src/private -c numpy/core/src/multiarray/numpyos.c -o build/temp.cygwin-2.6.0-x86_64-2.7/numpy/core/src/multiarray/numpyos.o" failed with exit status 1
----------------------------------------
Rolling back uninstall of numpy
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-4ndBIo/numpy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-acGV16-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-4ndBIo/numpy/
As you can see, there are some warnings(actually I got lots of them, here I show the last few). Maybe it's not a good idea to do in this way in Cygwin, but will just keep trying.
Try to $ pip install numpy
, but no update done, so try to $ pip install tensorflow
agin. Installation terminates with same error.
Okay, I realize that xlocate.h missing might be caused by the same reason, package missing, but what package. xlocate.h -- maybe X11? Let me check from Cygwin package manager.
True, no X11 server. I thought I've it, but not the case, only 'xorg-x11-fronts-*' for X-forwarding. So let me install X11nvc
package, and we will see.
Fail again, try to search on what package would include this .h file, then found libX11
. Give it a try.