[Python] python - permission error when installin pip

Discussão em 'Python' iniciado por Stack, Fevereiro 20, 2025.

  1. Stack

    Stack Membro Participativo

    im new to learn python and theres some problem with my vscode, python or even my computer windows 11 python313 vscode

    running python313 at vscode, and wanted to run example markdown but there was an error

    I found that there wasn't automatically installed pip

    Running cells with 'Python 3.13.2' requires the ipykernel package.
    Run the following command to install 'ipykernel' into the Python environment.
    Command: 'c:/Users/USER/AppData/Local/Programs/Python/Python313/python.exe -m pip install ipykernel -U --user --force-reinstall'


    so I typed the command in cmd(run as administrator) but there was an error there's no pip tools i knew that pip comes with python so i reinstalled python, checked environment variables

    there was no positive result so I tried to install pip directly

    python -m ensurepip


    but the answer was

    Traceback (most recent call last):
    File "<string>", line 6, in <module>
    runpy.run_module("pip", run_name="__main__", alter_sys=True)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "<frozen runpy>", line 226, in run_module
    File "<frozen runpy>", line 98, in _run_module_code
    File "<frozen runpy>", line 88, in _run_code
    File "C:\temp\tmpj9q4znh3\pip-24.3.1-py3-none-any.whl\pip\__main__.py", line 24, in <module>
    sys.exit(_main())
    ~~~~~^^
    File "C:\temp\tmpj9q4znh3\pip-24.3.1-py3-none-any.whl\pip\_internal\cli\main.py", line 78, in main
    command = create_command(cmd_name, isolated=("--isolated" in cmd_args))
    File "C:\temp\tmpj9q4znh3\pip-24.3.1-py3-none-any.whl\pip\_internal\commands\__init__.py", line 114, in create_command
    module = importlib.import_module(module_path)
    File "C:\Users\USER\AppData\Local\Programs\Python\Python313\Lib\importlib\__init__.py", line 88, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
    ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
    File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
    File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
    File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
    File "<frozen importlib._bootstrap_external>", line 1026, in exec_module
    File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
    File "C:\temp\tmpj9q4znh3\pip-24.3.1-py3-none-any.whl\pip\_internal\commands\install.py", line 16, in <module>
    from pip._internal.cli.req_command import (
    ...<2 lines>...
    )
    File "C:\temp\tmpj9q4znh3\pip-24.3.1-py3-none-any.whl\pip\_internal\cli\req_command.py", line 18, in <module>
    from pip._internal.index.collector import LinkCollector
    File "C:\temp\tmpj9q4znh3\pip-24.3.1-py3-none-any.whl\pip\_internal\index\collector.py", line 31, in <module>
    from pip._vendor import requests
    File "C:\temp\tmpj9q4znh3\pip-24.3.1-py3-none-any.whl\pip\_vendor\requests\__init__.py", line 159, in <module>
    from .api import delete, get, head, options, patch, post, put, request
    File "C:\temp\tmpj9q4znh3\pip-24.3.1-py3-none-any.whl\pip\_vendor\requests\api.py", line 11, in <module>
    from . import sessions
    File "C:\temp\tmpj9q4znh3\pip-24.3.1-py3-none-any.whl\pip\_vendor\requests\sessions.py", line 15, in <module>
    from .adapters import HTTPAdapter
    File "C:\temp\tmpj9q4znh3\pip-24.3.1-py3-none-any.whl\pip\_vendor\requests\adapters.py", line 80, in <module>
    _preloaded_ssl_context = create_urllib3_context()
    File "C:\temp\tmpj9q4znh3\pip-24.3.1-py3-none-any.whl\pip\_vendor\urllib3\util\ssl_.py", line 359, in create_urllib3_context
    context.keylog_filename = sslkeylogfile
    ^^^^^^^^^^^^^^^^^^^^^^^
    PermissionError: [Errno 13] Permission denied: 'C:\\Users\\USER\\Desktop'
    Traceback (most recent call last):
    File "<frozen runpy>", line 198, in _run_module_as_main
    File "<frozen runpy>", line 88, in _run_code
    File "C:\Users\USER\AppData\Local\Programs\Python\Python313\Lib\ensurepip\__main__.py", line 5, in <module>
    sys.exit(ensurepip._main())
    ~~~~~~~~~~~~~~~^^
    File "C:\Users\USER\AppData\Local\Programs\Python\Python313\Lib\ensurepip\__init__.py", line 257, in _main
    return _bootstrap(
    root=args.root,
    ...<4 lines>...
    default_pip=args.default_pip,
    )
    File "C:\Users\USER\AppData\Local\Programs\Python\Python313\Lib\ensurepip\__init__.py", line 172, in _bootstrap
    return _run_pip([*args, "pip"], [os.fsdecode(tmp_wheel_path)])
    File "C:\Users\USER\AppData\Local\Programs\Python\Python313\Lib\ensurepip\__init__.py", line 87, in _run_pip
    return subprocess.run(cmd, check=True).returncode
    ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
    File "C:\Users\USER\AppData\Local\Programs\Python\Python313\Lib\subprocess.py", line 579, in run
    raise CalledProcessError(retcode, process.args,
    output=stdout, stderr=stderr)
    subprocess.CalledProcessError: Command '['C:\\Users\\USER\\AppData\\Local\\Programs\\Python\\Python313\\python.exe', '-W', 'ignore::DeprecationWarning', '-c', '\nimport runpy\nimport sys\nsys.path = [\'C:\\\\temp\\\\tmpj9q4znh3\\\\pip-24.3.1-py3-none-any.whl\'] + sys.path\nsys.argv[1:] = [\'install\', \'--no-cache-dir\', \'--no-index\', \'--find-links\', \'C:\\\\temp\\\\tmpj9q4znh3\', \'pip\']\nrunpy.run_module("pip", run_name="__main__", alter_sys=True)\n']' returned non-zero exit status 1.


    so I tried to get get-pip.py to install manually.

    py get-pip.py


    C:\temp>py get-pip.py
    Traceback (most recent call last):
    File "C:\temp\get-pip.py", line 28840, in <module>
    main()
    ~~~~^^
    File "C:\temp\get-pip.py", line 137, in main
    bootstrap(tmpdir=tmpdir)
    ~~~~~~~~~^^^^^^^^^^^^^^^
    File "C:\temp\get-pip.py", line 113, in bootstrap
    monkeypatch_for_cert(tmpdir)
    ~~~~~~~~~~~~~~~~~~~~^^^^^^^^
    File "C:\temp\get-pip.py", line 94, in monkeypatch_for_cert
    from pip._internal.commands.install import InstallCommand
    File "C:\temp\tmpe_scg98x\pip.zip\pip\_internal\commands\install.py", line 19, in <module>
    File "C:\temp\tmpe_scg98x\pip.zip\pip\_internal\self_outdated_check.py", line 18, in <module>
    File "C:\temp\tmpe_scg98x\pip.zip\pip\_internal\index\collector.py", line 31, in <module>
    File "C:\temp\tmpe_scg98x\pip.zip\pip\_vendor\requests\__init__.py", line 159, in <module>
    File "C:\temp\tmpe_scg98x\pip.zip\pip\_vendor\requests\api.py", line 11, in <module>
    File "C:\temp\tmpe_scg98x\pip.zip\pip\_vendor\requests\sessions.py", line 15, in <module>
    File "C:\temp\tmpe_scg98x\pip.zip\pip\_vendor\requests\adapters.py", line 80, in <module>
    File "C:\temp\tmpe_scg98x\pip.zip\pip\_vendor\urllib3\util\ssl_.py", line 359, in create_urllib3_context
    PermissionError: [Errno 13] Permission denied: 'C:\\Users\\USER\\Desktop'


    variable methods of installation was not working including install on venv cmd runnin as admin

    all of my try failed by Errno 13

    I tried to swich and did it again and it happened again

    PS C:\Users\USER\Documents\2025ncc> py get-pip.py
    Traceback (most recent call last):
    File "C:\Users\USER\Documents\2025ncc\get-pip.py", line 28840, in <module>
    main()
    ~~~~^^
    File "C:\Users\USER\Documents\2025ncc\get-pip.py", line 137, in main
    bootstrap(tmpdir=tmpdir)
    ~~~~~~~~~^^^^^^^^^^^^^^^
    File "C:\Users\USER\Documents\2025ncc\get-pip.py", line 113, in bootstrap
    monkeypatch_for_cert(tmpdir)
    ~~~~~~~~~~~~~~~~~~~~^^^^^^^^
    File "C:\Users\USER\Documents\2025ncc\get-pip.py", line 94, in monkeypatch_for_cert
    from pip._internal.commands.install import InstallCommand
    File "C:\temp\tmp_orsox1u\pip.zip\pip\_internal\commands\install.py", line 19, in <module>
    File "C:\temp\tmp_orsox1u\pip.zip\pip\_internal\self_outdated_check.py", line 18, in <module>
    File "C:\temp\tmp_orsox1u\pip.zip\pip\_internal\index\collector.py", line 31, in <module>
    File "C:\temp\tmp_orsox1u\pip.zip\pip\_vendor\requests\__init__.py", line 159, in <module>
    File "C:\temp\tmp_orsox1u\pip.zip\pip\_vendor\requests\api.py", line 11, in <module>
    File "C:\temp\tmp_orsox1u\pip.zip\pip\_vendor\requests\sessions.py", line 15, in <module>
    File "C:\temp\tmp_orsox1u\pip.zip\pip\_vendor\requests\adapters.py", line 80, in <module>
    File "C:\temp\tmp_orsox1u\pip.zip\pip\_vendor\urllib3\util\ssl_.py", line 359, in create_urllib3_context
    PermissionError: [Errno 13] Permission denied:

    Continue reading...

Compartilhe esta Página