Install#
Prerequisites#
Ensure you have Python version
3.10or above: Check that Python3.10or above is installed in your system by opening the terminal/command prompt and executing the following command,python --versionIf you are unable to run the command, or if your Python version is below
3.10, install/update Python.We suggest downloading an installer from Anaconda or Miniconda. The former includes a comprehensive selection of Python packages for data-science and machine learning. The latter is a minimal installer which includes only few packages. If you are not sure which one works best for you, take a look at the Anaconda guidelines.
Create and activate a virtual environment: Once your updated python is up and running, we recommend creating and activating a Python virtual environment using
venvbefore installing NeMoS. This practice helps manage dependencies and avoid conflicts with other Python packages.For
venv, create your virtual environment in a specific directory. This example uses~/python_venvs/nemosfor Linux/Mac andC:%HOMEPATH%\python_venvs\nemosfor Windows; in general, free to use whatever directory works best for you.
Creating and Activating a Virtual Environment#
For macOS and Linux:
Open a terminal.
Run the following commands to create and activate the virtual environment:
python -m venv ~/python_venvs/nemos source ~/python_venvs/nemos/bin/activate
For Windows:
Open a command prompt.
Execute the commands below to create and activate the virtual environment:
python -m venv C:%HOMEPATH%\python_venvs\nemos cd C:%HOMEPATH%\python_venvs\nemos\ .\Scripts\activate
Installation Steps#
After creating you virtual environment, follow one of the following sections below, depending on whether you need GPU support or not:
CPU Installation#
To install NeMoS on a system without a GPU, run this command from within your activated environment,
For macOS/Linux users:
pip install nemos
For Windows users:
python -m pip install nemos
Earlier versions of NeMoS used JAXopt as its optimization backend. As JAXopt is not maintained anymore, NeMoS now relies on Optimistix and Optax. If you still want to use solvers from JAXopt, install it with pip install jaxopt or install NeMoS with pip install "nemos[jaxopt]" and specify a solver name like LBFGS[jaxopt] when creating models.
GPU Installation#
Warning
JAX does not guarantee GPU support for Windows, see here for updates.
For systems equipped with a GPU, you need to specifically install the GPU-enabled versions of jax and jaxlib before installing NeMoS.
Install
jaxandjaxlibfor GPU: Follow the JAX documentation instructions to installjaxandjaxlibwith GPU support.Verify GPU Installation: To ensure
jaxcorrectly recognizes your GPU, execute the following in Python:import jax print(jax.devices())
If your GPU is listed among the devices, the installation was successful.
Install NeMoS: After successfully installing and configuring
jaxfor GPU support, install NeMoS using the same command as in the CPU installation.
Installation For Developers#
Developers should clone the repository and install NeMoS in editable mode, including developer dependencies. Follow these steps:
Clone the repo: From your environment, execute the following commands to clone the repository and navigate to its directory:
git clone https://github.com/flatironinstitute/nemos.git cd nemos
Install in editable mode: Install the package in editable mode (using the
-eoption) and include the developer dependencies (using[dev]):pip install -e .[dev]