Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

postCreateCommand Permission denied #247

Open
austinmw opened this issue Mar 13, 2024 · 2 comments
Open

postCreateCommand Permission denied #247

austinmw opened this issue Mar 13, 2024 · 2 comments
Labels
info-needed Information needed form the user

Comments

@austinmw
Copy link

Running the postCreateCommand from devcontainer.json...

[7386 ms] Start: Run in container: /bin/sh -c ./.devcontainer/postCreateCommand.sh
The virtual environment found in /workspaces/peloton-virtual-coach/.venv seems to be broken.
Recreating virtualenv peloton-virtual-coach in /workspaces/peloton-virtual-coach/.venv

[Errno 13] Permission denied: 'extensions.cpython-311.pyc'
[7955 ms] postCreateCommand failed with exit code 1. Skipping any further user-provided commands.
Done. Press any key to close the terminal.

I have the following:

devcontainer.json:

// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/python
{
    "name": "peloton-virtual-coach",
    // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
    "image": "mcr.microsoft.com/devcontainers/python:1-3.11-bullseye",
    "features": {
        "ghcr.io/devcontainers-contrib/features/poetry:2": {}
    },

    // Use 'postCreateCommand' to run commands after the container is created.
    "postCreateCommand": "./.devcontainer/postCreateCommand.sh",

    // Configure tool-specific properties.
    "customizations": {
        "vscode": {
            "extensions": [
                "ms-python.python",
                "editorconfig.editorconfig",
            ],
            "settings": {
                "python.testing.pytestArgs": ["tests"],
                "python.testing.unittestEnabled": false,
                "python.testing.pytestEnabled": true,
                "python.defaultInterpreterPath": "/workspaces/peloton-virtual-coach/.venv/bin/python",
                "python.testing.pytestPath": "/workspaces/peloton-virtual-coach/.venv/bin/pytest"
            }
        }
    }
}

postCreateCommand.sh:

#! /usr/bin/env bash

# Install Dependencies
poetry install --with dev
@samruddhikhandale
Copy link
Member

Hi 👋

I wasn't able to reproduce the issue, see 👇

Image

Can you point me to a sample repository so that I can repro for myself?

Looking at the creation logs, the virtualenv used by your dev container and mine is different. Hence, looks like I have some missing config?

Creating virtualenv my-project-iOXQ9y55-py3.11 in /home/vscode/.cache/pypoetry/virtualenvs
Recreating virtualenv peloton-virtual-coach in /workspaces/peloton-virtual-coach/.venv

The virtual environment found in /workspaces/peloton-virtual-coach/.venv seems to be broken.

Also, in your case it complaints about ^

@bamurtaugh bamurtaugh added the info-needed Information needed form the user label Mar 26, 2024
@Makoehle
Copy link

I had the same problem. The solution was to to change:

{
  "postCreateCommand": "./postCreate",
}

to

{
  "postCreateCommand": "chmod +x ./postCreate && ./postCreate",
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
info-needed Information needed form the user
Projects
None yet
Development

No branches or pull requests

4 participants