Python pip permission denied

I am trying to run “python -m pip install requests” but I keep getting the permission denied error. I dont want to run it as sudo and I don’t know if it has something to do with the security profile I selected when I installed rocky. I had selected the common profile for general purpose systems. I have attached an example output of my issue.

Traceback (most recent call last):
  File "/usr/lib64/python3.9/", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib64/python3.9/", line 87, in _run_code
    exec(code, run_globals)
  File "/home/nemo/.local/lib/python3.9/site-packages/pip/", line 29, in <module>
    from pip._internal.cli.main import main as _main
  File "/home/nemo/.local/lib/python3.9/site-packages/pip/_internal/cli/", line 10, in <module>
    from pip._internal.cli.autocompletion import autocomplete
  File "/home/nemo/.local/lib/python3.9/site-packages/pip/_internal/cli/", line 10, in <module>
    from pip._internal.cli.main_parser import create_main_parser
  File "/home/nemo/.local/lib/python3.9/site-packages/pip/_internal/cli/", line 9, in <module>
    from pip._internal.build_env import get_runnable_pip
  File "/home/nemo/.local/lib/python3.9/site-packages/pip/_internal/", line 19, in <module>
    from pip._internal.cli.spinners import open_spinner
  File "/home/nemo/.local/lib/python3.9/site-packages/pip/_internal/cli/", line 9, in <module>
    from pip._internal.utils.logging import get_indentation
  File "/home/nemo/.local/lib/python3.9/site-packages/pip/_internal/utils/", line 29, in <module>
    from pip._internal.utils.misc import ensure_dir
  File "/home/nemo/.local/lib/python3.9/site-packages/pip/_internal/utils/", line 43, in <module>
    from pip._internal.exceptions import CommandError, ExternallyManagedEnvironment
  File "/home/nemo/.local/lib/python3.9/site-packages/pip/_internal/", line 18, in <module>
    from pip._vendor.requests.models import Request, Response
  File "/home/nemo/.local/lib/python3.9/site-packages/pip/_vendor/requests/", line 149, in <module>
    from . import packages, utils
  File "/home/nemo/.local/lib/python3.9/site-packages/pip/_vendor/requests/", line 24, in <module>
    from . import certs
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 846, in exec_module
  File "<frozen importlib._bootstrap_external>", line 982, in get_code
  File "<frozen importlib._bootstrap_external>", line 1039, in get_data
PermissionError: [Errno 1] Operation not permitted: '/home/nemo/.local/lib/python3.9/site-packages/pip/_vendor/requests/'

What security profile did you select during installation and can you share the output of the following?
cat /etc/fstab

I selected the general purpose security policy. This one.

# /etc/fstab
# Created by anaconda on Thu Jun 15 14:02:14 2023
# Accessible filesystems, by reference, are maintained under '/dev/disk/'.
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info.
# After editing this file, run 'systemctl daemon-reload' to update systemd
# units generated from this file.
/dev/mapper/rl-root     /                       xfs     defaults,x-systemd.device-timeout=0 0 0
UUID=8b914d96-8a1f-4d1b-9af8-0d931d6865d5 /boot                   xfs     defaults        0 0
UUID=2C2A-FB25          /boot/efi               vfat    umask=0077,shortname=winnt 0 2
/dev/mapper/rl-home     /home                   xfs     defaults,x-systemd.device-timeout=0 0 0
/dev/mapper/rl-var_log_audit /var/log/audit          xfs     defaults,nodev,noexec,nosuid,x-systemd.device-timeout=0 0 0
/dev/mapper/rl-swap     none                    swap    defaults,x-systemd.device-timeout=0 0 0

I figured it out. Needed to run this command to stop/disable the File Access Policy Service.

sudo systemctl stop fapolicyd.service
1 Like