Installing Software
In this page:
Note that installation of a Python/R/Julia package is a one-time process. You will not have to re-install it once you have installed it.
Below are some basic ways to install packages in Python, R, and Julia. We also strongly recommend using tools like conda and Python virtual environments to manage your projects.
Installing Python Packages
Using Jupyter Notebook
In order to install Python packages in a notebook:
- Create a new notebook for Python by clicking the New drop-down menu at the top right corner and then choosing Python. Alternatively, you can open any of your existing notebooks for Python.
Write the following code in a new cell of the notebook and run it:
!pip3 install --upgrade PACKAGE_NAME
- Check if the package has been successfully installed.
Using the Terminal
In order to install Python packages from PyPI (Python Package Index) using pip
:
- Click the New drop-down menu at the top right corner and then choose Terminal.
Type the following command in Terminal and press enter:
python3 -m pip install --user PACKAGE_NAME
- Check if the package has been successfully installed.
- Close the tab.
Notes about Python package installation
1. Please see the pip documentation for more information about using pip.
2. Installing Python packages this way, you can find your Python packages in your user library:
/home/HawkID/.local/lib/pythonx.x/site-packages
where HawkID is your HawkID, and pythonx.x indicates the Python version, for example, Python 3.7.
3. If you are using a user-installed Python package in Terminal, you will need to add your user library to PATH. In Terminal:
First, crease a .bashrc if you haven't done so before:
touch ~/.bashrc
Add your user library to PATH:
echo 'export PATH=$PATH:~/.local/bin' >> ~/.bashrc
And then run the following in Terminal. Note that .bashrc needs to be sourced every time you start a new Terminal session.
source .bashrc
Installing R Packages
Using RStudio
In order to install R packages from CRAN (Comprehensive R Archive Network) :
In the Console tab in RStudio, or in an R script file, type the following code and then run it:
install.packages(c("PACKAGE_NAME_1", "PACKAGE_NAME_2", ...), repos="http://cran.r-project.org")
- Check if the packages have been successfully installed.
Using Jupyter Notebook
In order to install R packages from CRAN (Comprehensive R Archive Network) :
- Create a new notebook for R by clicking the New drop-down menu at the top right corner and then choosing R. Alternatively, you can open any of your existing notebooks for R.
Write the following code in a new cell of the notebook and run it:
install.packages(c("PACKAGE_NAME_1", "PACKAGE_NAME_2", ...), repos="http://cran.r-project.org")
- Check if the packages have been successfully installed.
Installing Julia Packages
In order to install Julia packages using Pkg
:
- Create a new notebook for Julia by clicking the New drop-down menu at the top right corner and then choosing Julia. Alternatively, you can open any of your existing notebooks for Julia.
Write the following code in a new cell of the notebook and run it:
using Pkg Pkg.add(["PACKAGE_NAME_1", "PACKAGE_NAME_2", ...])
- Check if the packages have been successfully installed.