Skip to content

Instantly share code, notes, and snippets.

@djbower
Last active February 28, 2024 19:12
Show Gist options
  • Select an option

  • Save djbower/c82b4a70a3c3c74ad26dc572edefdd34 to your computer and use it in GitHub Desktop.

Select an option

Save djbower/c82b4a70a3c3c74ad26dc572edefdd34 to your computer and use it in GitHub Desktop.
Spyder_development

Setting up a development environment with Spyder and Anaconda for Python projects

This is a mostly GUI-based approach to install and develop a Python package that should be particularly convenient for Windows users.

  1. Set up a Python environment by installing Anaconda and using the Anaconda Navigator. Set up an environment using a supported version of Python for the package you wish to install.
  2. Using the Anaconda Navigator, go to Home and install Spyder into the environment.
  3. Mac: In Anaconda Navigator, go to Environments and click on the green/white arrow and select Open Terminal Windows: Access the Anaconda Prompt
  4. Windows: You may have to implement this fix for the conda install commands below to work.
  5. In the terminal, make sure that the environment is activated. If it is not, you can activate it:
    conda activate your_environment_name
    
  6. Install Spyder Notebook into the environment:
    conda install spyder-notebook -c conda-forge
    
  7. Install Spyder Terminal into the environment:
    conda install spyder-terminal -c conda-forge
    
  8. Go to Home and Launch Spyder in the environment.
  9. Set the working directory in Spyder to the code repository. With this set, you can click on the Files tab to view the files and directories in the code repository.
  10. Select the Terminal tab and activate the environment:
    conda activate your_environment_name
    
  11. Install the package into the environment using pip:
    pip install -e .
    
  12. If the package has installed successfully you will be able to import package_name in the iPython Console. If this does not work, close Spyder, relaunch Spyder, and try to import package_name in the iPython Console again.
  13. Open a Notebook from the code repository using the Notebook tab and clicking the three dots in the top right of the panel.
  14. Once the notebook has loaded, if the text in the top right reads Not Trusted, click on this text and then Trust.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment