-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Labels
bookworm 🐛Issue with BookwormIssue with Bookwormpi5 5️⃣It's the everything computer. optimised.It's the everything computer. optimised.working as expected
Milestone
Description
Ref: https://www.raspberrypi.com/documentation/computers/os.html#python-on-raspberry-pi
Perhaps add a mention of the potential need for "--system-site-packages" when invoking venv?
For example, the recommended python api for wrangling gpio pins is gpiozero. This is installed system-wide via apt by default. It is then not available from within a venv environment by default.
This might be confusing/frustrating to a beginner?
Example -
david@rp5bw101064fssk:~/Projects $ python -m venv NoSite
david@rp5bw101064fssk:~/Projects $ source NoSite/bin/activate
(NoSite) david@rp5bw101064fssk:~/Projects $ python
Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import gpiozero
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'gpiozero'
>>>
(NoSite) david@rp5bw101064fssk:~/Projects $ deactivate
david@rp5bw101064fssk:~/Projects $ python -m venv --system-site-packages PlusSite
david@rp5bw101064fssk:~/Projects $ source PlusSite/bin/activate
(PlusSite) david@rp5bw101064fssk:~/Projects $ python
Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import gpiozero
>>>
Metadata
Metadata
Assignees
Labels
bookworm 🐛Issue with BookwormIssue with Bookwormpi5 5️⃣It's the everything computer. optimised.It's the everything computer. optimised.working as expected