Sample Header Ad - 728x90

Unix & Linux Stack Exchange

Q&A for users of Linux, FreeBSD and other Unix-like operating systems

Latest Questions

0 votes
1 answers
2827 views
Giving access to user-installed python distribution to another linux user
(I'm not sure exactly what SE site my question belongs, I hesitated between stackoverflow, serverfault and superuser. Feel free to give suggestions about this in the comments.) Here is my problem: I have two users on my linux computer, `bli` and `pquarato`. `bli` installed python3.6 locally (compili...
(I'm not sure exactly what SE site my question belongs, I hesitated between stackoverflow, serverfault and superuser. Feel free to give suggestions about this in the comments.) Here is my problem: I have two users on my linux computer, bli and pquarato. bli installed python3.6 locally (compiling from source with ./configure --prefix=${HOME}). The binary is installed in /home/bli/bin, pip3.6 installs things in /home/bli/.local/lib/python3.6/site-packages. For instance, numpy is installed there: (bli) $ pip3.6 install numpy Requirement already satisfied: numpy in /home/bli/.local/lib/python3.6/site-packages I want pquarato to be able to use bli's python installation. bli did chmod -R a+rx on /home/bli/bin and /home/bli/.local. pquarato can use bli's python3.6 binary, but it is not able to import modules installed with pip3.6: (pquarato) $ /home/bli/bin/python3.6 -c 'import numpy' Traceback (most recent call last): File "", line 1, in ModuleNotFoundError: No module named 'numpy' The above works without errors for bli. What else should I do? ----- Note: I actually first ran into a problem when trying to get pquarato to use programs such as ipython3: (pquarato) $ /home/bli/.local/bin/ipython3 Traceback (most recent call last): File "/home/bli/.local/bin/ipython3", line 6, in from pkg_resources import load_entry_point File "/home/bli/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3017, in @_call_aside File "/home/bli/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3003, in _call_aside f(*args, **kwargs) File "/home/bli/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3030, in _initialize_master_working_set working_set = WorkingSet._build_master() File "/home/bli/lib/python3.6/site-packages/pkg_resources/__init__.py", line 659, in _build_master ws.require(__requires__) File "/home/bli/lib/python3.6/site-packages/pkg_resources/__init__.py", line 967, in require needed = self.resolve(parse_requirements(requirements)) File "/home/bli/lib/python3.6/site-packages/pkg_resources/__init__.py", line 853, in resolve raise DistributionNotFound(req, requirers) pkg_resources.DistributionNotFound: The 'ipython==6.2.1' distribution was not found and is required by the application I hope that the same solution will solve both the ModuleNotFoundError and the above DistributionNotFound issue.
bli (239 rep)
Apr 4, 2018, 11:57 AM • Last activity: Aug 6, 2025, 02:08 PM
0 votes
1 answers
2353 views
systemd & python logging
I wrote a simple python3 skript and want to make a service from it. Here are the two files #!/bin/python3 while True: print('True') Systemd Service: [Unit] Description=True Service [Service] Type=simple ExecStart=python3 /root/print_true.py StandardOutput=journal+console [Install] WantedBy=multi-use...
I wrote a simple python3 skript and want to make a service from it. Here are the two files #!/bin/python3 while True: print('True') Systemd Service: [Unit] Description=True Service [Service] Type=simple ExecStart=python3 /root/print_true.py StandardOutput=journal+console [Install] WantedBy=multi-user.target The service is starting but i cant see the output anywhere. Not in
-u true-service.service
, not in
status true-service
and not in
. I want to have it only in journal but how can i accomplish that? I cant seem to find a working answer.
Nico (123 rep)
Jun 28, 2020, 08:57 AM • Last activity: Aug 6, 2025, 06:05 AM
0 votes
1 answers
1878 views
How to install GCC without yum on CentOS 7?
Is there a real way to install gcc without yum on CentOS 7? On my system yum doesn't work: yum update -bash: /usr/bin/yum: /usr/bin/python2.7: bad interpreter: No such file or directory And when I want to install `python2.7` it needs GCC that I don't know where it is on my system? which gcc /usr/bin...
Is there a real way to install gcc without yum on CentOS 7? On my system yum doesn't work: yum update -bash: /usr/bin/yum: /usr/bin/python2.7: bad interpreter: No such file or directory And when I want to install python2.7 it needs GCC that I don't know where it is on my system? which gcc /usr/bin/which: no gcc in (/root/anaconda2/bin:/root/anaconda3/bin:/root/anaconda3/condabin:/usr/local/bin:/usr/local/bin:/usr/local/bin:/root/anaconda3/bin:/root/anaconda3/condabin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/root/bin) And when I search how to install GCC without yum, most of them need yum! Is there really a way to solve this problem?
user3486308 (609 rep)
May 21, 2020, 01:07 PM • Last activity: Jul 31, 2025, 07:10 PM
1 votes
1 answers
754 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 After migrating from Windows 11 to Arch Linux, I'm unable to get...
### 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 After migrating from Windows 11 to Arch Linux, I'm unable to get Jupyter notebooks working in VS Code. Specifically, VS Code cannot detect any Python kernels for the notebooks, preventing me from running any code. ## What I've Tried ### Attempt 1: Direct Installation First, I attempted to install Jupyter directly using pip:
pip install jupyter --break-system-packages
This resulted in an error about externally managed environment, which is expected behavior in Arch Linux. ### Attempt 2: Virtual Environment Setup Then I tried setting up a virtual environment:
python -m venv .venv
source .venv/bin/activate
pip install jupyter
This is the result I got:
[harshal@quanta ~]$ python -m venv .venv
[harshal@quanta ~]$ source .venv/bin/ativate
bash: .venv/bin/ativate: No such file or directory
[harshal@quanta ~]$ ls
Desktop  Documents  Downloads  Music  Pictures  Public  sof-bin  Templates  Videos  yay
[harshal@quanta ~]$ source .venv/bin/activate
(.venv) [harshal@quanta ~]$ code .
(.venv) [harshal@quanta ~]$
**Code** : enter image description here ### Attempt 3: System Package Installation I also attempted to install through pacman:
sudo pacman -S python-jupyter
This failed with "target not found: python-jupyter" error. ### Output of ls -al .venv
drwxr-xr-x  7 harshal harshal 4096 Dec 20 18:57 .
drwx------ 22 harshal harshal 4096 Dec 21 08:03 ..
drwxr-xr-x  2 harshal harshal 4096 Dec 20 18:57 bin
drwxr-xr-x  3 harshal harshal 4096 Dec 20 18:57 etc
drwxr-xr-x  3 harshal harshal 4096 Dec 20 17:33 include
drwxr-xr-x  3 harshal harshal 4096 Dec 20 17:33 lib
lrwxrwxrwx  1 harshal harshal    3 Dec 20 17:33 lib64 -> lib
-rw-r--r--  1 harshal harshal  157 Dec 20 18:54 pyvenv.cfg
drwxr-xr-x  6 harshal harshal 4096 Dec 20 18:57 share
[harshal@quanta ~]$
## Current State Even after these attempts, VS Code still cannot detect any Python kernels for Jupyter notebooks, as shown in the screenshot below: VS Code showing no kernels available ## System Configuration - VS Code has the Python extension installed - Python is installed and accessible from terminal - Virtual environment is created but not being detected by VS Code ## Expected Behavior VS Code should be able to: 1. Detect the Python interpreter in the virtual environment 2. List it as an available kernel for Jupyter notebooks 3. Allow running notebook cells using the selected kernel ## Actual Behavior - No kernels are being detected - Cannot run any notebook cells - Kernel picker shows no available kernels ## Question How can I properly configure VS Code to detect and use Python kernels for Jupyter notebooks on a fresh Arch Linux installation, considering the system package management restrictions?
Harshal Malani (11 rep)
Dec 20, 2024, 12:51 PM • Last activity: Jul 30, 2025, 01:45 PM
1 votes
1 answers
2626 views
Make Python3 default without breaking yum in RHEL7
> **What specific syntax needs to be changed or added to the below in order for commands calling `python` in a RHEL7 VM to be interpreted using Python3 WITHOUT breaking programs like `yum` that require Python2?** **FIRST ATTEMPT:** Our first attempt was to add the following 2 lines to the very end o...
> **What specific syntax needs to be changed or added to the below in order for commands calling python in a RHEL7 VM to be interpreted using Python3 WITHOUT breaking programs like yum that require Python2?** **FIRST ATTEMPT:** Our first attempt was to add the following 2 lines to the very end of the cloud-init startup script which instantiates the VM: rm /usr/bin/python ln -s /usr/bin/python3 /usr/bin/python **ERROR THAT RESULTED:** The problem is that adding the above two lines to the end of the cloud-init startup script causes yum commands to break when yum is called afterwards as follows: $ sudo yum update -y File "/bin/yum", line 30 except KeyboardInterrupt, e: ^ SyntaxError: invalid syntax $ **TOGGLING THE ERROR:** We can turn off the error by removing the above 2 lines from the cloud-init startup script and re-instantiating a new replacement VM. This isolates the source of the problem, but still we have the problem of how to default python to Python3 without breaking apps like yum.
CodeMed (5357 rep)
Jul 7, 2020, 05:24 PM • Last activity: Jul 27, 2025, 02:04 AM
1 votes
1 answers
5308 views
Running Python script over multiple directories and multiple files
Here is my command line for `python`: python script.py -a .faa -n .fna I have a directory containing multiple directories. Out of these multiple directories, there could be 1 or more folders. In these 1 or more folders, I need to run my python script on the `.faa` and `.fna` files. How do I do this?...
Here is my command line for python: python script.py -a .faa -n .fna I have a directory containing multiple directories. Out of these multiple directories, there could be 1 or more folders. In these 1 or more folders, I need to run my python script on the .faa and .fna files. How do I do this? Example tree:
Staph1 ----> [CO1, CO2] ----> [.fna, .faa] from CO1, [.fna, .faa] from CO2

Staph2 ----> [CO6] ----> [.fna, .faa] from CO6
My Python script will use the inputs .fna and .faa and output within the folder. Also the folder and directory are synonymous.
Jeff (11 rep)
Aug 14, 2014, 08:20 PM • Last activity: Jul 24, 2025, 02:05 PM
0 votes
1 answers
2309 views
How can I run the sudo command in Python code under CentOS in Docker
I am trying to access the docker image labels from Python as follows hostname = socket.gethostname() cmd = "sudo curl --unix-socket /var/run/docker.sock http:/containers/" + hostname + "/json" output = os.popen(cmd).read() But, the thing is I am getting the following error: We trust you have receive...
I am trying to access the docker image labels from Python as follows hostname = socket.gethostname() cmd = "sudo curl --unix-socket /var/run/docker.sock http:/containers/" + hostname + "/json" output = os.popen(cmd).read() But, the thing is I am getting the following error: We trust you have received the usual lecture from the local System Administrator. It usually boils down to these three things: #1) Respect the privacy of others. #2) Think before you type. #3) With great power comes great responsibility. sudo: no tty present and no askpass program specified It's one of the fancy messages by Unix from some other posts I read from StackOverflow. I am following the below link https://stackoverflow.com/questions/37439887/how-to-access-the-metadata-of-a-docker-container-from-a-script-running-inside-th Only thing is I want to run these things from Python not from the Terminal. Also, FYI, I get the response when I run the same command from the terminal. I tried appending the following piece in Dockerfile RUN echo "root ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers Thanks
jaruto (1 rep)
Jan 29, 2019, 07:29 PM • Last activity: Jul 20, 2025, 11:07 PM
0 votes
1 answers
4461 views
failed to get the Python codec of the filesystem encoding after Ubuntu upgrade
After upgrading to Ubuntu 23.04, my Python installation does not work anymore. Running Poetry gives the following : ``` bash ➜ ~ poetry Could not find platform independent libraries Could not find platform dependent libraries Consider setting $PYTHONHOME to [: ] Python path configuration: PYTHONHOME...
After upgrading to Ubuntu 23.04, my Python installation does not work anymore. Running Poetry gives the following :
bash
➜  ~ poetry
Could not find platform independent libraries 
Could not find platform dependent libraries 
Consider setting $PYTHONHOME to [:]
Python path configuration:
  PYTHONHOME = (not set)
  PYTHONPATH = (not set)
  program name = '/home/guillaume/.local/share/pypoetry/venv/bin/python'
  isolated = 0
  environment = 1
  user site = 1
  import site = 1
  sys._base_executable = '/home/guillaume/.local/share/pypoetry/venv/bin/python'
  sys.base_prefix = '/usr'
  sys.base_exec_prefix = '/usr'
  sys.platlibdir = 'lib'
  sys.executable = '/home/guillaume/.local/share/pypoetry/venv/bin/python'
  sys.prefix = '/usr'
  sys.exec_prefix = '/usr'
  sys.path = [
    '/usr/lib/python310.zip',
    '/usr/lib/python3.10',
    '/usr/lib/lib-dynload',
  ]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'

Current thread 0x00007ff0fb4b1040 (most recent call first):
Running python itself does work :
bash
➜  ~ python3
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.
>>>
I tried : - Reinstalling Python - unsetting PYTHONHOME and PYTHONPATH How can I fix my Python setup ?
uiguig (63 rep)
Apr 20, 2023, 06:37 PM • Last activity: Jul 20, 2025, 02:04 PM
4 votes
1 answers
3554 views
Finding which specific Python process was killed by Linux OOM killer
I'm trying to figure out which specific Python process or executable was killed by the Linux OOM killer. In /var/log/messages I get this: Aug 18 03:19:11 169 kernel: [ 7747] 0 7748 3226957 2875051 5692 0 0 python (notice it just say name = "python") and this: Aug 18 03:19:11 169 kernel: Killed proce...
I'm trying to figure out which specific Python process or executable was killed by the Linux OOM killer. In /var/log/messages I get this: Aug 18 03:19:11 169 kernel: [ 7747] 0 7748 3226957 2875051 5692 0 0 python (notice it just say name = "python") and this: Aug 18 03:19:11 169 kernel: Killed process 7748 (python) total-vm:12907828kB, anon-rss:11500204kB, file-rss:0kB (again notice it just says the process was "python") Ideally a log file for the process would have the PID somewhere. But suppose the logs wrapped (or suppose the process doesn't log the PID anywhere). Does Linux provide a way to figure out the full command that was executed for the process? It would be nice to configure Linux's OOM killer to display the full name in the process table, such as: /usr/bin/python /usr/lib/python2.7/site-packages/foo.pyc Or maybe at the time of the OOM error Linux stores off some of the process details somewhere? i.e. copy the processes from /proc to X? (wishful thinking) ### NOTE: ### This question is very similar to this question: https://stackoverflow.com/questions/624857/finding-which-process-was-killed-by-linux-oom-killer But it fell short of what I'm trying to figure out.
jersey bean (553 rep)
Aug 18, 2017, 09:32 PM • Last activity: Jul 20, 2025, 12:08 PM
1 votes
3 answers
144 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 to use `python3.12` or `python2`, etc... What would be a sensible way to check some, if not every,...
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 to use python3.12 or python2, etc... What would be a sensible way to check some, if not every, "python*" command name? I want to avoid using a construct like this:
#!/bin/bash

if command -v python
then
    python_exe=python
elif command -v python3
then
    python_exe=python3
elif command -v python2
then
     python_exe=python2
else
    echo "python executable not found" >&2
    exit 1
fi > /dev/null

"$python_exe" -c 'print("Hello world!");'
Fravadona (1581 rep)
Mar 11, 2025, 08:13 PM • Last activity: Jul 16, 2025, 01:38 PM
0 votes
1 answers
5553 views
ImportError: No module named pymol
I run a python script, but it returns this error. I am working on an environment and I believe that I have to install the pymol module. I am not familiar with these things and I have no idea how to solve this problem. Could anyone guide me? This is the command I use to invoke the environment: source...
I run a python script, but it returns this error. I am working on an environment and I believe that I have to install the pymol module. I am not familiar with these things and I have no idea how to solve this problem. Could anyone guide me? This is the command I use to invoke the environment: source env_prova/bin/activate This is the command for the script: python pymol_align.py --list1=list.txt --list2= template.txt --out= pr.txt This is the error: Traceback (most recent call last): File "pymol_align.py", line 4, in import pymol ImportError: No module named pymol Could someone help me?
Tommaso (167 rep)
Jul 30, 2020, 01:01 PM • Last activity: Jul 11, 2025, 04:06 PM
-1 votes
1 answers
54 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?
My command prints >>> import sys >>> print(sys.prefix) /home/DEVOPSM/CodeTest_Ucar/venv Is it possible to list all other virtual environments on Linux?
MJoao (47 rep)
Jul 10, 2025, 08:41 AM • Last activity: Jul 11, 2025, 02:48 PM
3 votes
2 answers
3947 views
Capstone for Python not working
I'm unable to get [Capstone][1] for Python to work. I have attempted to install capstone both using pip and compiling and installing from source. Both are successful, no errors, but neither works. I've tried this on Gentoo and Ubuntu. On Gentoo stable: >>> import capstone Traceback (most recent call...
I'm unable to get Capstone for Python to work. I have attempted to install capstone both using pip and compiling and installing from source. Both are successful, no errors, but neither works. I've tried this on Gentoo and Ubuntu. On Gentoo stable: >>> import capstone Traceback (most recent call last): File "", line 1, in File "/usr/lib64/python3.3/site-packages/capstone/__init__.py", line 1, in from capstone import Cs, CsError, cs_disasm_quick, cs_disasm_lite, cs_version, cs_support, version_bind, debug, CS_API_MAJOR, CS_API_MINOR, CS_ARCH_ARM, CS_ARCH_ARM64, CS_ARCH_MIPS, CS_ARCH_X86, CS_ARCH_PPC, CS_ARCH_ALL, CS_MODE_LITTLE_ENDIAN, CS_MODE_ARM, CS_MODE_THUMB, CS_OPT_SYNTAX, CS_OPT_SYNTAX_DEFAULT, CS_OPT_SYNTAX_INTEL, CS_OPT_SYNTAX_ATT, CS_OPT_SYNTAX_NOREGNAME, CS_OPT_DETAIL, CS_OPT_ON, CS_OPT_OFF, CS_MODE_16, CS_MODE_32, CS_MODE_64, CS_MODE_BIG_ENDIAN, CS_MODE_MICRO, CS_MODE_N64, CS_SUPPORT_DIET ImportError: cannot import name Cs >>> Contents of the file /usr/lib64/python3.3/site-packages/capstone/__init__.py: from capstone import Cs, CsError, cs_disasm_quick, cs_disasm_lite, cs_version, cs_support, version_bind, debug, CS_API_MAJOR, CS_API_MINOR, CS_ARCH_ARM, CS_ARCH_ARM64, CS_ARCH_MIPS, CS_ARCH_X86, CS_ARCH_PPC, CS_ARCH_ALL, CS_MODE_LITTLE_ENDIAN, CS_MODE_ARM, CS_MODE_THUMB, CS_OPT_SYNTAX, CS_OPT_SYNTAX_DEFAULT, CS_OPT_SYNTAX_INTEL, CS_OPT_SYNTAX_ATT, CS_OPT_SYNTAX_NOREGNAME, CS_OPT_DETAIL, CS_OPT_ON, CS_OPT_OFF, CS_MODE_16, CS_MODE_32, CS_MODE_64, CS_MODE_BIG_ENDIAN, CS_MODE_MICRO, CS_MODE_N64, CS_SUPPORT_DIET This seems a bit strange to me. On Ubuntu 14.04 LTS: >>> import capstone Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python3.4/dist-packages/capstone/__init__.py", line 184, in raise ImportError("ERROR: fail to load the dynamic library.") ImportError: ERROR: fail to load the dynamic library. >>>
AttributedTensorField (373 rep)
Sep 17, 2014, 01:04 AM • Last activity: Jul 7, 2025, 09:04 PM
3 votes
2 answers
10243 views
Control volume of mpg123
Good time of day! Currently developing something like "smart home" and I need to start different audio streams with different volume level. For example, I want to hear background music with 20% of original volume but in case if someone press door bell then I want to hear that bell ring with 100% vol...
Good time of day! Currently developing something like "smart home" and I need to start different audio streams with different volume level. For example, I want to hear background music with 20% of original volume but in case if someone press door bell then I want to hear that bell ring with 100% volume. For my purposes currently, I'm using mpg123 with Python scripts. Python script with pexpect runs mpg123 with needed settings like mpg123 -vC Current approach sends 's' like pause immediately after the player starts. Then I'm sending needed count of '-' like decrease volume by 2 to the player and resume it. Huh... it works but an implementation is ugly, and there is some gap between the player start and volume decreasing. At least I hear few first "packets" before python script actually pauses player and decrease volume. Is there any way to reduce the volume by some command? Is there any way to start mpg123 paused? At least to eliminate that gap Thanks!
user922871 (191 rep)
Jul 5, 2017, 10:02 PM • Last activity: Jul 4, 2025, 06:40 PM
1 votes
2 answers
2210 views
How to kill python process ran by shell script when shell script dies?
I have a shell script that runs python. **start.sh** ``` # Setup environment cd ~/foobar/ && \ python3 -m venv env && \ source env/bin/activate && \ pip install -q -r requirements.txt && \ find . -maxdepth 1 -type f -name "*.py" | xargs pylint # Run scripts python ~/foobar/main.py ``` If I `ctrl+c`...
I have a shell script that runs python. **start.sh**
# Setup environment
cd ~/foobar/ && \
    python3 -m venv env && \
    source env/bin/activate && \
    pip install -q -r requirements.txt && \
    find . -maxdepth 1 -type f -name "*.py" | xargs pylint

# Run scripts
python ~/foobar/main.py
If I ctrl+c in the terminal, it will shutdown the python properly. However if I pkill -9 start.sh, it will prompt Killed but the python is still running. Is there a way to kill the python script when the calling script dies?
ACD (111 rep)
Jun 4, 2020, 10:13 AM • Last activity: Jul 4, 2025, 01:01 AM
0 votes
1 answers
2782 views
Upgrade python from 3.8 to 3.9
I have manually downloaded the latest python upgrade - 3.9.6, however when I check the version of python on my terminal (iMac - big Sur): ``` -iMac ~ % python --version Python 3.8.8 ``` However, when I try to upgrade my python using home-brew: ``` ~ % brew upgrade python Warning: python 3.9.5 alread...
I have manually downloaded the latest python upgrade - 3.9.6, however when I check the version of python on my terminal (iMac - big Sur):
-iMac ~ % python --version
Python 3.8.8
However, when I try to upgrade my python using home-brew:
~ % brew upgrade python
Warning: python 3.9.5 already installed
I seem to not have the one that I downloaded - python 3.9.6. Is there a way to remove these other python languages i.e. 3.8.8, 3.9.5 and just keeping the latest python 3.9.6?
Stackbeans (101 rep)
Jul 3, 2021, 09:17 AM • Last activity: Jul 2, 2025, 03:03 AM
1 votes
1 answers
1969 views
ModuleNotFoundError: No module named 'PIL'
I am getting an error. #! /usr/bin/python3 # On 10/4/22 I installed version Python 3.10.7 # png2jpg.py # Does not work # Traceback (most recent call last): # File "/home/andy/Python/png2jpg.py", line 10, in # from PIL import Image # ModuleNotFoundError: No module named 'PIL' import math import os im...
I am getting an error. #! /usr/bin/python3 # On 10/4/22 I installed version Python 3.10.7 # png2jpg.py # Does not work # Traceback (most recent call last): # File "/home/andy/Python/png2jpg.py", line 10, in # from PIL import Image # ModuleNotFoundError: No module named 'PIL' import math import os import sys from PIL import Image if len(sys.argv) > 1: if os.path.exists(sys.argv): im = Image.open(sys.argv) target_name = sys.argv + ".jpg" rgb_im = im.convert('RGB') rgb_im.save(target_name) print("Saved as " + target_name) else: print(sys.argv + " not found") else: print("Usage: convert2jpg.py ") I installed Pillow. pip3 install Pillow which pip3 /usr/local/bin/pip3 I use python3 png2jpg.py pip3 --version pip 22.2.2 from /usr/local/lib/python3.10/site-packages/pip (python 3.10) I did find out that the python script does work in UM 20.04. I tried some new items from Michael Mba. pip uninstall PIL Cannot uninstall requirement PIL, not installed python3 -m pip install --upgrade pip Defaulting to user installation because normal site-packages is not writeable WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available. Requirement already satisfied: pip in /usr/local/lib/python3.10/site-packages (22.2.2) WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/pip/ WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/pip/ WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/pip/ WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/pip/ WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/pip/ Could not fetch URL https://pypi.org/simple/pip/ : There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available. Could not fetch URL https://pypi.org/simple/pip/ : There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping WARNING: There was an error checking the latest version of pip. https://jhooq.com/pip-install-connection-error/ I have no pip.conf file? :-) Python allows you to set default command-line options with the help of pip.conf file. Locate your pip.conf file based on your operating system - 2. Unix - $HOME/.config/pip/pip.conf
fixit7 (139 rep)
Oct 5, 2022, 04:58 PM • Last activity: Jul 1, 2025, 09:05 AM
2 votes
1 answers
7954 views
How to fix error: "symbol lookup error: /usr/local/lib/libQt5DBus.so.5: undefined symbol"?
I was using GNS3 network simulator fine for a while & then after few days When I start GNS3 Network Simulator, it is giving out following error, not sure what caused this. **$ sudo gns3** GNS3 GUI version 1.5.2 Copyright (c) 2007-2016 GNS3 Technologies Inc. your locale en_IN.ISO8859-1 encoding is no...
I was using GNS3 network simulator fine for a while & then after few days When I start GNS3 Network Simulator, it is giving out following error, not sure what caused this. **$ sudo gns3** GNS3 GUI version 1.5.2 Copyright (c) 2007-2016 GNS3 Technologies Inc. your locale en_IN.ISO8859-1 encoding is not UTF-8, switching to the UTF-8 version... 2016-12-23 22:57:53 INFO logger.py:107 Log level: INFO /usr/share/gns3/gns3-gui/bin/python: symbol lookup error: /usr/local/lib/libQt5DBus.so.5: undefined symbol: _Z28qEnvironmentVariableIntValuePKcPb I tried reinstalling gns3 but the error persisted. While Un-installing, I got the following warnings: dpkg: warning: while removing gns3-gui, directory '/usr/share/gns3/gns3-gui/lib/python3.4/__pycache__' not empty so not removed dpkg: warning: while removing gns3-gui, directory '/usr/share/gns3/gns3-gui/bin' not empty so not removed Removing gns3-server (1.5.2~trusty1) ... dpkg: warning: while removing gns3-server, directory '/usr/share/gns3/gns3-server/lib/python3.4/__pycache__' not empty so not removed dpkg: warning: while removing gns3-server, directory '/usr/share/gns3/gns3-server/bin' not empty so not removed So I removed /usr/share/gns3* and then tried installing GNS3 no luck. Tried the following suggestions made in this answer Commented the line "/usr/local/lib" in the file /etc/ld.so.conf.d/libc.conf but no use. Also when I tried installing GNS3 through Ubuntu Software Center enter image description here
karthik v (133 rep)
Dec 23, 2016, 05:35 PM • Last activity: Jun 29, 2025, 08:03 PM
3 votes
1 answers
4132 views
How to change the default (binary) python version in a FreeBSD jail?
In a jail, I have installed `python3.6` along `python3.4`. Both were installed using `pkg install`, no ports. I want to keep the 3.4 version for some time, but set the 3.6 as default. Answers found in internet, like [this one](https://stackoverflow.com/questions/9349831/how-to-set-python-version-by-...
In a jail, I have installed python3.6 along python3.4. Both were installed using pkg install, no ports. I want to keep the 3.4 version for some time, but set the 3.6 as default. Answers found in internet, like [this one](https://stackoverflow.com/questions/9349831/how-to-set-python-version-by-default-in-freebsd) or [this one](https://unix.stackexchange.com/questions/254660/freebsd-using-python3-in-uwsgi-instead-of-python2) either involve to myself link /usr/local/bin/python to python3.6 (what must be done again after any upgrade of the default python, what I'd like to avoid; plus there's no such link anyway); or to set DEFAULT_VERSIONS in /etc/make.conf, what has no effects on binaries installation (I've tried, nevertheless). Moreover, the virtual environment is not an option, since I want to run uwsgi, what requires the *system wide* default python to match the one in the python virtual environment of the python application it "monitors" (in my case, Django), in order to start correctly. Even if I start from inside the Django's virtual environment (providing python3.6), uwsgi detects python3.4 as the default python version. Cannot find if there is any environment variable missing neither. For information, inside the jail (and virtual environment): # printenv USER=root LOGNAME=root HOME=/root SHELL=/bin/csh BLOCKSIZE=K MAIL=/var/mail/root PATH=/usr/local/venv/dj1/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/root/bin TERM=xterm-256color HOSTTYPE=FreeBSD VENDOR=amd OSTYPE=FreeBSD MACHTYPE=x86_64 SHLVL=1 PWD=/var/log GROUP=wheel HOST=dev_web0 EDITOR=vi LANG=fr_FR.UTF-8 MM_CHARSET=UTF-8 PAGER=more VIRTUAL_ENV=/usr/local/venv/dj1
zezollo (141 rep)
May 3, 2017, 02:52 PM • Last activity: Jun 27, 2025, 08:04 AM
4 votes
1 answers
16443 views
Downgrading numpy 1.12.1 to 1.10.1
I am very new to Unix and this may be a basic question but I couldn't figure out. $ python -c "import numpy; print(numpy.version.version)" 1.12.1 $ pip uninstall numpy==1.12.1 Cannot uninstall requirement numpy, not installed $ pip install numpy==1.10.1 Collecting numpy==1.10.1 Using cached numpy-1....
I am very new to Unix and this may be a basic question but I couldn't figure out. $ python -c "import numpy; print(numpy.version.version)" 1.12.1 $ pip uninstall numpy==1.12.1 Cannot uninstall requirement numpy, not installed $ pip install numpy==1.10.1 Collecting numpy==1.10.1 Using cached numpy-1.10.1-cp27-none-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl Installing collected packages: numpy Successfully installed numpy-1.10.1 $ python -c "import numpy; print(numpy.version.version)" 1.12.1 There are three python installed in this computer and the first one is default. /sw/bin/python /usr/local/bin/python /usr/bin/python I tried changing path to use different python but all of them show numpy 1.12.1 when I cannot even uninstall because it's not installed. Anyone has any clue? ---------- Update I tried updating numpy then, `$ pip show numpy Name: numpy Version: 1.13.0rc2 Summary: NumPy: array processing for numbers, strings, records, and objects. Home-page: http://www.numpy.org Author: NumPy Developers Author-email: numpy-discussion@python.org License: BSD Location: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy-1.13.0rc2-py2.7-macosx-10.6-intel.egg Requires: ` `$ python -c "import numpy; print(numpy.version.version)" 1.12.1` I don't have permission to remove 1.13.0 So does this mean that my current python is running with numpy 1.13.0?
ypmun (41 rep)
Jun 5, 2017, 05:03 PM • Last activity: Jun 26, 2025, 06:06 PM
Showing page 1 of 20 total questions