Installation Guide for Windows#

This guide walks you through installing SpectroChemPy on Windows, step by step. No previous experience with the command line is needed: every command can be copied and pasted.

Choosing an Installation Method#

Three installation methods are described below, each based on a different package manager (the tool that installs Python packages). Pick one and follow only its tab, from the first step to the last. The steps of one tab do not apply to the others.

  • uv (recommended): the simplest choice if you are new to Python. uv also downloads Python for you.

  • conda / mamba: choose it if you already use Miniforge, Anaconda or conda environments, or if you also want other scientific tools from conda-forge.

  • pip and venv: uses a Python that you install yourself from python.org.

Two folders are involved, and it is good practice to keep them separate:

  • the environment, named scpy, which contains Python, SpectroChemPy and its dependencies. You never need to open or modify it. With uv and venv, this guide puts it in %USERPROFILE%\scpy (that is, C:\Users\<yourName>\scpy); with conda / mamba, Miniforge stores it in its own folder.

  • your working folder, which contains your data, scripts and notebooks. It can be any folder you like, for instance a spectrochempy folder in your Documents. Below, it is written <yourWorkingFolder>: replace it with the full path of your folder, which you can copy from the address bar of the File Explorer (for instance C:\Users\<yourName>\Documents\spectrochempy).

Warning

Do not create the environment in a folder synchronized with the cloud (OneDrive, Google Drive, Dropbox…): it contains thousands of files, which slows down the synchronization and can break the environment. On many computers, OneDrive synchronizes the Documents and Desktop folders. Your working folder, on the other hand, can be synchronized.

Tip

To open the Command Prompt, click the Start menu, type cmd, and select “Command Prompt”. To paste a command in it, right-click or press Ctrl+V, then press Enter.

Step-by-step Installation#

1. Install uv. Open Windows PowerShell (Start menu, type powershell) and run:

powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

Then close PowerShell. Other ways to install uv (winget, pipx…) are listed in uv’s installation guide.

2. Open a new Command Prompt (Start menu, type cmd).

3. Create and activate the environment in %USERPROFILE%\scpy (uv downloads Python if needed):

uv venv "%USERPROFILE%\scpy" --python 3.13
"%USERPROFILE%\scpy\Scripts\activate"

The prompt now starts with (scpy).

4. Install SpectroChemPy:

uv pip install spectrochempy

Optional: JupyterLab. The tutorials of this documentation are notebooks. To run them, beginners are advised to install JupyterLab in the same environment:

uv pip install jupyterlab

5. Create a desktop shortcut. It opens a Command Prompt in your working folder with the scpy environment already active, so you do not have to type the activation commands each time.

  • Open Notepad and paste the following lines. Replace <yourWorkingFolder> with the path of your working folder, keeping the quotes:

    @REM open a Command Prompt in the scpy environment
    @CD /D "<yourWorkingFolder>"
    @CMD /K "%USERPROFILE%\scpy\Scripts\activate.bat"
    
  • Choose File > Save as, select “All files (*.*)” as file type, and save it as activate-scpy.bat in your working folder.

  • In the File Explorer, right-click activate-scpy.bat and choose Send to > Desktop (create shortcut) (on Windows 11, first choose Show more options).

  • Rename the shortcut on the desktop, for instance “SpectroChemPy prompt (scpy)”.

6. Check the installation. Double-click the shortcut: the prompt opens in your working folder and starts with (scpy). Start IPython and import SpectroChemPy:

ipython
In [1]: import spectrochempy as scp

Type exit to leave IPython. If you installed JupyterLab, type jupyter lab: JupyterLab opens in your browser, in your working folder. From now on, use the shortcut each time you work with SpectroChemPy. Without the shortcut, open the Command Prompt and run:

cd /D "<yourWorkingFolder>"
"%USERPROFILE%\scpy\Scripts\activate"

If something goes wrong

  • 'uv' is not recognized as an internal or external command: the Command Prompt was opened before uv was installed. Close it and open a new one. The message printed by the uv installer about Path can be ignored.

  • A virtual environment already exists: the environment was already created. To start again from scratch, add --clear to the uv venv command.

  • The system cannot find the path specified when opening the shortcut: the path of the working folder or of the environment in the .bat file is wrong. Copy it again from the address bar of the File Explorer, and keep the quotes.

  • Otherwise, see Getting Help.

Next Steps#

Proceed to the Guides to start using SpectroChemPy.

Note

If you encounter any issues, see Getting Help for support options.