3.3. Virtual environment-based installation

If the pipx-based installation does not work for you, you don’t want to use pyenv or pipx, or if you are having trouble with those tools, there are a couple of alternatives.

3.3.1. Installing Anaconda Python

To install Anaconda, just go to the official Anaconda webpage and download and install a version appropriate for your operative system. Do not worry about the Python version as conda will let you choose that when creating a virtual environment.

The installer should guide you step by step on the process of installing Anaconda and configuring your system to use it as your Python installation.

3.3.2. Creating virtual environments

Although not strictly necessary, creating a virtual environment is highly recommended regardless of how you installed Python. It will isolate users and developers from changes occurring on their operating system, and from conflicts between python packages and it ensures reproducibility from day to day.

Using pipx ensures that each application it installs has its own virtual environment, running it under the hood. However, you can explicitly create and manage the virtual environment if you prefer.

3.3.2.1. Creating a conda virtual environment

This option is available only if you installed Anaconda Python. Depending on the settings you used when installing Anaconda and your operative system, you might have conda available in your normal terminal or you might need to use the Anaconda Prompt.

conda not only lets you create a virtual environment but also selecting which python version to use within, independently of the version of Anaconda Python installed, which means it can be an alternative to pyenv if it happens that you already have Anaconda installed in your system.

To create an environment called muse_env run:

conda create -n muse_env python=3.9

Now, you can activate the environment with:

conda activate muse_env

Later, to recover the system-wide “normal” python, deactivate the environment with:

conda deactivate

3.3.2.2. Creating a virtual environment with venv

Modern Python versions, regardless of their origin, come with a built in tool to create virtual environments, venv. However, contrary to conda it does not let you select the version of Python that will be used - it will be the same one you are using to create the environment. Therefore, you still need to make sure your version of Python is compatible with MUSE. You can check it with python --version.

Another caveat is that the virtual environment will be created in a specific folder, so whenever you want to use it in the future, you will need to remember in what folder it was created and activate the environment from there.

You can create a virtual environment with:

python -m venv venv

And then you activate the environment with:

  • Linux:

    source venv/bin/activate
    
  • MacOS:

    . venv/bin/activate
    
  • Windows:

    venv\Scripts\Activate.ps1
    

Later, to recover the system-wide “normal” python, deactivate the environment with:

deactivate

3.3.3. Installing MUSE in a virtual environment

Regardless of the method used, once it has been created and activated, you can install MUSE within using:

python -m pip install muse-os

And then use it by invoking muse with the relevant input arguments. Keep in mind that, contrary to using pipx, in this case you will need to manually activate the environment every time you want to use MUSE.