Install Python packages - SMOTE and codecarbon

Options
nsrishan
nsrishan Registered Posts: 7 ✭✭✭

Hello,

I am trying to use codecarbon and SMOTE on my dataset through my own Python code. What would be the best way to install them?

Best Answer

  • Turribeach
    Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 1,717 Neuron
    Answer ✓
    Options

    Yes, when you create the Jupyter Notebook you have to specify the correct Python code environment (ie the one you got the new packages installed). Alternatively you can change the code environment from the Notebook itself by doing Kernel => Change Kernel. It is advisable that you set the code environment at the project settings (three dots => Settings => Code env selection) so that all your Python code recipes and notebooks default to the correct code env.

Answers

  • Turribeach
    Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 1,717 Neuron
    Options
  • nsrishan
    nsrishan Registered Posts: 7 ✭✭✭
    Options

    Thank you. Is there a video for how to do this? I'm not sure where to go after creating the new python environment.

  • Turribeach
    Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 1,717 Neuron
    Options

    Go to the Code Environment, on the left select "Packages to Install". On the Requested packages box type all the package names you want, one for each line. You can use version numbers if you know what version you want otherwise just use the package name. For example:

    cash==2.0.0

    Then click on Save and Update and the package should be installed. If there is an error the install log screen will remain visible, if no error it will dissapear. You can confirm the installation on the Currently installed packages on the left.

  • nsrishan
    nsrishan Registered Posts: 7 ✭✭✭
    Options

    Thank you! One more question, when I run my recipe, everything seems to be working fine. However, if I switch over to the jupyter notebook, I am getting an error again about the packages not existing. Is there anything I should be doing after installing them in the environment?

Setup Info
    Tags
      Help me…