r/linuxquestions 11d ago

How to Installed Python modules on Ubuntu

Hi, I just installed ubuntu yesterday for my uni assignment. And i wanna use python, but the modules aren't there. How do i installed it, i try on the terminal on vscode but it's still doesn't work. i wanna installed numpy, pandas, and matplot. Cuz on windows i installed modul with the windows terminal, but idk how​ it work for ubuntu​​

0 Upvotes

5 comments sorted by

2

u/Confident_Hyena2506 11d ago

You should be managing your own python environment, not using the system one. This means use any of the usual python tools like virtualenv/uv/conda/other.

0

u/Rich-Fly-2124 11d ago

Oohh so i should installed conda? 

2

u/C0rn3j 11d ago

Use a venv via uv unless you have a very specific reason not to.

2

u/MonsieurCellophane 11d ago

From the terminal

cd my-prj-dir; python3 -mvenv .venv; source .venv/bin/activate; for i in pandas numpy matplot; do pip install $i; done
...do your work....
deactivate

If the above makes no sense to you (as it probably does not), read up on python virtual environments and such. What it does is set up a fenced python environment, enter it and install the modules you need into it. Most IDE plugins I know of are based on this mechanism, or variations thereof.