Permission denied error 13

Hi i’m new to circleci and have some difficulties to setup it up

Here’s my config.yml

version: 2.1
jobs:
  build:
    docker:
      - image: circleci/python:3.6.4
    steps:
      - checkout
      - run: pip3 install nox==2021.6.12
      - run: nox
workflows:
  version: 2
  commit_workflow:
    jobs:
      - build

on the installing step i get the following error:

Installing collected packages: py, typing-extensions, zipp, importlib-metadata, pyparsing, packaging, argcomplete, colorlog, nox
Exception:
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/usr/local/lib/python3.6/site-packages/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/usr/local/lib/python3.6/site-packages/pip/req/req_set.py", line 784, in install
    **kwargs
  File "/usr/local/lib/python3.6/site-packages/pip/req/req_install.py", line 851, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "/usr/local/lib/python3.6/site-packages/pip/req/req_install.py", line 1064, in move_wheel_files
    isolated=self.isolated,
  File "/usr/local/lib/python3.6/site-packages/pip/wheel.py", line 345, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/usr/local/lib/python3.6/site-packages/pip/wheel.py", line 316, in clobber
    ensure_dir(destdir)
  File "/usr/local/lib/python3.6/site-packages/pip/utils/__init__.py", line 83, in ensure_dir
    os.makedirs(path)
  File "/usr/local/lib/python3.6/os.py", line 220, in makedirs
    mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.6/site-packages/py'
You are using pip version 9.0.3, however version 21.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

Can you help please thank you

You’re trying to install nox into the system. You can either install using --user (probably preferred) or you can resort to sudo pip install …

$ circleci local execute --job build
…
====>> export PATH=~/.local/bin:$PATH; type nox; nox --version
  #!/bin/bash -eo pipefail
export PATH=~/.local/bin:$PATH; type nox; nox --version
nox is /home/circleci/.local/bin/nox
2021.6.12
Success!

$ circleci local execute --job build_with_sudo
…
====>> type nox; nox --version
  #!/bin/bash -eo pipefail
type nox; nox --version
nox is /usr/local/bin/nox
2021.6.12
Success!

The above were executed with the following config:

version: 2.1
jobs:
  build:
    docker:
      - image: circleci/python:3.6.4
    steps:
      - run: pip3 install --user nox==2021.6.12
      - run: export PATH=~/.local/bin:$PATH; type nox; nox --version
  build_with_sudo:
    docker:
      - image: circleci/python:3.6.4
    steps:
      - run: sudo pip3 install nox==2021.6.12
      - run: type nox; nox --version
workflows:
  version: 2
  commit_workflow:
    jobs:
      - build
      - build_with_sudo