207 lines
5.7 KiB
Plaintext
207 lines
5.7 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"# Check Environment\n",
|
|
"This notebook checks that you have correctly created the environment and that all packages needed are installed."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Environment\n",
|
|
"\n",
|
|
"The next command should return a line like (Mac/Linux):\n",
|
|
"\n",
|
|
" /<YOUR-HOME-FOLDER>/anaconda/envs/ztdl/bin/python\n",
|
|
"\n",
|
|
"or like (Windows 10):\n",
|
|
"\n",
|
|
" C:\\\\<YOUR-HOME-FOLDER>\\\\Anaconda3\\\\envs\\\\ztdl\\\\python.exe\n",
|
|
"\n",
|
|
"In particular you should make sure that you are using the python executable from within the course environment.\n",
|
|
"\n",
|
|
"If that's not the case do this:\n",
|
|
"\n",
|
|
"1. close this notebook\n",
|
|
"2. go to the terminal and stop jupyer notebook\n",
|
|
"3. make sure that you have activated the environment, you should see a prompt like:\n",
|
|
"\n",
|
|
" (ztdl) $\n",
|
|
"4. (optional) if you don't see that prompt activate the environment:\n",
|
|
" - mac/linux:\n",
|
|
" \n",
|
|
" conda activate ztdl\n",
|
|
"\n",
|
|
" - windows:\n",
|
|
"\n",
|
|
" activate ztdl\n",
|
|
"5. restart jupyter notebook"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"import os\n",
|
|
"import sys\n",
|
|
"sys.executable"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Python 3.7\n",
|
|
"\n",
|
|
"The next line should say that you're using Python 3.7.x from Anaconda. At the time of publication it looks like this (Mac/Linux):\n",
|
|
"\n",
|
|
" Python 3.7.3 (default, Mar 27 2019, 22:11:17)\n",
|
|
" [GCC 7.3.0] :: Anaconda, Inc. on linux\n",
|
|
" Type \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n",
|
|
"\n",
|
|
"or like this (Windows 10):\n",
|
|
"\n",
|
|
" Python 3.7.3 (default, Apr 24 2019, 15:29:51) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32\n",
|
|
" Type \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n",
|
|
"\n",
|
|
"but date and exact version of GCC may change in the future.\n",
|
|
"\n",
|
|
"If you see a different version of python, go back to the previous step and make sure you created and activated the environment correctly."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"import sys\n",
|
|
"sys.version"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Jupyter\n",
|
|
"\n",
|
|
"Check that Jupyter is running from within the environment. The next line should look like (Mac/Linux):\n",
|
|
"\n",
|
|
" /<YOUR-HOME-FOLDER>/anaconda/envs/ztdl/lib/python3.6/site-packages/jupyter.py'\n",
|
|
"\n",
|
|
"or like this (Windows 10):\n",
|
|
"\n",
|
|
" C:\\\\Users\\\\<YOUR-USER>\\\\Anaconda3\\\\envs\\\\ztdl\\\\lib\\\\site-packages\\\\jupyter.py"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"import jupyter\n",
|
|
"jupyter.__file__"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Other packages\n",
|
|
"\n",
|
|
"Here we will check that all the packages are installed and have the correct versions. If everything is ok you should see:\n",
|
|
" \n",
|
|
" Using TensorFlow backend.\n",
|
|
" \n",
|
|
" Houston we are go!\n",
|
|
"\n",
|
|
"If there's any issue here please make sure you have checked the previous steps and if it's all good please send us a question in the Q&A forum."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"import pip\n",
|
|
"import numpy\n",
|
|
"import jupyter\n",
|
|
"import matplotlib\n",
|
|
"import sklearn\n",
|
|
"import scipy\n",
|
|
"import pandas\n",
|
|
"import PIL\n",
|
|
"import seaborn\n",
|
|
"import tensorflow\n",
|
|
"\n",
|
|
"\n",
|
|
"def check_version(pkg, version):\n",
|
|
" actual = pkg.__version__.split('.')\n",
|
|
" if len(actual) == 3:\n",
|
|
" actual_major = '.'.join(actual[:2])\n",
|
|
" elif len(actual) == 2:\n",
|
|
" actual_major = '.'.join(actual)\n",
|
|
" else:\n",
|
|
" raise NotImplementedError(pkg.__name__ +\n",
|
|
" \"actual version :\"+\n",
|
|
" pkg.__version__)\n",
|
|
" try:\n",
|
|
" assert(actual_major == version)\n",
|
|
" except Exception as ex:\n",
|
|
" print(\"{} {}\\t=> {}\".format(pkg.__name__,\n",
|
|
" version,\n",
|
|
" pkg.__version__))\n",
|
|
" raise ex\n",
|
|
"\n",
|
|
"check_version(pip, '21.0')\n",
|
|
"check_version(numpy, '1.19')\n",
|
|
"check_version(matplotlib, '3.3')\n",
|
|
"check_version(sklearn, '0.24')\n",
|
|
"check_version(scipy, '1.6')\n",
|
|
"check_version(pandas, '1.2')\n",
|
|
"check_version(PIL, '8.2')\n",
|
|
"check_version(seaborn, '0.11')\n",
|
|
"check_version(tensorflow, '2.5')\n",
|
|
"\n",
|
|
"print(\"Houston we are go!\")"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": []
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "Python 3",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 3
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython3",
|
|
"version": "3.7.10"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 2
|
|
}
|