this post was submitted on 15 Jun 2026
11 points (100.0% liked)

No Stupid Questions

48507 readers
902 users here now

No such thing. Ask away!

!nostupidquestions is a community dedicated to being helpful and answering each others' questions on various topics.

The rules for posting and commenting, besides the rules defined here for lemmy.world, are as follows:

Rules (interactive)


Rule 1- All posts must be legitimate questions. All post titles must include a question.

All posts must be legitimate questions, and all post titles must include a question. Questions that are joke or trolling questions, memes, song lyrics as title, etc. are not allowed here. See Rule 6 for all exceptions.



Rule 2- Your question subject cannot be illegal or NSFW material.

Your question subject cannot be illegal or NSFW material. You will be warned first, banned second.



Rule 3- Do not seek mental, medical and professional help here.

Do not seek mental, medical and professional help here. Breaking this rule will not get you or your post removed, but it will put you at risk, and possibly in danger.



Rule 4- No self promotion or upvote-farming of any kind.

That's it.



Rule 5- No baiting or sealioning or promoting an agenda.

Questions which, instead of being of an innocuous nature, are specifically intended (based on reports and in the opinion of our crack moderation team) to bait users into ideological wars on charged political topics will be removed and the authors warned - or banned - depending on severity.



Rule 6- Regarding META posts and joke questions.

Provided it is about the community itself, you may post non-question posts using the [META] tag on your post title.

On fridays, you are allowed to post meme and troll questions, on the condition that it's in text format only, and conforms with our other rules. These posts MUST include the [NSQ Friday] tag in their title.

If you post a serious question on friday and are looking only for legitimate answers, then please include the [Serious] tag on your post. Irrelevant replies will then be removed by moderators.



Rule 7- You can't intentionally annoy, mock, or harass other members.

If you intentionally annoy, mock, harass, or discriminate against any individual member, you will be removed.

Likewise, if you are a member, sympathiser or a resemblant of a movement that is known to largely hate, mock, discriminate against, and/or want to take lives of a group of people, and you were provably vocal about your hate, then you will be banned on sight.



Rule 8- All comments should try to stay relevant to their parent content.



Rule 9- Reposts from other platforms are not allowed.

Let everyone have their own content.



Rule 10- Majority of bots aren't allowed to participate here. This includes using AI responses and summaries.



Credits

Our breathtaking icon was bestowed upon us by @Cevilia!

The greatest banner of all time: by @TheOneWithTheHair!

founded 3 years ago
MODERATORS
 

No idea where else to ask this.

I'm trying to get PyGame working on my machine. Installed using sudo apt install python3-pygame and it installs fine, but when I try to run a file that imports pygame, I get a module error telling me there's no module named pygame that exists. Nothing I've looked into online seems to help. I thought, maybe since the file is being run out of my Documents folder and pygame is installed in my root folder, that I'd import pygame directly from the root. I used sys.path.insert(1, '/lib/python3/dist-packages') to insert the folder and then imported pygame, which changed the error to from pygame.base import * # pylint: disable=wildcard-import; lgtm[py/polluting-import]. I have no idea what's going on or how to fix this. Most threads online I see are for Windows, so I'm not sure how much the advice applies to Linux, and the ones that do specify for Linux have conflicting advice or don't make sense to me. I'm just trying to get the damn thing to work.

