Questions tagged [python]
Python is an interpreted, general-purpose high-level programming language whose design philosophy emphasizes code readability.
2,344 questions
0
votes
0
answers
3
views
Are there any basic Python documentation man pages?
I occasionally use Python and so I forget semantics of basic language constructs. Is there an apt package to install man page of basic Python documentation? My Linux Mint comes only with help of ...
0
votes
0
answers
28
views
Linux kernel “BUG: Bad page state / Bad page cache in process python” during PyTorch distributed training (NVidia 5090 + Ubuntu 22.04) [closed]
I’m encountering a recurring kernel memory error while running heavy PyTorch training workloads .
The system eventually becomes unstable, training stops, SSH disconnects, and the machine needs a ...
0
votes
0
answers
29
views
Packet Demodulation error in GNU Radio for Hackrf SDR - SBand Radio set up connection. [SBand Radio Tx , SDR Rx]
I have a set up in my lab. I am trying to get the S-band chain of my ground station working. My set up is described as Computer connected to a HackRf SDR via the USB and also connected to the Sband ...
2
votes
0
answers
39
views
Automatically check if my Nvidia GPU, CUDA drivers, cuDNN, Pytorch and TensorFlow are all compatible between each other?
I'd like to know if my Nvidia GPU, CUDA drivers, cuDNN, Pytorch and TensorFlow are all compatible between each other ahead of time instead of getting some less explicit error when running code such as:...
1
vote
1
answer
324
views
How can I automatically install all the pip packages used by a Python script?
I wonder how to automatically install all the pip packages used by a Python script. I know one can run:
pip install pipreqs
pipreqs .
pip install -r requirements.txt
But that sometimes fails to ...
0
votes
0
answers
41
views
firewalld corruption python-nftables command not found
this is in RHEL-8.10 x86-64
from a clean install from rhel-8.10-x86_64-dvd.iso and only using the public.xml file;
the only things I do is
# quad port nic with eno4 being my wan connection
firewall-...
-2
votes
1
answer
92
views
updating python now apt is wrecked
I am on Linux mint
DISTRIB_ID=LinuxMint
DISTRIB_RELEASE=20.3
DISTRIB_CODENAME=una
DISTRIB_DESCRIPTION="Linux Mint 20.3 Una"
I wanted to update my python3 to 3.10 or higher to run ...
1
vote
0
answers
31
views
Konsole with application disappears
We develop and distribute an application that controls industrial robots (non real-time typically). We run it on Kubuntu 22.04 in a Konsole window. It is runs continuously for several months at a time....
0
votes
0
answers
71
views
Can't install python via pyenv
I already have Python installed on my WSL2, and its version is [Python 3.12.9 | packaged by conda-forge | (main, Mar 4 2025, 22:48:41) [GCC 13.3.0] on linux]. I tried to install different versions of ...
3
votes
1
answer
261
views
How to run one installed Jupyter Notebook from one venv/virtualenv environment and use packages from another venv/virtualenv?
I've set up different Python venv/virtualenv environments on my Debian 12, each with their own packages.
However, I want to use/install Jupyter Notebook only once (in just one virtual environment).
...
0
votes
0
answers
95
views
module "org.kde.kirigami" and "org.kde.desktop" not installed (On Fedora and ArchLinux)
I'm following the tutorial: A full Python + Kirigami application to learn how to build Python applications using PySide6 and Kirigami for KDE, under Arch Linux and Fedora.
This is my script:
import ...
-1
votes
1
answer
151
views
How to show all Python venvs on my server?
My command prints
>>> import sys
>>> print(sys.prefix)
/home/DEVOPSM/CodeTest_Ucar/venv
Is it possible to list all other virtual environments on Linux?
0
votes
0
answers
55
views
Remote Shell Python3 Stuck & stty raw -echo;fg Kali Linux Problem
So I've been doing CTF Tryhackme called mKingdom and got a remote shell. However, I want an upgrade of the remote terminal so I ran python3 -c 'import pty;pty.spawn("/bin/bash")' , it showed ...
0
votes
0
answers
55
views
Why does Ctrl+C clear the current input line in my Python socket-based Telnet-like shell?
I'm building a simple shell server using raw Python sockets (not using telnetlib). The client connects using PuTTY with the Telnet connection type.
The server displays a basic prompt like:
[user@...
0
votes
1
answer
80
views
Reset Python and QT5 installation for programming GUI in Python-QT
This, when trying to use pycrypto:
warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.
src/MD2.c:31:10: fatal error: Python.h: No such file or directory
...
0
votes
1
answer
96
views
Force Qutebrowser to close tab and open default one when there is one tab in the window
In Qutebrowser, I try to create the following behavior:
tab-close, or at least the action associated with it (i.e., pressing d), should, in all situations where more than one tab is open, close the ...
0
votes
5
answers
172
views
Linux: Can I make a file unreadable by a user but readable by a script being run by that same user? [duplicate]
My situation is that I have a file containing an encryption string in plain text, and a script that reads that file and uses that string to encode an object which is then returned to the user as a ...
0
votes
0
answers
105
views
Pyright in VSCodium is confused about type-checking a function assigned to a variable
I'm using VSCodium with the Pyright plugin for Python type checking. I am puzzled why Pyright is not recognizing a variable as type function, when the code works as expected, and entering this code ...
0
votes
1
answer
116
views
I've installed a Python version manually. How do I get everything to work with this version?
I've downloaded, built and installed a newer version of Python (3.13.2) on an older Linux machine; it's been installed in /opt/python, and it works, i.e. it runs simple scripts using the standard ...
0
votes
1
answer
191
views
Installing python3.10 on debian:stretch-slim image?
I have an docker file where the base image is set to debian:stretch-slim. The default version of python3 is python3.5 in this image.
FROM debian:stretch-slim as base-os
....
....
RUN python3 -V
RUN ...
0
votes
0
answers
83
views
My system doesn't record last log in for users
I wrote a code to display last login date for every user on Ubuntu to help admins define which users are inactive, the problem is it displays every users last logins dates since 1970 (the output looks ...
1
vote
0
answers
71
views
How can I reliably block GUI-initiated system shutdown when systemd-inhibit only delays terminal shutdown commands?
I'm developing a desktop application using PySide6 for Linux, and I need to prevent or delay system shutdowns that are initiated from the graphical interface. I know that running systemd-inhibit --...
0
votes
0
answers
32
views
What are the rules behind finding executables in shebang statements? [duplicate]
I want to create a Docker image that has the Python3 runtime, a Python script of my creation, update-alternatives configured to run python3 when python is invoked, and I want to make the Python script ...
0
votes
1
answer
319
views
How to install DNF packages using Yum when Python packages are in a different location
We have a RHEL 8.10 server, and the default location for Python packages is under /usr/lib/python3.6/site-packages/. This includes, of course, the DNF packages located at /usr/lib/python3.6/site-...
2
votes
1
answer
214
views
Executable not found when executed with cron but works fine when running from CLI
Got this cron, which run some scrapy code
* * * * * cd /var/projects/project-1/scrappers && python3 runner.py
It return this error on the logs
Continue with error: [Errno 2] No such file or ...
1
vote
0
answers
54
views
Xorg not starting when invoked from Python
I'm creating a display manager (dm) in python, which waits to Xorg to start in order to run the GUI.
Python
(omitted unnecessary code like widgets and classes and functions)
import os
(more imports ...
1
vote
3
answers
196
views
How to find the python command in a shell script?
Let's suppose that you have a super python 2&3 one-liner that you need to use in a shell script.
On system A the python command works, but on system B you have to use python3, on system C you need ...
0
votes
1
answer
252
views
Captive Portal w/ nginx, hostapd, nftables, dnsmasq
I'm trying to make captive portal with nginx, hostapd, nftables, dnsmasq and python-flask.
I have two main problems
I'm not getting a popup on Android, but am on Iphone/OSX.
I'm not sure how to ...
0
votes
1
answer
669
views
How to upgrade numpy? | ImportError: Matplotlib requires numpy>=1.23; you have 1.21.5
I need to run matplotlib. However, it requires an up-to-date version of numpy.
How can I manually update my numpy installation?
$ pip install numpy --upgrade
Defaulting to user installation because ...
0
votes
1
answer
81
views
How to open line in $EDITOR while in python shell?
As a somewhat new user, I recently discovered the trick of opening the current terminal line in $EDITOR, using the hotkey C-x C-e. This has changed my life, and has made writing loops and such much ...
1
vote
0
answers
120
views
Is it safe to invoke `apt` from within a conda environment?
I have a Python script which manages upgrading the system by invoking apt with different arguments via the subprocess module.
It relies on the python_toolkit and docker libraries, so these need to be ...
0
votes
0
answers
50
views
Running py2debi for ffsubsync, I get: "No such file or directory: 'requirements.txt'"
I'm trying to follow the advice here:
Install a Python package on Debian/Devuan when apt has no package for it
and create a Debian/Devuan package for the ffsubsync Python package. All the dependencies ...
3
votes
2
answers
1k
views
Should I keep all Python libraries only in the virtual environment?
I am working on Debian Stable Linux (12.9) and it is otherwise working very well. I am also using Python3 for small data analysis tasks. I have been installing Python3 libraries in virtual ...
0
votes
0
answers
27
views
Does Nautilius the file manager customizer allow one to right click and pass into a python function the file right clicked as argument without error?
I am working on creating a way to right click on an .eml file, right click, and have python pull two pieces of data from it and paste them into a new xlsx file and auto open the xlsx file.
I would try ...
0
votes
1
answer
202
views
Using PyInstaller with Wine: Path Issue Between Linux and Wine Environment
I have this linux distro:
Distributor ID: Kali
Description: Kali GNU/Linux Rolling
Release: 2024.4
Codename: kali-rolling
I have wine installed correctly wine-9.0 and I installed a ...
0
votes
3
answers
326
views
awk/sed in loop to replace numbers (with result of computation)
I am relatively new to awk and sed.
I have a file with more than 30000 rows/lines; e.g.,
Direct configuration= 5
0.86331344 0.14835363 0.01770155
0.83813858 0.74789354 0.31772038
0.89805721 0....
1
vote
2
answers
2k
views
How to (Force) Install Specific Version of Python with Pacman (Arch)
After a whole system upgrade, my Python version was bumped up to 3.13.1. I mostly use Python nowadays as a dependency of KaTrain, which needs Python because its UI is based on Kivy.
Currently, Kivy ...
0
votes
0
answers
67
views
Struggling to Get Jupyter Python Kernel Working in VSCodeium on Arch Linux - Should I Switch Back to Windows?
I've been facing issues with getting the Python kernel to work in Jupyter notebooks on VSCodeium (my Arch Linux setup) for the past 3 days. Despite managing to start the kernel after much ...
1
vote
1
answer
2k
views
Unable to detect Python kernels in VS Code Jupyter notebooks after migrating from Windows 11 to Arch Linux
Environment Details
Previous OS: Windows 11
Current OS: Arch Linux
Desktop Environment: KDE Plasma
IDE: Visual Studio Code (OSS CODE)
Required Feature: Jupyter Notebook support
Issue Description
...
0
votes
0
answers
59
views
Install Python packages with Chef
What is the best practice for installing Python pip packages with Chef?
I thought about the poise-python, but I've read that it stops maintenance.
And a direct install at recipe like:
execute 'python ...
0
votes
1
answer
153
views
In performing an update on F-41, the following conflicts from the repositories were reported. What steps can I take to resolve them...if any?
Problem 1:
installed package libcurl-minimal-8.9.1-2.fc41.x86_64 conflicts with libcurl(x86-64) provided by libcurl-8.9.1-2.fc41.x86_64 from fedora
- package dnf5-plugin-automatic-5.2.6.2-1.fc41....
0
votes
1
answer
634
views
How to use python systemd.journal module to log to a newly created systemd journald namespace
The python example here allows me to log to the systemd journal just by adding logger.info("Hi Mom"). I want to log to a different journal namespace with custom/longer data retention period ...
0
votes
1
answer
64
views
Rasperry PI Python with Adafruit Rotary transducer
I am running python3 on a raspberry pi 3:
Static hostname: raspberrypi
Icon name: computer
Machine ID: 0bd95523f1a44b54abc9402a9f8f6b23
Boot ID: ...
6
votes
3
answers
1k
views
APT broken due to broken python libraries
I am on Debian 12.
I made a rookie error installing python libraries (numpy, pandas, sklearn) using apt and now whenever i try to install or uninstall anything i get this error.
When installing
...
0
votes
2
answers
109
views
Combining multiple files by year (column in data) into one line and add file name as first column in Perl or Python
I have over 3000 files that need to be combined based on specific attributes in the files. For example, each file is named by its ID (Eg. 101567AD_Mly.txt).These IDs correspond to latitude and ...
2
votes
2
answers
896
views
calling python within bash script
I am attempting to call python within a bash script, but the script cannot find it. I have not done bash script programming for over 30 years, so I am not currently adept at bash script debugging. I ...
0
votes
0
answers
52
views
Why does Debian 11 on my Chromebook refuse to allow Python 3 .11 with Tkinter to run "root = Tk()", returning "No protocol specified"
I installed Debian 11 Bullseye on my Chromebook, and I thought I'd try out a sample program from the Python.org tutorial about Tkinter. It failed at the first line after the imports; I got the ...
1
vote
0
answers
40
views
Quarantining Python code from being updated
I have installed Onboard (virtual keyboard) and it resides in
/usr/lib/python3/dist-packages/Onboard/
I have made some changes to a few of the files (for a modified layout) which I want to quarantine ...
2
votes
1
answer
6k
views
Trouble installing python3.11-venv on debian 12
I'm having some issues trying to get virtualenv working on debian 12, it's hard to decipher what exactly is the problem. I've run apt update and apt upgrade as well, it's a fresh network install of ...
0
votes
1
answer
557
views
Set environment variables in a python script and use them in a chained call [duplicate]
I would like to set a couple of environment variables in a Python script, then use said environment variables in a chained call.
For example, a python script called set_env.py:
os.environ["MY_VAR&...