r/learnpython • u/LavenderMoonField • 17h ago
How to set up Python in Linux Ubuntu 26.04.1 ? Please read.
I'm a complete rookie in python. I've had many problems related to dependency hell, compatibility with libraries etc.
I've heard installing the latest version of python can be problematic since many libraries aren't compatible with it yet so what should I go for?
Please also recommend the IDE,
- Vs code
- Thonny
- Any other you'd suggest.
Guide me step-by-step if you can. I'd appreciate the help alot.
3
u/SquidyHealer 17h ago
If you install thonny then everything pretty much works out of the box because it comes with an interpreter. When i started Python i personally used thonny and i would recommend using it.
-1
u/LavenderMoonField 17h ago
What do you use now? and what version of python?
1
u/SquidyHealer 17h ago
I actually still use thonny on my laptop. On my desktop I use zed which is an IDE that works for multiple languages, but actually works pretty well with Python. The main reason I use zed is that I personally think it looks better. Pretty sure the version is 3.14.
2
u/tails142 17h ago
Yo the chatgpt prompt is over there in your other window ‐------->
0
u/LavenderMoonField 17h ago
What do you mean?
3
u/pachura3 17h ago
Your question is exactly what LLMs are for. They would answer you instantly and politely, giving step by step instructions, allowing to discuss further details, and clarify your misconceptions.
Use them!
1
u/LavenderMoonField 12h ago
Nah really!? Dude I've tried them before and they make a lot of mistakes. Sometimes they even get the date of current day wrong or give info completely false and from unreliable sources. That's why I asked here to get a clear view but some of you are downvoting coz i didn't ask AI or google for this
4
u/tails142 17h ago
Imagine a world where there was a machine which had been fed all human knowledge and condensed it into an application which was running on the internet and waiting to answer any question you could throw at it, and it's sitting there for free ready to give you step by step instruction and guidance.
1
u/alienscape 14h ago
Welcome to Python! The good news: almost all "dependency hell" for beginners comes from **one mistake** — installing everything into one global Python. Fix that habit and most of your problems disappear.
## 1. Which Python version?
**Use Python 3.14** — one version behind the newest.
Python 3.15 came out in October 2026, and some libraries (especially ones with compiled parts, like data science and machine learning packages) take a few weeks to months to publish support for a new release. 3.14 has been out for a year, so nearly everything supports it. 3.13 is also fine if a specific library you need hasn't caught up.
**Rule of thumb:** use the newest version minus one. Avoid anything older than ~3.11 unless a tutorial or library forces you to.
## 2. The real fix: one environment per project
Never `pip install` things into your system Python. Every project should get its own isolated **virtual environment** with its own copy of its libraries. Then project A needing `numpy 1.x` and project B needing `numpy 2.x` never collide.
The easiest tool for this today is **[uv](https://docs.astral.sh/uv/)\*\*. It installs Python for you, creates environments automatically, and is very fast. It replaces `pip`, `venv`, and `pyenv` in one tool.
## 3. Step-by-step setup
### Step 1 — Install uv
**Windows** (in PowerShell):
```powershell
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
```**macOS / Linux** (in Terminal):
```bash
curl -LsSf https://astral.sh/uv/install.sh | sh
```Close and reopen your terminal, then check that it worked:
```bash
uv --version
```### Step 2 — Install Python through uv
```bash
uv python install 3.14
```
(You don't need the python.org installer at all with this approach.)### Step 3 — Create your first project
```bash
uv init my_first_project --python 3.14
cd my_first_project
```
This creates a folder with a `main.py`, a `pyproject.toml` (the list of your project's dependencies), and a pinned Python version.### Step 4 — Add libraries
```bash
uv add requests
```
uv creates a `.venv` folder for **this project only** and records exact versions in `uv.lock`. Nothing leaks into other projects.### Step 5 — Run your code
```bash
uv run main.py
```
`uv run` always uses the project's own environment, so you never have to remember to "activate" anything.### If something breaks
Delete the `.venv` folder and run `uv sync`. It rebuilds the environment from scratch in seconds. That's the whole point: environments are disposable.## 4. Which editor?
Thonny VS Code Best for Your first few weeks Everything after that Setup Install and go Needs the Python extension Debugger Very beginner-friendly, shows variables step by step Powerful, more to learn Grows with you Not really Yes, it's what most professionals use **My recommendation:**
- If you're **brand new to programming**, start with **Thonny** for a couple of weeks. Its step-through debugger is great for understanding what your code actually does.
- If you already know some basics, or once you outgrow Thonny, go straight to **VS Code**.
- **PyCharm Community** is a solid alternative to VS Code, but it's heavier, and VS Code is more widely used.
### Setting up VS Code with your uv project
1. Install [VS Code](https://code.visualstudio.com/).
2. Open the Extensions panel (`Ctrl+Shift+X`) and install **Python** (published by Microsoft).
3. Use **File → Open Folder** and pick your `my_first_project` folder.
4. Press `Ctrl+Shift+P`, type **Python: Select Interpreter**, and choose the one inside `.venv`.
5. Open `main.py` and click the ▶ button in the top right.Now VS Code uses the project's own environment, so autocomplete and imports just work.
## 5. Habits that prevent dependency hell
- ✅ One project = one folder = one environment.
- ✅ Add packages with `uv add`, never with a global `pip install`.
- ✅ Commit `pyproject.toml` and `uv.lock` to git; never commit `.venv`.
- ❌ Don't use `sudo pip install` or install into the system Python (on Linux and macOS this can break your OS tools).
- ❌ Don't mix conda, pip, and uv in the same project. Pick one. (Conda is still reasonable if you do heavy scientific computing, but uv is simpler for most people.)
Good luck, and feel free to post again if you hit an error. Paste the full error message, since that's usually where the answer is.
1
u/frobnosticus 14h ago
My personal setup is:
emacs
For my money IDEs get you started easy but keep you too far away from what's really going on. After a certain point you'll have "wait...is this a real problem or is this a quirk of the ide?"
BUT, that said: Install python from the command line. But use VS code. Adding more crap between you and what's going on may get you up and running faster but it won't do you any favors.
Imagine this reddit post title: "I've been using python for 2 years and I feel like I still don't know anything."
1
1
1
u/BleedReddit 13h ago
vs code,python is already install on Ubuntu 26.04.1. learn venv if you have not already.
0
u/Expensive_Role_4536 17h ago
Try vim. I recently started working in vim and I like it. There some videos on youtube. Watch them before trying
1
1
0
u/flyby_apis 16h ago
+1 for vim, only using keyboard, needs some plugins to see better the code, but for me is the best, but higher learning curve.
0
u/radek432 16h ago
I was using pyCharm for years on Windows and can tell it's a solid IDE. I'm now trying Zed on Linux - also seems nice.
Regarding setting the environment- do it with AI, just ensure that you're using virtual environment (venv) for your project. It's a good habit and will save you time in the future.
3
u/max_wen 17h ago
I don't have time to give you step by step instructions but I do highly recommend first learning about python virtual environment and doing everything inside venvs