Search code examples
virtualenvjetbrains-idevirtual-environmentdataspell

DataSpell: Create python virtual environment using DataSpell


How to create a virtual environment and activate it using DataSpell?


Solution

  • If you open a directory or a project to the DataSpell workspace, it automatically creates a virtual environment. But, if you want to use a different python version, you can always create another virtual environment.

    Steps to create a new virtual environment: I have used conda environment. So, I am showing here how to create a new conda environment.

    1. Go to File -> Settings -> Project: workspace -> Python Interpreter. Or simply press Ctrl+Alt+S from keyboard.

    enter image description here

    1. Press the settings icon from the right corner and click the Add.. button. Then click on the New environment radio button. Select your python version and locations.
    2. Give a name to your environment. enter image description here
    3. Click on the Make available to all projects checkbox if you want to use this environment for other projects.
    4. Press the OK button and then the OK button again.

    You can change the virtual environment for your project as follows,

    enter image description here

    Like this image, on the bottom right corner of your DataSpell, you see the environment variable. If you click it, you will also see the list of the loaded projects and corresponding environment variables there.

    You can change your environment variable for the specific project from here.