System Specs:System: Kernel: 6.14.0-37-generic arch: x86_64 bits: 64 compiler: gcc v: 13.3.0 Desktop: Cinnamon v: 6.4.8 tk: GTK v: 3.24.41 wm: Muffin dm: LightDM Distro: Linux Mint 22.1 Xia base: Ubuntu 24.04 noble Machine: Type: Laptop System: HP product: HP Laptop 15-fc0xxx v: N/A serial: Chassis: type: 10 serial: Mobo: HP model: 8B2F v: 52.42 serial: part-nu: 9Q1E9UA#ABA UEFI: AMI v: F.10 date: 12/21/2023 Battery: ID-1: BAT0 charge: 34.3 Wh (100.0%) condition: 34.3/34.3 Wh (100.0%) volts: 12.7 min: 11.2 model: HP Primary serial: status: full CPU: Info: quad core model: AMD Ryzen 5 7520U with Radeon Graphics bits: 64 type: MT MCP arch: Zen 2 rev: 0 cache: L1: 256 KiB L2: 2 MiB L3: 4 MiB Speed (MHz): avg: 3515 high: 4003 min/max: 400/4386 boost: enabled cores: 1: 3987 2: 3988 3: 2457 4: 1831 5: 3973 6: 3902 7: 4003 8: 3985 bogomips: 44717 Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm Graphics: Device-1: AMD Mendocino vendor: Hewlett-Packard driver: amdgpu v: kernel arch: RDNA-2 pcie: speed: 16 GT/s lanes: 16 ports: active: eDP-1 empty: DP-1, DP-2, HDMI-A-1, Writeback-1 bus-ID: 03:00.0 chip-ID: 1002:1506 temp: 60.0 C Device-2: Chicony HP True Vision HD Camera driver: uvcvideo type: USB rev: 2.0 speed: 480 Mb/s lanes: 1 bus-ID: 5-1:2 chip-ID: 04f2:b78f Display: x11 server: X.Org v: 21.1.11 with: Xwayland v: 23.2.6 driver: X: loaded: amdgpu unloaded: fbdev,modesetting,vesa dri: radeonsi gpu: amdgpu display-ID: :0 screens: 1 Screen-1: 0 s-res: 1366x768 s-dpi: 96 Monitor-1: eDP-1 mapped: eDP model: BOE Display 0x0949 res: 1366x768 dpi: 101 diag: 395mm (15.5") API: EGL v: 1.5 platforms: device: 0 drv: radeonsi device: 1 drv: swrast gbm: drv: kms_swrast surfaceless: drv: radeonsi x11: drv: radeonsi inactive: wayland API: OpenGL v: 4.6 compat-v: 4.5 vendor: amd mesa v: 25.2.8-0ubuntu0.24.04.2 glx-v: 1.4 direct-render: yes renderer: AMD Radeon 610M (radeonsi raphael_mendocino LLVM 20.1.2 DRM 3.61 6.14.0-37-generic) device-ID: 1002:1506 Audio: Device-1: AMD Rembrandt Radeon High Definition Audio vendor: Hewlett-Packard driver: snd_hda_intel v: kernel pcie: speed: 16 GT/s lanes: 16 bus-ID: 03:00.1 chip-ID: 1002:1640 Device-2: AMD ACP/ACP3X/ACP6x Audio Coprocessor vendor: Hewlett-Packard driver: snd_pci_acp6x v: kernel pcie: speed: 16 GT/s lanes: 16 bus-ID: 03:00.5 chip-ID: 1022:15e2 Device-3: AMD Family 17h/19h HD Audio vendor: Hewlett-Packard driver: snd_hda_intel v: kernel pcie: speed: 16 GT/s lanes: 16 bus-ID: 03:00.6 chip-ID: 1022:15e3 API: ALSA v: k6.14.0-37-generic status: kernel-api Server-1: PipeWire v: 1.0.5 status: active with: 1: pipewire-pulse status: active 2: wireplumber status: active 3: pipewire-alsa type: plugin Network: Device-1: Realtek RTL8852BE PCIe 802.11ax Wireless Network [1T1R] vendor: Hewlett-Packard driver: rtw89_8852be v: kernel pcie: speed: 2.5 GT/s lanes: 1 port: f000 bus-ID: 02:00.0 chip-ID: 10ec:b85b IF: wlp2s0 state: up mac: Bluetooth: Device-1: Realtek Bluetooth Radio driver: btusb v: 0.8 type: USB rev: 1.0 speed: 12 Mb/s lanes: 1 bus-ID: 1-2:2 chip-ID: 0bda:b85d Report: hciconfig ID: hci0 rfk-id: 4 state: down bt-service: enabled,running rfk-block: hardware: no software: yes address: Drives: Local Storage: total: 476.94 GiB used: 400.83 GiB (84.0%) ID-1: /dev/nvme0n1 vendor: Samsung model: MZVL4512HBLU-00BH1 size: 476.94 GiB speed: 63.2 Gb/s lanes: 4 serial: temp: 40.9 C Partition: ID-1: / size: 467.89 GiB used: 400.82 GiB (85.7%) fs: ext4 dev: /dev/nvme0n1p2 ID-2: /boot/efi size: 511 MiB used: 6.1 MiB (1.2%) fs: vfat dev: /dev/nvme0n1p1 Swap: ID-1: swap-1 type: file size: 2 GiB used: 1.59 GiB (79.4%) priority: -2 file: /swapfile Sensors: System Temperatures: cpu: 69.9 C mobo: N/A gpu: amdgpu temp: 59.0 C Fan Speeds (rpm): fan-1: 4170 fan-2: 0 Repos: Packages: 3627 pm: dpkg pkgs: 3601 pm: flatpak pkgs: 26 No active apt repos in: /etc/apt/sources.list No active apt repos in: /etc/apt/sources.list.d/amdgpu-proprietary.list Active apt repos in: /etc/apt/sources.list.d/amdgpu.list 1: deb https: //repo.radeon.com/amdgpu/6.2/ubuntu noble main Active apt repos in: /etc/apt/sources.list.d/cappelikan-ppa-jammy.list 1: deb [signed-by=/etc/apt/keyrings/cappelikan-ppa-jammy.gpg] https: //ppa.launchpadcontent.net/cappelikan/ppa/ubuntu jammy main Active apt repos in: /etc/apt/sources.list.d/github-cli.list 1: deb [arch=amd64 signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https: //cli.github.com/packages stable main Active apt repos in: /etc/apt/sources.list.d/google-chrome.list 1: deb [arch=amd64] https: //dl.google.com/linux/chrome/deb/ stable main Active apt repos in: /etc/apt/sources.list.d/mullvad.list 1: deb [signed-by=/usr/share/keyrings/mullvad-keyring.asc arch=amd64] https: //repository.mullvad.net/deb/stable noble main Active apt repos in: /etc/apt/sources.list.d/official-package-repositories.list 1: deb http: //packages.linuxmint.com xia main upstream import backport 2: deb http: //archive.ubuntu.com/ubuntu noble main restricted universe multiverse 3: deb http: //archive.ubuntu.com/ubuntu noble-updates main restricted universe multiverse 4: deb http: //archive.ubuntu.com/ubuntu noble-backports main restricted universe multiverse 5: deb http: //security.ubuntu.com/ubuntu/ noble-security main restricted universe multiverse Active apt repos in: /etc/apt/sources.list.d/rocm.list 1: deb [arch=amd64] https: //repo.radeon.com/rocm/apt/6.2 noble main Active apt repos in: /etc/apt/sources.list.d/unit193-encryption-noble.list 1: deb [signed-by=/etc/apt/keyrings/unit193-encryption-noble.gpg] https: //ppa.launchpadcontent.net/unit193/encryption/ubuntu noble main Active apt repos in: /etc/apt/sources.list.d/google-chrome.sources 1: deb [arch=amd64] https: //dl.google.com/linux/chrome-stable/deb/ stable main Active apt repos in: /etc/apt/sources.list.d/megaio.sources 1: deb https: //mega.nz/linux/repo/xUbuntu_24.04/ ./ Info: Memory: total: 8 GiB note: est. available: 7.01 GiB used: 5 GiB (71.4%) Processes: 368 Power: uptime: 16h 43m wakeups: 3 Init: systemd v: 255 target: graphical (5) default: graphical Compilers: gcc: 13.3.0 alt: 11/12 Client: Unknown python3.12 client inxi: 3.3.34

