Forked from branning/install_debian_jupyter_2_and_3.sh
Created
August 17, 2017 18:35
-
-
Save fagnersutel/1347b5ed069c0d1de967974bda690bb8 to your computer and use it in GitHub Desktop.
Run Python 2 & 3 in Jupyter on Fedora Linux
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Install Jupyter Notebook with Python 2 and Python 3 kernels on Debian | |
# from http://stackoverflow.com/a/34421527/347567 | |
set -o errexit | |
# As root, install `pip` and `jupyter` from apt, and the development packages, too. | |
apt-get update | |
apt-get install -y \ | |
python-pip \ | |
python-dev \ | |
python3-pip \ | |
python3-dev | |
pip3 install jupyter | |
# Add the kernel for Python2 using the `ipykernel` module. The Python3 kernel is installed, already. | |
apt-get install -y libzmq3-dev # we don't want to build libzmq3, takes a while | |
pip install ipykernel | |
python2 -m ipykernel install | |
# Let's just start the party already! | |
[ -f run_jupyter.sh ] && bash run_jupyter.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Install Python 2 and Python 3 kernels for Jupyter on Fedora | |
# from http://stackoverflow.com/a/34447744/347567 | |
# exit immediately if an error occurs | |
set -o errexit | |
dnf groupinstall 'Development Tools' -y | |
dnf install gcc-c++ -y | |
dnf install rpm-build -y | |
dnf install python-devel -y | |
dnf install python3-devel -y | |
dnf install python-pip -y | |
dnf install python3-pip -y | |
#pip install jupyter | |
pip3 install jupyter | |
python2 -m pip install ipykernel | |
python2 -m ipykernel install | |
# Let's just start the party already! | |
[ -f run_jupyter.sh ] && bash run_jupyter.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Run Jupyter on public port 8888 | |
IP=`curl -s http://whatismyip.akamai.com/` | |
PORT=8888 | |
# Open port 8888, if not opened | |
iptables -nL | grep $PORT >/dev/null || \ | |
echo "Opening port $PORT" && \ | |
iptables -A INPUT -p tcp --dport $PORT -j ACCEPT | |
jupyter notebook --ip=$IP --port=$PORT | |
# Close port 8888 when we're done | |
echo "Closing port $PORT" | |
RULE=`iptables -nL --line-numbers | grep $PORT | cut -d' ' -f1` | |
iptables -D INPUT $RULE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment