# apt-get remove python-pip python2-pip
# aptitude install python-setuptools python3-setuptools python-dev python3-dev # easy_install-2.7 pip # easy_install3 pip
# pip3 install notebook
# pip2 install ipykernel
$ python2 -m ipykernel install [--user]
$ jupyter notebook
#!/usr/bin/env bash #=== INSTALLATION === # # pip3 install --upgrade notebook # JupyterHub can be installed with pip, and the proxy with npm: # # npm install -g configurable-http-proxy # # pip3 install jupyterhub #=== CERTIFICATE GENERATION: === # From: https://workaround.org/ispmail/jessie/create-certificate # # openssl req -newkey rsa:4096 -nodes -sha512 -x509 -days 3650 -nodes -out /etc/ssl/certs/mailserver.pem -keyout /etc/ssl/private/mailserver.pem # On "Common Name" use the hostname, e.g, www.yourserver.com #=== LAUNCH COMMAND as root: === jupyterhub --port 4443 --ssl-key /etc/ssl/private/mailserver.pem --ssl-cert /etc/ssl/certs/mailserver.pem
/usr/local/share/jupyter/kernels
python2 -m IPython kernelspec install-self
python3 -m IPython kernelspec install-self
$ cat ~/.ipython/kernels/ir/kernel.json
{"argv": ["R","-e","IRkernel::main()","--args","{connection_file}"],
"display_name":"R"
}$ cat ~/.ipython/kernels/python2/kernel.json
{
"display_name": "Python 2",
"language": "python",
"codemirror_mode": {
"version": 3,
"name": "ipython"
},
"argv": [
"/usr/bin/python",
"-c",
"from IPython.kernel.zmq.kernelapp import main; main()",
"-f",
"{connection_file}"
]
}jovyan@374b5bfac0c6:~$ cat /usr/local/share/jupyter/kernels/python2/kernel.json
{
"display_name": "Python 2",
"language": "python",
"argv": [
"/usr/bin/python2",
"-m",
"IPython.kernel",
"-f",
"{connection_file}"
]
}$ ipython notebook --InlineBackend.figure_format=svg
%pylab inline
ipython notebopok --ip=*
In [1]: from IPython.lib import passwd In [2]: passwd() Enter password: Verify password:
$ ipython profile create myserver $ vim ~/.ipython/profile_myserver/ipython_notebook_config.py
c = get_config() c.IPKernelApp.pylab = 'inline' c.NotebookApp.ip = '*' c.NotebookApp.open_browser = False c.NotebookApp.password = u'sha1:yourhashedpassword' c.NotebookApp.port = 9999
$ openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout mycert.pem -out mycert.pem
$ ipython notebook --profile=myserver --certfile=mycert.pem
In [1]: plot(arange(10)) Out[1]: [<matplotlib.lines.Line2D at 0x39c8e50>]
[PDF](files/workingdir/output.pdf)
from IPython.core.display import HTML
def foo():
raw_html = "<h1>Yah, rendered HTML</h1>"
return HTML(raw_html)
foo()from IPython.core.display import HTML
def foo():
raw_html = "<h1>Yah, rendered HTML</h1>"
return HTML(raw_html)
foo()from IPython.core.display import HTML raw_html = "<h1>Yah, rendered HTML</h1>" HTML(raw_html)
$ pandoc -s file.rst -t latex -o file.tex
$ sudo apt-get install pandoc
# curl -sL https://deb.nodesource.com/setup | bash - # apt-get install -y nodejs # #or directly from: http://gfif.udea.edu.co/downloads/nodejs_0.10.36-1nodesource1~wheezy1_amd64.deb
# sudo apt-get install npm nodejs-legacy # npm install -g configurable-http-proxy # pip install ipython --upgrade # pip install ipython --upgrade # pip install pyzmq --upgrade # pip install tornado --upgrade # pip install jsonschema
#######IPYTHON CELL #######
[#]%%writefile run.py
#!/usr/bin/env python
CODE
def run_from_ipython():
try:
__IPYTHON__
return True
except NameError:
return False
if not run_from_ipython() and len(sys.argv)>1:
CODE
El documento original está disponible en https://clustercien.udea.edu.co/web/tiki-index.php?page=Ipython