Error: could not create 'Open_edX.egg-info': Permission denied

Hello,

I’m trying to setup a development environment using tutor and mounting a local repository but I’m facing an error that I’m not sure how to fix or work around it.

Here is the procedure I followed:

  1. installed tutor full with pip install "tutor[full]" (within a virtual environment)
  2. run tutor dev launch and checks that the installation works
  3. Clone the edx-platform repo and checkout tag to a new branch with git clone https://github.com/openedx/edx-platform.git and then git checkout -b local-redwood open-release/redwood.1
  4. Install node modules with npm install
  5. build dev images with tutor images build openedx-dev
  6. run tutor dev launch

Then the containers get stopped and restarted but it then fails right after the permissions container with the following error message

error: subprocess-exited-with-error
    
    × python setup.py develop did not run successfully.
    │ exit code: 1
    ╰─> [30 lines of output]
        running develop
        /openedx/venv/lib/python3.11/site-packages/setuptools/command/develop.py:40: EasyInstallDeprecationWarning: easy_install command is deprecated.
        !!
        
                ********************************************************************************
                Please avoid running ``setup.py`` and ``easy_install``.
                Instead, use pypa/build, pypa/installer or other
                standards-based tools.
        
                See https://github.com/pypa/setuptools/issues/917 for details.
                ********************************************************************************
        
        !!
          easy_install.initialize_options(self)
        /openedx/venv/lib/python3.11/site-packages/setuptools/_distutils/cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
        !!
        
                ********************************************************************************
                Please avoid running ``setup.py`` directly.
                Instead, use pypa/build, pypa/installer or other
                standards-based tools.
        
                See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
                ********************************************************************************
        
        !!
          self.initialize_options()
        running egg_info
        creating Open_edX.egg-info
        error: could not create 'Open_edX.egg-info': Permission denied
        [end of output]
    
    note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× python setup.py develop did not run successfully.
│ exit code: 1
╰─> [30 lines of output]
    running develop
    /openedx/venv/lib/python3.11/site-packages/setuptools/command/develop.py:40: EasyInstallDeprecationWarning: easy_install command is deprecated.
    !!
    
            ********************************************************************************
            Please avoid running ``setup.py`` and ``easy_install``.
            Instead, use pypa/build, pypa/installer or other
            standards-based tools.
    
            See https://github.com/pypa/setuptools/issues/917 for details.
            ********************************************************************************
    
    !!
      easy_install.initialize_options(self)
    /openedx/venv/lib/python3.11/site-packages/setuptools/_distutils/cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
    !!
    
            ********************************************************************************
            Please avoid running ``setup.py`` directly.
            Instead, use pypa/build, pypa/installer or other
            standards-based tools.
    
            See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
            ********************************************************************************
    
    !!
      self.initialize_options()
    running egg_info
    creating Open_edX.egg-info
    error: could not create 'Open_edX.egg-info': Permission denied
    [end of output]

From this whole message, it seems that the main error is this one:

error: could not create 'Open_edX.egg-info': Permission denied

Does someone know what could be wrong here?
I’m not running as root by the way.

Thanks for any help!

What’s your user ID on the host? (id -u) And which user owns the edx-platform repository? (ls -l /path/to/edx-platform/)

  • user id is 1000
  • the edx-platform folder is owned by this user

I created a folder Open_edX.egg-info manually within the edx-platform folder, opened it to everyone with chmod 777 (which I don’t like at all) and then tried tutor dev launch again.

It went a bit further, I’m still getting a permission denied at some point, but this time it comes from npm.

Performing additional setup for bind-mounted edx-platform.
+ pip install -e .
Obtaining file:///openedx/edx-platform
  Preparing metadata (setup.py) ... done
Requirement already satisfied: setuptools in /openedx/venv/lib/python3.11/site-packages (from Open-edX==0.13) (69.1.1)
Installing collected packages: Open-edX
  Attempting uninstall: Open-edX
    Found existing installation: Open-edX 0.13
    Uninstalling Open-edX-0.13:
      Successfully uninstalled Open-edX-0.13
  Running setup.py develop for Open-edX
Successfully installed Open-edX-0.13

