Install Jupyter notebook offline

2019-02-15 23:39发布

I have a Linux machine that cannot access the internet and I need to install the Jupyter notebook on it, without root privileges. I can copy whatever files to my machine and them copy those files to the remote machine. How can I get all dependencies and install them, without using Anaconda, for example? Pip is ok.

3条回答
一夜七次
2楼-- · 2019-02-16 00:05

If anyone still gets the following error:

-bash: ./.venv/bin/jupyter-notebook: /home/hhoward/.venv/bin/python2.7: bad interpreter: No such file or directory

(To add to Ayush's answer)

It is important to run the relocatable command AFTER the jupyter installation.

pip install jupyter
virtualenv --relocatable .venv

Hope this helps.

查看更多
冷血范
3楼-- · 2019-02-16 00:22

warning: this answer might fail in future due to a possible deprecation in --relocatable option in virtualenv

idea: create a relocatable virtualenv in another computer, install jupyter in there, and tar and move it to the said linux machine, untar it, and profit

Nb. To install virtualenv, run pip install virtualenv

step 1: create a virtualenv

$ virtualenv .venv

step 2: activate .venv

$ . .venv/bin/activate

step 3: install jupyter

$ pip install jupyter

step 4: mark .venv as relocatable

$ virtualenv --relocatable .venv

step 5: tar the .venv directory

$ tar czfv venv.tgz .venv/

step 6: move to offline linux machine, and untar

$ tar xvzf venv.tgz

step 7: activate virtualenv to use it

$ . .venv/bin/activate
查看更多
兄弟一词,经得起流年.
4楼-- · 2019-02-16 00:22

You can use another Linux machine with internet access to create an installation file and then move it to your machine and install it.

  1. On internet access machine create tar.gz file of jupyter's installation files:
mkdir jupyter
cd jupyter
pip download jupyter
cd ..
tar -czvf jupyter.tar.gz /jupyter
  1. Move the created jupyter.tar.gz file to your machine using external hard drive.

  2. On your machine install the jupyter.tar.gz file:

tar -zxvf jupyter.tar.gz
cd jupyter
ls *.gz | xargs -n1 tar -xzf
ls *.zip | xargs -n1 unzip
for D in */; do pip install -e $D --no-index; done
pip install *.whl  --no-index
  1. Check that everything work well with:
jupyter notebook --ip 0.0.0.0 --port 9999 --allow-root

** If you wanna use Jupyterlab instead Jupyter-notebook replace this two lines:

a. replace pip download jupyter with pip download jupyterlab.

b. replace jupyter notebook --ip 0.0.0.0 --port 9999 --allow-root with jupyter lab --ip 0.0.0.0 --port 9999 --allow-root.

查看更多
登录 后发表回答