Using PyCharm

PyCharm is an IDE that integrates with IPython Notebook, has an interactive Python console, and supports Anaconda as well as multiple scientific packages. PyCharm supports creating virtual environments for Python with conda.


Configuring a conda environment in PyCharm

  1. In the Settings/Preferences dialog (⌘,), select Project: <project name> | Project Interpreter.

    ../../../../_images/configure-env.png

  2. Alternatively, from the Welcome screen, select Configure.

    ../../../../_images/create-project.png

  3. Select Preferences.

    ../../../../_images/create-preferences.png

  4. Select Project Interpreter.

    ../../../../_images/project-interpreter.png

  5. In the Project Interpreter page, click the gear icon and select Add.

    ../../../../_images/add-interpreter.png

  6. In the left-hand pane of the Add Python Interpreter dialog box, select Conda Environment. The following actions depend on whether the conda environment existed before.

    ../../../../_images/add-new-env.png

  7. If New environment is selected:
    1. Specify the location of the new conda environment in the text field or click the folder icon and find location in your file system.

      Note

      The directory where the new conda environment should be located must be empty.

    2. Select the Python version from the drop-down list.

    3. Specify the location of the conda executable file in the text field or click the ellipsis and find the location in the conda installation directory.

    4. If needed, select the Make available to all projects check box.

  8. If Existing environment is selected:
    1. Specify the required interpreter: use the drop-down list or click and find one in your file system (for example, C:UsersjetbrainsAnaconda3python.exe).
    2. Select the check box Make available to all projects (if needed).
  9. Click OK to complete the task.

Adding a package to a project

The project uses the flask package which is available on the Anaconda defaults channel.

../../../../_images/helloweb.png

  1. To add flask, select Preferences (⌘,).

    ../../../../_images/add-repo-button.png

  2. Select + to display the packages available in the defaults channel.

    ../../../../_images/available-packages.png

  3. The packages in the defaults channel are displayed. Type “flask” into the search bar and select Install.

    ../../../../_images/flask-pkg.png

  4. After flask is installed, it will be displayed in the project environment.

    ../../../../_images/flask-installed.png

Adding a repository to a project

This project uses the bottle package which is available on the conda-forge channel.

../../../../_images/bottle.png

  1. To add the conda-forge channel, select Preferences (⌘,).

    ../../../../_images/add-flask.png

  2. Select + to display the packages available in the defaults channel.

    ../../../../_images/available-packages.png

  3. To add a repository, select Manage Repositories, select +, and enter “conda-forge”. Select OK.

    ../../../../_images/manage-repos.png

    The packages from both defaults and conda-forge will be displayed.

  4. Type “bottle” into the search bar and select Install.

    ../../../../_images/bottle-install.png

  5. After bottle is installed, it will be displayed in the project environment.

    ../../../../_images/bottle-env.png