[notice] A new release of pip is available: 24.0 -> 24.2
[notice] To update, run: pip install --upgrade pip
+ npm clean-install
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: 'karma@0.11.14',
npm WARN EBADENGINE   required: { node: '~0.8 || ~0.10' },
npm WARN EBADENGINE   current: { node: 'v18.20.1', npm: '10.5.0' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: 'karma@0.13.22',
npm WARN EBADENGINE   required: { node: '0.10 || 0.12 || 4 || 5' },
npm WARN EBADENGINE   current: { node: 'v18.20.1', npm: '10.5.0' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: 'karma@0.13.22',
npm WARN EBADENGINE   required: { node: '0.10 || 0.12 || 4 || 5' },
npm WARN EBADENGINE   current: { node: 'v18.20.1', npm: '10.5.0' }
npm WARN EBADENGINE }
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /openedx/edx-platform/node_modules/@aashutoshrathi
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir '/openedx/edx-platform/node_modules/@aashutoshrathi'
npm ERR!  [Error: EACCES: permission denied, mkdir '/openedx/edx-platform/node_modules/@aashutoshrathi'] {
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'mkdir',
npm ERR!   path: '/openedx/edx-platform/node_modules/@aashutoshrathi'
npm ERR! }
npm ERR! 
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR! 
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

So now, I’m a bit confused whether or not I should run the command as root or not. In any case, how could I run it as root? I tried to run sudo tutor dev launch within my virtual environment but sudo cannot find the tutor command.

Next step: I decided to also add write permissions for all to the node_modules folder (chmod 777 node_modules) and run tutor dev launch again. The next error message is then:

[webpack-cli] [Error: EACCES: permission denied, mkdir '/openedx/edx-platform/common/static/bundles'] {
  errno: -13,
  code: 'EACCES',
  syscall: 'mkdir',
  path: '/openedx/edx-platform/common/static/bundles'
}

So now I’m wondering if I should maybe just add a specific user to the edx-platform folder group to avoid any permission issues. The question is then: what is the user running the whole command if not user id 1000 ?

[EDIT 2] I added a few prints to the tutor script to check the user id and could confirm that it runs indeed as user id 1000, which is also the owner of the whole edx-platform folder. I’m even more confused as to why then, I get all these permissions denied…

[EDIT 3] for the next attempt, I ran chmod 777 edx-platform/common/static and then tutor dev launch. It went even further in the process and then failed with another permission denied while compiling default Sass:

PermissionError: [Errno 13] Permission denied: 'lms/static/css'

then I kept modifying permissions with the following commands, running tutor dev launch in between:

  • chmod 777 edx-platform/lms/static
  • chmod 777 edx-platform/lms/static/certificates
  • chmod 777 edx-platform/cms/static
  • chmod 777 edx-platform/openedx/themes/indigo/lms/static

But then I get another permission denied because the script wants to copy a file to /openedx/themes/indigo/lms/static/css (note that it’s a openedx folder at the root of the system).

There has to be a better way to make tutor dev launch work with a bind-mount. I’m sure I’m missing something, I just don’t know what.

I’m running this launch on

  • Ubuntu 20.04.5 LTS
  • Python 3.8
  • pip 24.2

Thanks in advance for any help/hint.

You should not run tutor as sudo, and you should not chown 777 your directories on the host.

What is the output of the following command?

id -u && tutor dev run --no-deps lms bash -c "id -u && ls -l"

Thanks for your response.

Here is the output of id -u && tutor dev run --no-deps lms bash -c "id -u && ls -l"

1000
docker compose -f /home/dsl-pc-4/.local/share/tutor/env/local/docker-compose.yml -f /home/dsl-pc-4/.local/share/tutor/env/dev/docker-compose.yml --project-name tutor_dev run --rm --no-deps lms bash -c 'id -u && ls -l'
1000
total 1620
-rw-rw-r--    1 root root     508 Aug  2 14:58 catalog-info.yaml
-rw-rw-r--    1 root root     320 Aug  2 11:36 CHANGELOG.rst
drwxrwxr-x    7 root root    4096 Aug  2 14:58 cms
-rw-rw-r--    1 root root     121 Aug  2 11:36 codecov.yml
drwxrwxr-x    6 root root    4096 Aug  2 11:36 common
drwxrwxr-x    3 root root    4096 Aug  2 11:36 conf
-rw-rw-r--    1 root root    1069 Aug  2 11:36 conftest.py
-rw-rw-r--    1 root root    1278 Aug  2 11:36 db_keyword_overrides.yml
-rw-rw-r--    1 root root    6884 Aug  2 14:58 Dockerfile
-rw-rw-r--    1 root root     732 Aug  2 11:36 doc.rst.j2
drwxrwxr-x    8 root root    4096 Aug  2 14:58 docs
-rw-rw-r--    1 root root     445 Aug  2 11:36 jest.config.js
-rw-rw-r--    1 root root   35136 Aug  2 11:36 LICENSE
drwxrwxr-x    7 root root    4096 Aug  2 14:58 lms
-rw-rw-r--    1 root root   10624 Aug  2 14:58 Makefile
-rwxrwxr-x    1 root root    3853 Aug  2 11:36 manage.py
-rw-rw-r--    1 root root    1741 Aug  2 11:36 mypy.ini
drwxrwxrwx 1267 root root   45056 Aug  5 13:56 node_modules
drwxrwxr-x    8 root root    4096 Aug  5 10:49 openedx
drwxrwxrwx    2 root root    4096 Aug  5 13:55 Open_edX.egg-info
-rw-rw-r--    1 root root     303 Aug  2 11:36 openedx.yaml
-rw-rw-r--    1 root root    4426 Aug  2 14:58 package.json
-rw-rw-r--    1 root root 1322343 Aug  5 12:05 package-lock.json
drwxrwxr-x    4 root root    4096 Aug  2 14:58 pavelib
-rw-rw-r--    1 root root     635 Aug  2 11:36 pavement.py
-rw-rw-r--    1 root root    2250 Aug  2 11:36 pylint_django_settings.py
-rw-rw-r--    1 root root    9150 Aug  2 11:36 pylintrc
-rw-rw-r--    1 root root    1197 Aug  2 11:36 pylintrc_tweaks
-rw-rw-r--    1 root root    7292 Aug  2 14:58 README.rst
drwxrwxr-x    5 root root    4096 Aug  2 14:58 requirements
-rw-rw-r--    1 root root     161 Aug  2 11:36 requirements.txt
drwxrwxr-x    7 root root    4096 Aug  2 14:58 scripts
-rw-rw-r--    1 root root   10171 Aug  2 14:58 setup.cfg
-rw-rw-r--    1 root root   12667 Aug  2 14:58 setup.py
-rw-rw-r--    1 root root     277 Aug  2 11:36 setupTests.js
-rw-rw-r--    1 root root      63 Aug  2 11:36 stylelint.config.js
drwxrwxr-x    8 root root    4096 Aug  5 11:39 test_root
drwxrwxr-x    9 root root    4096 Aug  2 11:36 themes
-rw-rw-r--    1 root root    2155 Aug  2 11:36 tox.ini
-rw-rw-r--    1 root root     263 Aug  5 13:47 uwsgi.ini
-rw-rw-r--    1 root root    5121 Aug  2 11:36 webpack.builtinblocks.config.js
-rw-rw-r--    1 root root   27298 Aug  2 14:58 webpack.common.config.js
drwxrwxr-x    2 root root    4096 Aug  2 11:36 webpack-config
-rw-rw-r--    1 root root    2074 Aug  2 11:36 webpack.dev.config.js
-rw-rw-r--    1 root root    2424 Aug  2 11:36 webpack.prod.config.js
drwxrwxr-x   14 root root    4096 Aug  2 14:58 xmodule

So your edx-platform repo is owned by root:

Can you investigate why this is the case? Is it also owned by root on the host? Is the edx-platform properly mounted inside your container? If not, why?

Hello and sorry for the late reply.

I don’t know why the edx-plaftorm repository is owned by root in this context, because it is definitely owned by user id 1000 on the host. I checked the logs of the Docker build and the COPY commands uses the flag --chown 1000:1000 so it makes even less sense to me why they would be owned by root.

As for the mounting, I did mount the repository using the corresponding Tutor command tutor mounts add ./edx-platform
and it shows properly mounted with the command tutor mounts list:

- name: /home/dsl-pc-4/Documents/openedx/edx-platform
  build_mounts:
  - image: openedx
    context: edx-platform
  - image: openedx-dev
    context: edx-platform
  compose_mounts:
  - service: openedx
    container_path: /openedx/edx-platform

I also tried to install tutor directly on the host (ie. without a virtual environment) but I get the same result where the edx-platform repository is still owned by root.

I remove all past Docker images, clear build cache and pruned the Docker system, to get a fresh install and nothing changes.

Right now, I’m out of ideas to keep investigating why the repo is owned by root.

With the help of a colleague, we figured out the problem.

There is an open issue about Docker Desktop for Linux (Docker Compose with Volumes) are set to root and not a custom user for a specific user. · Issue #81 · docker/desktop-linux · GitHub

So we uninstalled Docker Desktop and installed Docker Engine only. We had to make sure to reset the config and set the context from “Desktop” to “default”.

Now tutor dev launch runs properly (minus warnings about deprecated packages).

Case closed… Thanks for your help @regis !

1 Like