User Tools

Site Tools


en:programmation-jupyter

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
en:programmation-jupyter [2020/02/06 20:20]
admin removed
en:programmation-jupyter [2020/12/15 16:09]
admin
Line 1: Line 1:
-====== Python ======+===== Jupyter notebook =====
  
-===== Anaconda =====+You should secure your jupyter netbook. You can follow this procedure.
  
-Even-though **Python** is available in all Linux machines, the module **Anaconda** allows you to load Python version 3.6 that give you access to a wide range of scientific libraries such as Scipy and Numpy. You can find a list of all available modules here: https://store.continuum.io/cshop/anaconda/. In order to use this **suite python**, you need to load the module anaconda in your account: +Create jupyter configuration file
-  module load anaconda+
  
-You will also have access to some virtual environments. You can use the command: +  jupyter notebook --generate-config
-  module help anaconda +
-to see what is available. +
-   +
-===== Installing additional modules =====+
  
-Anaconda comes with many preinstalled packages but you might need one that isn't available. In that case, you can use the ''pip'' tool to search packages and install them.+Create jupyter password
  
-Here's a search example:+  jupyter notebook password
  
-<code> 
->pip search pulp 
-coinor.pulp (1.0.4)      - This is a package that wraps pulp and imports it into the namespace package coinor. 
-pulp-or (1.4.6)          - PuLP is an LP modeler written in python. PuLP can generate MPS or LP files and call GLPK, COIN CLP/CBC, CPLEX, and GUROBI to solve linear problems. 
-PuLP-py3 (1.5.5)         - Temporary fork of PuLP offering support for Python 3 while retaining compatibility with Python 2. PuLP is an LP modeler that can generate MPS or LPfiles and call GLPK, COIN 
-                           CLP/CBC, CPLEX, and GUROBI to solve linear problems. 
-juicer (0.7.2)           - Administer Pulp and Release Carts 
-pulpo-forms (1.1)        - Django App to create dynamic Surveys 
-pulpcbc (0.1.4)          - UNKNOWN 
-pulpitum (0.2.2)         - PyPI client for Humans™ 
-mypulp (0.0.9)           - `mypulp` is a package for mypulp. 
-yaposib (0.3.2)          - Yaposib is a python binding to OSI, the Open Solver Interface from COIN-OR. It intends to give access to various solvers through python. Yaposib was created in order to be 
-                           integrated in pulp-or (http://code.google.com/p/pulp-or). 
-pulp-smash (2016.11.10)  - A library for testing Pulp 
-PuLP (1.6.1)             - 
-</code> 
  
-To install package, you can do as follows:+Create certificate that is valid for 365 days. Adjust the number of days for your needs.
  
 +  cd ~/.jupyter
 +  openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout mykey.key -out mycert.pem
 +
 +You can start jupyter with this command:
 +
 +  jupyter notebook --certfile=~/.jupyter/mycert.pem --keyfile=~/.jupyter/mykey.key
 +
 +If you prefer to use a browser on a different machine, for example a laptop, you can use this command instead:
 +  jupyter notebook --certfile=~/.jupyter/mycert.pem --keyfile=~/.jupyter/mykey.key --no-browser --ip=*
 +
 +This command won't automatically start a browser and will allow any computer to connect to the jupyter server. Look at the statup log to see which port to connect to.
 +
 +If you want this configuration to be permanent, you can add those options to the jupyter_notebook_config.py file.
 <code> <code>
->pip install --user pulp +echo "c.NotebookApp.certfile = u'$HOME/.jupyter/mycert.pem'" >> jupyter_notebook_config.py 
-Collecting pulp +echo "c.NotebookApp.keyfile u'$HOME/.jupyter/mykey.key'" >> jupyter_notebook_config.py 
-Collecting pyparsing<=1.9.9 (from pulp) +echo "c.NotebookApp.open_browser = False" >> jupyter_notebook_config.py 
-Installing collected packages: pyparsing, pulp +echo "c.NotebookApp.ip = '0.0.0.0'" >> jupyter_notebook_config.py
-Successfully installed pulp pyparsing-2.0.3+
 </code> </code>
 +
 +You can then start jupyter with a shorter command.
 +  jupyter notebook
 +
 +If you intend to use jupyter remotely from a laptop that's not on our network, you'll have to create an ssh tunnel to be able to reach the server.
 +
  
  
-===== numpy+scipy ===== 
  
-If you're using those libraries, be careful when submitting jobs to the compute grid since by default it will use all available processors. To restrict the job to one CPU, you can run your program like this: 
-  OPENBLAS_NUM_THREADS=1 MKL_NUM_THREADS=1 python mon programme.py 
  
  
  
en/programmation-jupyter.txt · Last modified: 2022/03/11 19:23 by admin