Files
ortools-clone/examples/notebook/contrib/check_dependencies.ipynb
Corentin Le Molgat 27121a1068 Update examples/notebook
generated using ./tools/gen_all_notebook.sh
2020-03-04 14:34:33 +01:00

59 lines
1.9 KiB
Plaintext

{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import logging, sys, inspect\n",
"from os.path import dirname, abspath\n",
"from optparse import OptionParser\n",
"\n",
"\n",
"def log_error_and_exit(error_message):\n",
" logging.error(error_message)\n",
" raise SystemExit\n",
"\n",
"\n",
"#try to import setuptools\n",
"try:\n",
" from setuptools import setup, Extension\n",
" from setuptools.command import easy_install\n",
"except ImportError:\n",
" log_error_and_exit(\"\"\"setuptools is not installed for \\\"\"\"\" + sys.executable +\n",
" \"\"\"\\\"\n",
"Follow this link for installing instructions :\n",
"https://pypi.python.org/pypi/setuptools\n",
"make sure you use \\\"\"\"\" + sys.executable + \"\"\"\\\" during the installation\"\"\")\n",
"\n",
"from pkg_resources import parse_version\n",
"\n",
"\n",
"def notinstalled(modulename):\n",
" return modulename + \"\"\" could not be imported for \\\"\"\"\" + sys.executable + \"\"\"\\\"\n",
"Set PYTHONPATH to the output of this command \\\"make print-OR_TOOLS_PYTHONPATH\\\" before running the examples\"\"\"\n",
"\n",
"\n",
"def wrong_module(module_file, modulename):\n",
" return \"\"\"\n",
"The python examples are not importing the \"\"\" + modulename + \"\"\" module from the sources.\n",
"Remove the site-package that contains \\\"\"\"\" + module_file + \"\"\"\\\", either manually or by using pip, and rerun this script again.\"\"\"\n",
"\n",
"\n",
"# Returns the n_th parent of file\n",
"def n_dirname(n, file):\n",
" directory = file\n",
" for x in range(0, n):\n",
" directory = dirname(directory)\n",
" return directory\n",
"\n",
"\n"
]
}
],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 4
}