Custom HPC software & tools from Wirawan. Primarily tailored toward ODU HPC sytems.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

416 lines
10 KiB

{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Examine & fix jupyter / ipython start file\n",
"\n",
"Date: 2020-06-09\n",
"\n",
"Purpose: Try to examine the outcome of *my* fix to `~/.ipython/profile_default/startup/000-odurc-lmod.py` + the handmade \"module\" command (mine: `lmod_python_fix1.py`).\n",
"\n",
"Test-4: this is what happens if we revert to \"vanilla\" module command without changing sys.path.\n"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<function env_modules_python.module(command, *arguments)>"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"module"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'/shared/apps/common/lmod/current/init/env_modules_python.py'"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"module.__code__.co_filename"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"module??"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'/tmp/tmp.JtRbow9G3w'"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import os\n",
"\n",
"xlibpath = os.environ.get(\"LMOD_MANUAL_LD_LIBRARY_PATH\")\n",
"xlibpath"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['/home/wpurwant/Testbeds/jupyter/wahab_jupyter_start',\n",
" '/shared/apps/common/lmod/scripts/init',\n",
" '',\n",
" '/shared/apps/auto/py-jupyter/1.1.4-gcc-7.3.0-cxdz/lib/python3.7/site-packages',\n",
" '/shared/apps/auto/py-numpy/1.16.3-gcc-7.3.0-mdow/lib/python3.7/site-packages',\n",
" '/shared/apps/auto/py-six/1.12.0-gcc-7.3.0-ay7a/lib/python3.7/site-packages',\n",
" '/shared/apps/auto/py-jinja2/2.10-gcc-7.3.0-usre/lib/python3.7/site-packages',\n",
" '/shared/apps/auto/py-babel/2.6.0-gcc-7.3.0-be4y/lib/python3.7/site-packages',\n",
" '/shared/apps/auto/py-pytz/2018.4-gcc-7.3.0-wqdr/lib/python3.7/site-packages',\n",
" '/shared/apps/auto/py-markupsafe/1.0-gcc-7.3.0-biyo/lib/python3.7/site-packages',\n",
" '/shared/apps/common/python/3.7.3-wqal/lib/python37.zip',\n",
" '/shared/apps/common/python/3.7.3-wqal/lib/python3.7',\n",
" '/shared/apps/common/python/3.7.3-wqal/lib/python3.7/lib-dynload',\n",
" '/home/wpurwant/.local/lib/python3.7/site-packages',\n",
" '/shared/apps/common/python/3.7.3-wqal/lib/python3.7/site-packages',\n",
" '/shared/apps/auto/py-jupyter/1.1.4-gcc-7.3.0-cxdz/lib/python3.7/site-packages/IPython/extensions',\n",
" '/home/wpurwant/.ipython',\n",
" '/home/wpurwant/Testbeds/jupyter/wahab_jupyter_start',\n",
" '/shared/apps/common/lmod/current/init']"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import sys\n",
"sys.path"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['/shared/apps/common/lmod/scripts/init',\n",
" '/shared/apps/auto/py-jupyter/1.1.4-gcc-7.3.0-cxdz/lib/python3.7/site-packages',\n",
" '/shared/apps/auto/py-numpy/1.16.3-gcc-7.3.0-mdow/lib/python3.7/site-packages',\n",
" '/shared/apps/auto/py-six/1.12.0-gcc-7.3.0-ay7a/lib/python3.7/site-packages',\n",
" '/shared/apps/auto/py-jinja2/2.10-gcc-7.3.0-usre/lib/python3.7/site-packages',\n",
" '/shared/apps/auto/py-babel/2.6.0-gcc-7.3.0-be4y/lib/python3.7/site-packages',\n",
" '/shared/apps/auto/py-pytz/2018.4-gcc-7.3.0-wqdr/lib/python3.7/site-packages',\n",
" '/shared/apps/auto/py-markupsafe/1.0-gcc-7.3.0-biyo/lib/python3.7/site-packages']"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"os.environ['PYTHONPATH'].split(\":\")"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"total 0\r\n"
]
}
],
"source": [
"ls -l $xlibpath"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"\n",
"Currently Loaded Modules:\n",
" 1) python/3.7.3 5) py-jinja2/2.10 9) py-jupyter/1.1.4\n",
" 2) py-markupsafe/1.0 6) py-six/1.12.0 10) texlive/2020\n",
" 3) py-pytz/2018.4 7) intel-mkl/2019.4.243\n",
" 4) py-babel/2.6.0 8) py-numpy/1.16.3\n",
"\n",
" \n",
"\n",
"\n"
]
}
],
"source": [
"module(\"list\")"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"total 0\r\n"
]
}
],
"source": [
"ls -l $xlibpath"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['/home/wpurwant/Testbeds/jupyter/wahab_jupyter_start',\n",
" '/shared/apps/common/lmod/scripts/init',\n",
" '',\n",
" '/shared/apps/auto/py-jupyter/1.1.4-gcc-7.3.0-cxdz/lib/python3.7/site-packages',\n",
" '/shared/apps/auto/py-numpy/1.16.3-gcc-7.3.0-mdow/lib/python3.7/site-packages',\n",
" '/shared/apps/auto/py-six/1.12.0-gcc-7.3.0-ay7a/lib/python3.7/site-packages',\n",
" '/shared/apps/auto/py-jinja2/2.10-gcc-7.3.0-usre/lib/python3.7/site-packages',\n",
" '/shared/apps/auto/py-babel/2.6.0-gcc-7.3.0-be4y/lib/python3.7/site-packages',\n",
" '/shared/apps/auto/py-pytz/2018.4-gcc-7.3.0-wqdr/lib/python3.7/site-packages',\n",
" '/shared/apps/auto/py-markupsafe/1.0-gcc-7.3.0-biyo/lib/python3.7/site-packages',\n",
" '/shared/apps/common/python/3.7.3-wqal/lib/python37.zip',\n",
" '/shared/apps/common/python/3.7.3-wqal/lib/python3.7',\n",
" '/shared/apps/common/python/3.7.3-wqal/lib/python3.7/lib-dynload',\n",
" '/home/wpurwant/.local/lib/python3.7/site-packages',\n",
" '/shared/apps/common/python/3.7.3-wqal/lib/python3.7/site-packages',\n",
" '/shared/apps/auto/py-jupyter/1.1.4-gcc-7.3.0-cxdz/lib/python3.7/site-packages/IPython/extensions',\n",
" '/home/wpurwant/.ipython',\n",
" '/home/wpurwant/Testbeds/jupyter/wahab_jupyter_start',\n",
" '/shared/apps/common/lmod/current/init']"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import sys\n",
"sys.path"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"total 0\r\n"
]
}
],
"source": [
"ls -l $xlibpath"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<function env_modules_python.module(command, *arguments)>"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"module"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"\n",
"Currently Loaded Modules:\n",
" 1) python/3.7.3 5) py-jinja2/2.10 9) py-jupyter/1.1.4\n",
" 2) py-markupsafe/1.0 6) py-six/1.12.0 10) texlive/2020\n",
" 3) py-pytz/2018.4 7) intel-mkl/2019.4.243\n",
" 4) py-babel/2.6.0 8) py-numpy/1.16.3\n",
"\n",
" \n",
"\n",
"\n"
]
}
],
"source": [
"module(\"list\")"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"total 0\r\n"
]
}
],
"source": [
"ls -l $xlibpath"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"\n",
"The following have been reloaded with a version change:\n",
" 1) py-pytz/2018.4 => py-pytz/2019.3\n",
"\n",
"\n"
]
}
],
"source": [
"module(\"load\", \"py-pandas\")"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [],
"source": [
"import numpy"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"ename": "ModuleNotFoundError",
"evalue": "No module named 'pandas'",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-19-38d4b0363d82>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;32mimport\u001b[0m \u001b[0mpandas\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'pandas'"
]
}
],
"source": [
"import pandas"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## ERROR!\n",
"\n",
"The running python cannot find pandas."
]
}
],
"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.3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}