Pip install from a notebook¶
Links: notebook
, html, PDF
, python
, slides, GitHub
How to install a module from a notebook.
from jyquickhelper import add_notebook_menu
add_notebook_menu()
Update or install a module from the notebook¶
Running pip install
from the command line requires to be in the
right folder. And sometimes, several python installations interfere
between each others. Why doing it from the notebook itself:
try:
# pip >= 19.3
from pip._internal.main import main as pip_main
except Exception:
try:
# pip >= 10.0
from pip._internal import main as pip_main
except Exception:
# pip < 10.0
from pip import main as pip_main
pip_main("install -q qgrid".split())
0
Interesting options¶
Avoid installing dependencies¶
try:
pip_main("install -q qgrid --no-deps".split())
except Exception as e:
print(e)
For the hackathon…¶
pip_main("install pyquickhelper pyensae ensae_projects --upgrade --no-deps --no-cache-dir".split())