Table Of Contents
Table Of Contents

Pip install from a notebook

Links: notebook, chsh_pip_install2html.html, PDF, python, chsh_pip_install.slides.html, chsh_pip_install.slides2p.html, 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 >= 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())
zeroconf 0.19.1 requires enum-compat, which is not installed.
zarr 2.2.0 requires asciitree, which is not installed.
typecheck-decorator 1.3 requires typing, which is not installed.
tensorflow 1.7.0 requires astor>=0.6.0, which is not installed.
tensorflow 1.7.0 requires gast>=0.2.0, which is not installed.
tensorflow 1.7.0 requires grpcio>=1.8.6, which is not installed.
tensorflow 1.7.0 requires tensorboard<1.8.0,>=1.7.0, which is not installed.
streamparse 3.13.1 requires texttable, which is not installed.
spyder 3.2.8 requires rope>=0.10.5, which is not installed.
skll 1.5.2 requires PrettyTable, which is not installed.
scoop 0.7.1.1 requires argparse>=1.1, which is not installed.
orange3 3.12.0 requires keyrings.alt, which is not installed.
orange3-text 0.3.0 requires typing, which is not installed.
orange3-imageanalytics 0.2.0 requires hypertemp, which is not installed.
lz4 1.0.0 requires deprecation, which is not installed.
lmfit 0.9.9 requires asteval, which is not installed.
homeassistant 0.60.1 requires typing<4,>=3, which is not installed.
grin 1.2.1 requires argparse>=1.1, which is not installed.
geopy 1.13.0 requires geographiclib<2,>=1.49, which is not installed.
fcn 6.3.0 requires chainercv, which is not installed.
db-py 0.5.3 requires prettytable==0.7.2, which is not installed.
arctic 1.62.0 requires enum34, which is not installed.
zipline 1.1.1 has requirement bcolz<1,>=0.12.1, but you'll have bcolz 1.2.0 which is incompatible.
zipline 1.1.1 has requirement pandas<0.19,>=0.18.1, but you'll have pandas 0.22.0 which is incompatible.
tensorflow-tensorboard 1.5.1 has requirement bleach==1.5.0, but you'll have bleach 2.1.3 which is incompatible.
tensorflow-tensorboard 1.5.1 has requirement html5lib==0.9999999, but you'll have html5lib 1.0.1 which is incompatible.
spyder 3.2.8 has requirement pyqt5<5.10; python_version >= "3", but you'll have pyqt5 5.10.1 which is incompatible.
spacy 2.0.9 has requirement ftfy<5.0.0,>=4.4.2, but you'll have ftfy 5.3.0 which is incompatible.
spacy 2.0.9 has requirement html5lib==1.0b8, but you'll have html5lib 1.0.1 which is incompatible.
spacy 2.0.9 has requirement msgpack-numpy==0.4.1, but you'll have msgpack-numpy 0.4.3 which is incompatible.
spacy 2.0.9 has requirement msgpack-python==0.5.4, but you'll have msgpack-python 0.5.1 which is incompatible.
spacy 2.0.9 has requirement regex==2017.4.5, but you'll have regex 2018.2.21 which is incompatible.
recommonmark 0.4.0 has requirement commonmark<=0.5.4, but you'll have commonmark 0.7.5 which is incompatible.
nb-mermaid 0.1.0 has requirement IPython<4.0,>3.0, but you'll have ipython 6.3.1 which is incompatible.
mezzanine 4.2.3 has requirement django<1.11,>=1.8, but you'll have django 2.0.4 which is incompatible.
luigi 2.7.5 has requirement tornado<5,>=4.0, but you'll have tornado 5.0.1 which is incompatible.
hyper 0.7.0 has requirement h2<3.0,>=2.4, but you'll have h2 3.0.1 which is incompatible.
hyper 0.7.0 has requirement hyperframe<4.0,>=3.2, but you'll have hyperframe 5.1.0 which is incompatible.
homeassistant 0.60.1 has requirement aiohttp==2.3.6, but you'll have aiohttp 2.3.7 which is incompatible.
homeassistant 0.60.1 has requirement yarl==0.16.0, but you'll have yarl 0.17.0 which is incompatible.
flake8 3.5.0 has requirement pycodestyle<2.4.0,>=2.0.0, but you'll have pycodestyle 2.4.0 which is incompatible.
django-userena 2.0.1 has requirement django-guardian<=1.4.1, but you'll have django-guardian 1.4.9 which is incompatible.
django-userena 2.0.1 has requirement html2text==2014.12.29, but you'll have html2text 2018.1.9 which is incompatible.
django-celery 3.2.2 has requirement celery<4.0,>=3.1.15, but you'll have celery 4.1.0 which is incompatible.
django-audiotracks 0.2.4 has requirement mutagenx==1.22, but you'll have mutagenx 1.24 which is incompatible.
coremltools 0.8 has requirement six==1.10.0, but you'll have six 1.11.0 which is incompatible.
cobra 0.9.1 has requirement ruamel.yaml<0.15, but you'll have ruamel-yaml 0.15.37 which is incompatible.
botocore 1.10.4 has requirement python-dateutil<2.7.0,>=2.1, but you'll have python-dateutil 2.7.2 which is incompatible.
azure-mgmt 2.0.0 has requirement azure-mgmt-authorization~=0.30.0, but you'll have azure-mgmt-authorization 0.40.0 which is incompatible.
azure-mgmt 2.0.0 has requirement azure-mgmt-batchai~=0.2.0, but you'll have azure-mgmt-batchai 1.0.0 which is incompatible.
azure-mgmt 2.0.0 has requirement azure-mgmt-billing~=0.1.0, but you'll have azure-mgmt-billing 0.2.0 which is incompatible.
azure-mgmt 2.0.0 has requirement azure-mgmt-containerinstance~=0.3.1, but you'll have azure-mgmt-containerinstance 0.4.0 which is incompatible.
azure-mgmt 2.0.0 has requirement azure-mgmt-datafactory~=0.4.0, but you'll have azure-mgmt-datafactory 0.6.0 which is incompatible.
azure-mgmt 2.0.0 has requirement azure-mgmt-datalake-analytics~=0.3.0, but you'll have azure-mgmt-datalake-analytics 0.4.0 which is incompatible.
azure-mgmt 2.0.0 has requirement azure-mgmt-datalake-store~=0.3.0, but you'll have azure-mgmt-datalake-store 0.4.0 which is incompatible.
azure-mgmt 2.0.0 has requirement azure-mgmt-monitor~=0.4.0, but you'll have azure-mgmt-monitor 0.5.0 which is incompatible.
azure-mgmt 2.0.0 has requirement azure-mgmt-rdbms~=0.1.0, but you'll have azure-mgmt-rdbms 1.1.0 which is incompatible.
azure-mgmt 2.0.0 has requirement azure-mgmt-subscription~=0.1.0, but you'll have azure-mgmt-subscription 0.2.0 which is incompatible.
azure-mgmt 2.0.0 has requirement azure-mgmt-web~=0.34.1, but you'll have azure-mgmt-web 0.35.0 which is incompatible.
altair 1.2.1 has requirement vega==0.4.4, but you'll have vega 0.5.0 which is incompatible.
releases 1.4.1 has requirement sphinx<1.7,>=1.3, but you'll have sphinx 1.7.2 which is incompatible.
0

Interesting options

Avoid installing dependencies

try:
    pip_main("install -q qgrid --no-deps".split())
except Exception as e:
    print(e)

Upgrade

try:
    pip_main("install -q qgrid --upgrade --no-deps".split())
except Exception as e:
    print(e)

No cache

By default, pip uses cached version. So, if a module has just been updated, pip might choose to use the previous version. To tell it not to do so:

pip_main("install -q qgrid --upgrade --no-deps --no-cache-dir".split())
0

For the hackathon…

pip_main("install pyquickhelper pyensae ensae_projects --upgrade --no-deps --no-cache-dir".split())