Skip to content
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

Installation of C++ for Jupyter enviroment. #50

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
151 changes: 151 additions & 0 deletions custom-environments/C++/1-install-C++.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "9232d034-72b9-49af-9e00-09dbb96c2839",
"metadata": {},
"source": [
"# Use C++ with Studio Lab\n",
"This notebook will demonstrate installing latest C++ vesions and an associated C++ kernel."
]
},
{
"cell_type": "markdown",
"id": "c41f4718-3e17-4275-8268-0caf46e3c241",
"metadata": {},
"source": [
"## 1. install xeus-cling to use C++ at Jupyter"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "b5f97276-37fc-4b37-a0c2-c2479242aba4",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Collecting package metadata (current_repodata.json): done\n",
"Solving environment: failed with initial frozen solve. Retrying with flexible solve.\n",
"Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.\n",
"Collecting package metadata (repodata.json): done\n",
"Solving environment: done\n",
"\n",
"\n",
"==> WARNING: A newer version of conda exists. <==\n",
" current version: 4.10.3\n",
" latest version: 4.11.0\n",
"\n",
"Please update conda by running\n",
"\n",
" $ conda update -n base conda\n",
"\n",
"\n",
"\n",
"## Package Plan ##\n",
"\n",
" environment location: /home/studio-lab-user/.conda/envs/default\n",
"\n",
" added / updated specs:\n",
" - xeus-cling\n",
"\n",
"\n",
"The following packages will be downloaded:\n",
"\n",
" package | build\n",
" ---------------------------|-----------------\n",
" python-3.9.9 |h62f1059_0_cpython 27.4 MB conda-forge\n",
" ------------------------------------------------------------\n",
" Total: 27.4 MB\n",
"\n",
"The following NEW packages will be INSTALLED:\n",
"\n",
" binutils_impl_lin~ conda-forge/linux-64::binutils_impl_linux-64-2.36.1-h193b22a_2\n",
" binutils_linux-64 conda-forge/linux-64::binutils_linux-64-2.36-hf3e587d_4\n",
" clang_variant conda-forge/linux-64::clang_variant-1.0-cling_v0.8\n",
" clangdev conda-forge/linux-64::clangdev-5.0.0-h43905f9_1012\n",
" cling conda-forge/linux-64::cling-0.8-hf817b99_1\n",
" cppzmq conda-forge/linux-64::cppzmq-4.8.1-hf7cf922_0\n",
" cxxopts conda-forge/linux-64::cxxopts-2.1.2-h4bd325d_1001\n",
" gcc_impl_linux-64 conda-forge/linux-64::gcc_impl_linux-64-9.4.0-h03d3576_11\n",
" gcc_linux-64 conda-forge/linux-64::gcc_linux-64-9.4.0-h391b98a_4\n",
" gxx_impl_linux-64 conda-forge/linux-64::gxx_impl_linux-64-9.4.0-h03d3576_11\n",
" gxx_linux-64 conda-forge/linux-64::gxx_linux-64-9.4.0-h0316aca_4\n",
" kernel-headers_li~ conda-forge/noarch::kernel-headers_linux-64-2.6.32-he073ed8_15\n",
" libgcc-devel_linu~ conda-forge/linux-64::libgcc-devel_linux-64-9.4.0-hd854feb_11\n",
" libsanitizer conda-forge/linux-64::libsanitizer-9.4.0-h79bfe98_11\n",
" libstdcxx-devel_l~ conda-forge/linux-64::libstdcxx-devel_linux-64-9.4.0-hd854feb_11\n",
" nlohmann_json conda-forge/linux-64::nlohmann_json-3.9.1-h9c3ff4c_1\n",
" pugixml conda-forge/linux-64::pugixml-1.11.4-h9c3ff4c_0\n",
" sysroot_linux-64 conda-forge/noarch::sysroot_linux-64-2.12-he073ed8_15\n",
" xeus conda-forge/linux-64::xeus-2.3.1-hab3612f_0\n",
" xeus-cling conda-forge/linux-64::xeus-cling-0.13.0-h560cc44_2\n",
" xtl conda-forge/linux-64::xtl-0.7.4-h4bd325d_0\n",
"\n",
"The following packages will be DOWNGRADED:\n",
"\n",
" openssl 3.0.0-h7f98852_2 --> 1.1.1l-h7f98852_0\n",
" python 3.9.9-h543edf9_0_cpython --> 3.9.9-h62f1059_0_cpython\n",
"\n",
"\n",
"\n",
"Downloading and Extracting Packages\n",
"python-3.9.9 | 27.4 MB | ##################################### | 100% \n",
"Preparing transaction: done\n",
"Verifying transaction: done\n",
"Executing transaction: done\n"
]
}
],
"source": [
"!conda install xeus-cling -c conda-forge -y"
]
},
{
"cell_type": "markdown",
"id": "612ed598-cacd-4dfe-8b8a-e79816e941ab",
"metadata": {},
"source": [
"## 2. Now you can select Kernel of C++!"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "5c45fc4f-b8b2-4a2d-a482-ac720a5aaab1",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Hello World!\n"
]
}
],
"source": [
"#include <iostream>\n",
"\n",
"std::cout << \"Hello World!\" << std::endl;"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "default:C++17",
"language": "C++17",
"name": "conda-env-default-xcpp17"
},
"language_info": {
"codemirror_mode": "text/x-c++src",
"file_extension": ".cpp",
"mimetype": "text/x-c++src",
"name": "c++",
"version": "17"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
8 changes: 8 additions & 0 deletions custom-environments/C++/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Using C++ with Amazon SageMaker Studio Lab

[C++](https://isocpp.org/) is a programming language which is used for general purpose like coding algorithms. It has the features of object-oriented, generic and functional programming.

[Xeus](https://xeus.readthedocs.io/en/latest/) is a library to use C++ kernel for Jupyter. This help us to write C++ in the Jupyter environment very easily.

There are some libraries which can be used for Jupyter environment. If you would like to know anymore, please check this article.
[Interactive Workflows for C++ with Jupyter](https://blog.jupyter.org/interactive-workflows-for-c-with-jupyter-fe9b54227d92)