Install Python packages - SMOTE and codecarbon
![nsrishan](https://us.v-cdn.net/6038231/uploads/Dataiku/nAvatar8.png)
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 Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 1,876 Neuron
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 Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 1,876 Neuron
-
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 Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 1,876 Neuron
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.
-
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?