Also, as I was typing my system specs, a random website called https://termbin.com/jdpt opened with all my system specs on it. I don't know what this is or how it opened or why, and I'm lowkey scared but it's nifty ig. Anyone know how that opened?

Edit: Oh, also, I have an IDE and I know I can get it to run in the IDE because I had to for a project last semester, but I'm trying to avoid it and work on everything in text editor and from the terminal as a challenge to myself. Also pygame runs like shit through my IDE (Pycharm)

EDIT: Got one solution from a classmate in discord. I installed a virtual environment following this link (provided by lokalhorst below). After, I had to run source venv/bin/activate in the home folder of the project, where venv is the name of the virtual environment I created. This turned my terminal into a... something, I think a virtual environment. Anyways there's now a (venv) at the very start of the terminal entries now, and pygame works fine.

Ideally, I would still like to be able to run it without actually using a virtual environment. Again according to lokalhorst (huge thanks to you btw), running a virtual environment is best practice instead of modifying the OS python install, but I'm not sure if I want to have to run a venv every time I make a project. I'll figure that out later though, maybe at some point make an executable that doesn't require a venv or something. idk, still figuring things out.

you are viewing a single comment's thread
view the rest of the comments
[–] Contramuffin@lemmy.world 3 points 19 hours ago* (last edited 19 hours ago) (1 children)

You'll want to use a virtual environment. You can use the system-installed python for this (but note that you should really try to avoid using system python for anything else). You'll want to do

python -m venv path/to/virtual/environment

Once you have one set up, you can use pip to install modules. So you'll want to find the python file inside the virtual environment. Go into the folder, and you should be able to find it in ../bin/python. This is what you'll want to use from now on. So to use pip to install things: path/to/virtual/environment/bin/python pip install pygame

Then, you can run programs through the virtual environment with the same method. ie, path/to/virtual/environment/bin/python path/to/game.py

If you don't specify the path, the command will assume you're trying to use the system-installed python

[–] ComicalMayhem@lemmy.world 1 points 19 hours ago (1 children)

Following someone else's suggestions, I made a venv file called venv and installed pygame in it using venv/bin/pip install pygame from the directory where I have the main project in. Interestingly, it installed just fine, but when I try to do pip install pygame while in the virtual environment's bin folder, I get the externally managed environment error. My venv folder doesn't have an environment folder, it's just ~/path-to/venv, where venv is the name of the virtual environment. probably should have picked a different name tbh. Anyways I followed your suggestion making replacements where necessary to run the program. Dunno if I'm doing something wrong but it isn't working for me.

[–] Contramuffin@lemmy.world 3 points 19 hours ago* (last edited 19 hours ago)

It's not just about being in the right folder. You need to specify the path. If you just do python file.py or pip install whatever

It will try to use system components, regardless of what folder you're in. You'll need to explicitly say, "use this specific venv version of python or pip." If you're in the bin folder of the venv, you'll need to use ./python file.py or ./pip install whatever