installation.rst 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. .. _installation:
  2. Installation
  3. ============
  4. JupyterLab can be installed using ``conda``, ``pip``, ``pipenv`` or ``docker``.
  5. conda
  6. -----
  7. If you use ``conda``, you can install it with:
  8. .. code:: bash
  9. conda install -c conda-forge jupyterlab
  10. pip
  11. ---
  12. If you use ``pip``, you can install it with:
  13. .. code:: bash
  14. pip install jupyterlab
  15. If installing using ``pip install --user``, you must add the user-level
  16. ``bin`` directory to your ``PATH`` environment variable in order to launch
  17. ``jupyter lab``. If you are using a Unix derivative (FreeBSD, GNU / Linux,
  18. OS X), you can achieve this by using ``export PATH="$HOME/.local/bin:$PATH"`` command.
  19. pipenv
  20. ------
  21. If you use ``pipenv``, you can install it as:
  22. .. code:: bash
  23. pipenv install jupyterlab
  24. pipenv shell
  25. or from a git checkout:
  26. .. code:: bash
  27. pipenv install git+git://github.com/jupyterlab/jupyterlab.git#egg=jupyterlab
  28. pipenv shell
  29. When using ``pipenv``, in order to launch ``jupyter lab``, you must activate the project's virtualenv.
  30. For example, in the directory where ``pipenv``'s ``Pipfile`` and ``Pipfile.lock`` live (i.e., where you ran the above commands):
  31. .. code:: bash
  32. pipenv shell
  33. jupyter lab
  34. Alternatively, you can run ``jupyter lab`` inside the virtualenv with
  35. .. code:: bash
  36. pipenv run jupyter lab
  37. Docker
  38. ------
  39. If you have `Docker installed <https://docs.docker.com/install/>`__, you can install and use JupyterLab by selecting one
  40. of the many `ready-to-run Docker images <https://jupyter-docker-stacks.readthedocs.io/en/latest/using/selecting.html>`__
  41. maintained by the Jupyter Team. Follow the instructions in the `Quick Start Guide <https://jupyter-docker-stacks.readthedocs.io/en/latest/>`__
  42. to deploy the chosen Docker image. NOTE: Ensure your docker command includes the `-e JUPYTER_ENABLE_LAB=yes` flag to ensure
  43. JupyterLab is enabled in your container.
  44. Installing with Previous Versions of Notebook
  45. ---------------------------------------------
  46. If you are using a version of Jupyter Notebook earlier than 5.3, then you must also run the following command to enable the JupyterLab
  47. server extension:
  48. .. code:: bash
  49. jupyter serverextension enable --py jupyterlab --sys-prefix
  50. Prerequisites
  51. -------------
  52. JupyterLab requires the Jupyter Notebook version 4.3 or later. To check
  53. the version of the ``notebook`` package that you have installed:
  54. .. code:: bash
  55. jupyter notebook --version
  56. Usage with JupyterHub
  57. ---------------------
  58. Read the details on our :ref:`JupyterLab on JupyterHub documentation page <jupyterhub>`.
  59. Supported browsers
  60. ------------------
  61. The latest versions of the following browsers are currently known to work:
  62. - Firefox
  63. - Chrome
  64. - Safari
  65. Earlier browser versions may also work, but come with no guarantees.
  66. JupyterLab uses CSS Variables for styling, which is one reason for the
  67. minimum versions listed above. IE 11+ or Edge 14 do not support
  68. CSS Variables, and are not directly supported at this time.
  69. A tool like `postcss <https://postcss.org/>`__ can be used to convert the CSS files in the
  70. ``jupyterlab/build`` directory manually if desired.
  71. Usage with private NPM registry
  72. -------------------------------
  73. To install extensions, you will need access to a NPM packages registry. Some companies do not allow
  74. reaching directly public registry and have a private registry. To use it, you need to configure ``npm``
  75. **and** ``yarn`` to point to that registry (ask your corporate IT department for the correct URL):
  76. .. code::
  77. npm config set registry https://registry.company.com/
  78. yarn config set registry https://registry.company.com/
  79. JupyterLab will pick up that registry automatically.
  80. .. note::
  81. You can check which registry URL is used by JupyterLab by running::
  82. python -c "from jupyterlab.commands import AppOptions; print(AppOptions().registry)"
  83. Installation problems
  84. ---------------------
  85. If your computer is behind corporate proxy or firewall,
  86. you may encounter HTTP and SSL errors due to custom security profiles managed by corporate IT departments.
  87. Example of typical error, when conda cannot connect to own repositories:
  88. + `CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://repo.anaconda.com/pkgs/main/win-64/current_repodata.json>`
  89. This may happen because your company can block connections to widely-used repositories in Python and JavaScript communities.
  90. Here are some widely-used sites that host packages in the Python and JavaScript open-source ecosystem. Your network adminstrator may be able to allow http and https connections to these:
  91. - \*.pypi.org
  92. - \*.pythonhosted.org
  93. - \*.continuum.io
  94. - \*.anaconda.com
  95. - \*.conda.io
  96. - \*.github.com
  97. - \*.githubusercontent.com
  98. - \*.npmjs.com
  99. - \*.yarnpkg.com
  100. Alternatively you can specify proxy user (mostly domain user with password),
  101. that is allowed to communicate via network. This can be easily achieved
  102. by setting two common environment variables: `HTTP_PROXY` and `HTTPS_PROXY`.
  103. These variables are automatically used by many open-source tools (like ``conda``) if set correctly.
  104. .. code:: bash
  105. # For Windows
  106. set HTTP_PROXY=http://USER:PWD@proxy.company.com:PORT
  107. set HTTPS_PROXY=https://USER:PWD@proxy.company.com:PORT
  108. # For Linux / MacOS
  109. export HTTP_PROXY=http://USER:PWD@proxy.company.com:PORT
  110. export HTTPS_PROXY=https://USER:PWD@proxy.company.com:PORT
  111. In case you can communicate via HTTP, but installation with ``conda`` fails
  112. on connectivity problems to HTTPS servers, you can disable using SSL for ``conda``.
  113. .. warning:: Disabling SSL in communication is generally not recommended and involves potential security risks.
  114. .. code:: bash
  115. # Configure npm to not use SSL
  116. conda config --set ssl_verify False
  117. You can do a similar thing for ``pip``.
  118. The approach here is to mark repository servers as trusted hosts,
  119. which means, SSL communication will not be required for downloading Python libraries.
  120. .. code:: bash
  121. # Install pandas (without SSL)
  122. pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org pandas
  123. Using the tips from above, you can handle many network problems
  124. related to installing Python libraries.
  125. Many Jupyter extensions require having a working ``npm`` and ``jlpm`` (alias for ``yarn``) commands,
  126. which is required for downloading useful Jupyter extensions or other JavaScript dependencies.
  127. Example of typical error message, when ``npm`` cannot connect to own repositories:
  128. + `ValueError: "@jupyterlab/toc" is not a valid npm package`
  129. .. code:: bash
  130. # Set proxy for NPM
  131. npm config set proxy http://USER:PWD@proxy.company.com:PORT
  132. npm config set proxy https://USER:PWD@proxy.company.com:PORT
  133. # Set default registry for NPM (optional, useful in case if common JavaScript libs cannot be found)
  134. npm config set registry http://registry.npmjs.org/
  135. jlpm config set registry https://registry.yarnpkg.com/
  136. In case you can communicate via HTTP, but installation with ``npm`` fails
  137. on connectivity problems to HTTPS servers, you can disable using SSL for ``npm``.
  138. .. warning:: Disabling SSL in communication is generally not recommended and involves potential security risk.
  139. .. code:: bash
  140. # Configure npm to not use SSL
  141. npm set strict-ssl False
  142. Problems with Extensions and Settings
  143. -------------------------------------
  144. Jupyterlab saves settings via `PUT` requests to the server with a JSON5-compatible payload, even though it claims the PUT request is valid JSON. `JSON5 <https://json5.org/>`__ is a superset of JSON that allows comments, etc. There may be deployment problems, manifest as 400 error return codes when saving settings, if these `PUT` requests are rejected by a routing layer that tries to validate the payload as JSON instead of JSON5.
  145. Common symptoms of this during debugging are:
  146. - The settings are selected but nothing changes, or when extension manager is enabled but the manager tab is not added.
  147. - JupyterLab's logs don't have the 400 return codes when `PUT` requests are issued.
  148. - If your JupyterLab logs are on Elastic Search, you'll see `Unexpected token / in JSON at position`. This comes from the JSON5 comments not being valid JSON.