Skip to content

Dev: Conda based Spyder Installers

Ryan Clary edited this page May 1, 2023 · 6 revisions

The Spyder team has been releasing standalone applications for macOS and Windows since version 4.2.0. But for version 6.0 we are pivoting to a conda-based installer in order to provide new features and provide a uniform installation experience across platforms.

The new, conda-based, standalone application installer will create an isolated conda environment with a tightly integrated Spyder application. The standalone application will continue to be fully integrated into the operating system, but this new paradigm will provide several advantages over the previous standalone applications.

  • An isolated, dedicated Spyder runtime conda environment lays the foundation for power features (such as installing/uninstalling plugins) that simply were not possible with the previous standalone applications.
  • This new paradigm allows us to harmonize Spyder's standalone application across platforms, including Linux!
  • New features, such as Python environment and package management, will be much easier to implement.

Installing Spyder with a Conda-based Installer

Download the latest release of the Spyder installer for your platfom from Spyder's website or release page.

Uninstall Existing Spyder

If you have already installed Spyder using our conda-based installer, you will need to uninstall it before proceeding.

Windows Open "Add or Remove Programs" from Windows Control Center. Locate Spyder and click Uninstall
macOS When you installed the existing conda-based Spyder, an `uninstall-spyder` command should have been made available to shell sessions. To uninstall Spyder, execute the following in a Terminal.
$ uninstall-spyder

If this command is not available in your shell session, you may execute the uninstall script directly. For example, for Spyder 6.x installed for the user, execute the following in a Terminal.

$ ~/Library/spyder-6/uninstall-spyder.sh
Linux When you installed the existing conda-based Spyder, an `uninstall-spyder` command should have been made available to shell sessions. To uninstall Spyder, execute the following in a terminal.
$ uninstall-spyder

If this command is not available in your shell session, you may execute the uninstall script directly. For example, for Spyder 6.x installed for the user, execute the following in a Terminal.

$ ~/.local/spyder-6/uninstall-spyder.sh

Install Spyder

Windows

After the download is complete, double-click the .exe installer file; a graphical installer will open, guiding you through the installation.

macOS

After the download is complete, double-click the .pkg installer file; a graphical installer will open, guiding you through the installation.

Linux

After the download is complete, right click the installer file (.sh file), select "Settings" and enable "Run as program". Now double click the installer file and a terminal window will open, guiding you through an interactive installation process. When installation is complete, the terminal window will close.

Alternatively, you may execute the Linux installer from an existing terminal session.

$ sh Spyder-<version>-<platform>-<arch>.sh

Further information about the Linux installer can be displayed with the -h flag

$ sh Spyder-<version>-<>.sh -h

Building the Conda-based Spyder Installer

On GitHub CI

The conda-based installers are automatically created on GitHub for Spyder releases and pull-requests. Conda-based installer builds may also be triggered manually on Spyder's Create conda-based installers for Windows, macOS, and Linux actions page.

  • Select the "Run workflow" dropdown menu
  • Select the appropriate branch and options
  • Click "Run workflow" The "Build as release candidate" option will use the latest releases of python-lsp-server, qtconsole, and spyder-kernels. Deselecting this option will build the subrepo versions of those packages located in the external-deps directory of Spyder's git repository. The "Enable ssh debugging" will allow opening an ssh terminal into the current action workflow if a failure occurs.

On Your Local Machine

To build the conda-based installers on your local machine you will need to create the build environment. For these instructions, we assume that you have mamba installed.

  1. Open a command-line session and change directory to the conda-based installer directory of the Spyder repository, create the environment with the desired Python version, and install the reqiured packages for the build environment.

    $ cd /path/to/spyder/installers-conda
    $ mamba create -n spy-inst python=<PYVER>
    $ mamba activate spy-inst
    (spy-inst) $ mamba env update --file build-environment.yml
    
  2. Build spyder, python-lsp-server, qtconsole, and spyder-kernels conda packages.

    (spy-inst) $ python build_conda_pkgs.py [options]
    

    Available options are listed by executing with the --help option.

  3. (Optional) Create a keychain for codesigning the macOS package installer. This step is required if you want to notarize the macOS installer.

    (spy-inst) $ ./certkeychain.sh CERT_PWD APP_CERT INST_CERT
    

    This creates a keychain containing the provided Developer ID Application and Developer ID Installer certificates (base64 encoded). These certificates should be encrypted with the same password, also provided as argument. XCode's codesign command is shadowed by one in the spy-inst environment; this is fixed as follows.

    (spy-inst) $ _codesign=$(which codesign) && [[ $_codesign =~ ${CONDA_PREFIX}.* ]] && mv $_codesign ${_codesign}.bak
    
  4. Build the installer.

    (spy-inst) $ python build_installers.py [options]
    

    Available options are listed by executing with the --help option.

    On macOS, codesigning is accomplished with the option --cert-id=CERTID, and the appropriate certificate identification (Developer ID Application certificate is required). This option is required if you want to notarize the macOS installer.

  5. (Optional) Notarize the macOS package installer. A Developer ID Installer certificate is required and codesigning in the previous step is also required.

    (spy-inst) $ ./notarize.sh dist/spyder-<version>-macOS-<arch>.pkg
    

Developing with the Conda-based Spyder Installer

Since the conda-based installer creates a dedicated conda environment from which Spyder is run, using the standard development practices of bootstrapping from the local repository should be a faithful proxy for how the Spyder will behave from a conda-based installation. However, some circumstances may require explicitly testing the conda-based application. In this case, it is not necessary to make changes to the source code, then create the package installer, then reinstall Spyder. It is sufficient to install Spyder (and subrepos) from source in develop mode into Spyder's dedicated runtime environment. This allows changing Spyder source code and simply restarting Spyder in order to view the changes.

Following are instructions for doing this.

  1. If a conda environment from a conda-based installer does not already exist, follow the instruction above to install the conda-based Spyder standalone application. If you have Spyder already installed as a standalone application that is not conda-based, and you don't want it clobbered, then rename Spyder.app to Spyder.bak.app (macOS) or something for Windows or something for Linux.

  2. Create a local clone of your forked Spyder repository, if you do not already have one.

  3. Install Spyder and subrepos from source into the conda-based Spyder runtime environment. For example, for Spyder 6.x installed for the user, do the following.

    Windows
    $ cd C:\path\to\spyder
    $ mamba run --live-stream -p %HOME%\AppData\spyder-6\envs\spyder-rt python install_dev_repos.py
    
    macOS
    $ cd /path/to/spyder
    $ mamba run --live-stream -p ~/Library/spyder-6/envs/spyder-rt python install_dev_repos.py
    
    Linux
    $ cd /path/to/spyder
    $ mamba run --live-stream -p ~/.local/spyder-6/envs/spyder-rt python install_dev_repos.py
    
Clone this wiki locally