Skip to content

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gadgetoid committed Oct 19, 2023
0 parents commit d4e8b3b
Showing 1 changed file with 113 additions and 0 deletions.
113 changes: 113 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
<!doctype HTML>
<html lang="en">
<head>
<title>Python Virtual Environments on Raspberry Pi Bookworm</title>
<meta name="description" content="An introduction to Python Venv on
Raspberry Pi OS Bookworm." />
<style type="text/css">
code {
white-space: pre;
font-family: ui-monospace,
Menlo, Monaco,
"Cascadia Mono", "Segoe UI Mono",
"Roboto Mono",
"Oxygen Mono",
"Ubuntu Monospace",
"Source Code Pro",
"Fira Mono",
"Droid Sans Mono",
"Courier New", monospace
}
p code {display: inline;}
</style>
</head>
<body>
<header>
<h1>Python Virtual Environments on Raspberry Pi Bookworm</h1>
</header>
<main>
<section>
<header>
<h2>What's a virtual environment?</h2>
</header>
<article>
<p>
While having to care about Python virtual environments
is a bit of a bump in the road to getting started with
Python they're not just a nuisance foisted upon you by
curmudgeonly Linux distribution maintainers.
</p>
<p>
A virtual environment is a useful, logical way of
isolating your project dependencies from each other and
ensuring things don't break when there are conflicts..
</p>
<p>
What happens if you create a new project using Library
v2, but you have old projects that only work with Library
v1? Bad things, that's what. A virtual environments mean
you can just spin up a clean environment for your new
project and never have to worry about breaking or updating
your old ones.
<p>
They are also a great way for a user to install and use
your project without affecting their other Python
environments.
</p>
</article>
</section>
<section>
<header>
<h2> Why do I need one?</h2>
</header>
<article>
<p>
As of Raspberry Pi OS bookworm, you'll get a slap on the
wrist in the form of an error message if you attempt to
<code>pip install</code> any Python libraries on your
Raspberry Pi.
</p>
<p>
It looks something like this:
</p>
<code>$ pip install buildhat
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.

If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.

For more information visit http://rptl.io/venv

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.</code>
<p>
The "TLDR" (too long, don't read) of this message is that
installing libraries from pypi (which is what pip does)
into your system can cause all sorts of here-be-dragons
weirdness and breakage. So it's recommended against.
</p>
<p>
Instead, you use a virtual environment which is just
a bunch of monkeying with paths to ensure your Python
project dependencies are completely self-contained, and
isolated from the system and each other.
</p>
</article>
</section>
<section>
<header>
<h2>Okay, that sounds tedious. Make it easy for me!</h2>
</header>
<article>
</article>
</main>
<footer></footer>
</body>
</html>

0 comments on commit d4e8b3b

Please sign in to comment.