njvack / markdown-to-json

A tool to turn Markdown into a nested JSON structure.
MIT License
295 stars 71 forks source link

devcontainer fails to create - pipx #27

Open itsalljustdata opened 1 year ago

itsalljustdata commented 1 year ago

I'm getting an error when i run the tool on some (admittedly large) markdown, so i thought i'd take a look at the repo.

very kindly you've defined a devcontainer, but it's creation is failing for me...

It looks like pipx is (somehow) being considered missing from the underlying image


<snip of lots of stuff> 

 => [dev_containers_target_stage 1/8] RUN mkdir -p /tmp/dev-container-fea  1.2s
 => [dev_containers_feature_content_normalize 1/2] COPY --from=dev_contai  1.2s
 => [dev_containers_feature_content_normalize 2/2] RUN chmod -R 0755 /tmp  0.3s
 => [dev_containers_target_stage 2/8] COPY --from=dev_containers_feature_  0.0s
 => [dev_containers_target_stage 3/8] RUN echo "_CONTAINER_USER_HOME=$( (  0.4s
[2023-10-26T03:24:50.880Z]  => ERROR [dev_containers_target_stage 4/8] RUN --mount=type=bind,from=d  12.3s
------
 > [dev_containers_target_stage 4/8] RUN --mount=type=bind,from=dev_containers_feature_content_source,source=black_0,target=/tmp/build-features-src/black_0     cp -ar /tmp/build-features-src/black_0 /tmp/dev-container-features  && chmod -R 0755 /tmp/dev-container-features/black_0  && cd /tmp/dev-container-features/black_0  && chmod +x ./devcontainer-features-install.sh  && ./devcontainer-features-install.sh  && rm -rf /tmp/dev-container-features/black_0:
0.424 ===========================================================================
0.424 Feature       : Black (via pipx)
[2023-10-26T03:24:50.881Z]
0.424 Description   : Black is an uncompromising Python code formatter.
0.424 Id            : ghcr.io/devcontainers-contrib/features/black
0.424 Version       : 2.0.17
0.424 Documentation : http://github.com/devcontainers-contrib/features/tree/main/src/black
0.424 Options       :
0.424     VERSION="latest"
0.424 ===========================================================================
3.148 nanolayer
11.74 cd /tmp/tmpach6m_fq && chmod +x -R . && _REMOTE_USER="vscode" _REMOTE_USER_HOME="/home/vscode" PACKAGE="black" VERSION="latest" INJECTIONS="" INCLUDEDEPS="false" INTERPRETER="" NANOLAYER_VERBOSE="" NANOLAYER_FORCE_CLI_INSTALLATION="" NANOLAYER_PROPAGATE_CLI_LOCATION="1" NANOLAYER_CLI_LOCATION="/tmp/nanolayer-MS9NFAbxeD/nanolayer" bash  -i  +H ./install.sh
11.74

11.74 [notice] A new release of pip is available: 23.0.1 -> 23.3.1

11.74 [notice] To update, run: pip install --upgrade pip

11.86 Traceback (most recent call last):

11.86   File "/root/.local/bin/pipx", line 5, in <module>

11.86     from pipx.main import cli

11.86 ModuleNotFoundError: No module named 'pipx'

11.90 Traceback (most recent call last):

11.90   File "/root/.local/bin/pipx", line 5, in <module>

11.90     from pipx.main import cli

11.90 ModuleNotFoundError: No module named 'pipx'

11.95 Traceback (most recent call last):
11.95   File "<string>", line 1, in <module>
11.95   File "nanolayer.__main__", line 50, in main
11.95   File "typer.main", line 328, in __call__
11.95   File "typer.main", line 311, in __call__
11.95   File "click.core", line 1157, in __call__
11.95   File "typer.core", line 778, in main
11.95   File "typer.core", line 216, in _main
11.95   File "click.core", line 1688, in invoke
11.95   File "click.core", line 1688, in invoke
11.95   File "click.core", line 1434, in invoke
11.95   File "click.core", line 783, in invoke
11.95   File "typer.main", line 683, in wrapper
11.95   File "nanolayer.cli.install", line 65, in install_devcontainer_feature
11.95   File "nanolayer.installers.devcontainer_feature.oci_feature_installer", line 131, in install
11.95   File "nanolayer.utils.invoker", line 59, in invoke
11.95 nanolayer.utils.invoker.Invoker.InvokerException: The command 'cd /tmp/tmpach6m_fq && chmod +x -R . && _REMOTE_USER="vscode" _REMOTE_USER_HOME="/home/vscode" PACKAGE="black" VERSION="latest" INJECTIONS="" INCLUDEDEPS="false" INTERPRETER="" NANOLAYER_VERBOSE="" NANOLAYER_FORCE_CLI_INSTALLATION="" NANOLAYER_PROPAGATE_CLI_LOCATION="1" NANOLAYER_CLI_LOCATION="/tmp/nanolayer-MS9NFAbxeD/nanolayer" bash  -i  +H ./install.sh' failed. error: Return Code: 1. see logs for details.
12.31 ERROR: Feature "Black (via pipx)" (ghcr.io/devcontainers-contrib/features/black) failed to install! Look at the documentation at http://github.com/devcontainers-contrib/features/tree/main/src/black for help troubleshooting this error.
------
[2023-10-26T03:24:50.881Z] Dockerfile-with-features:30
--------------------
  29 |
  30 | >>> RUN --mount=type=bind,from=dev_containers_feature_content_source,source=black_0,target=/tmp/build-features-src/black_0 \
  31 | >>>     cp -ar /tmp/build-features-src/black_0 /tmp/dev-container-features \
  32 | >>>  && chmod -R 0755 /tmp/dev-container-features/black_0 \
  33 | >>>  && cd /tmp/dev-container-features/black_0 \
  34 | >>>  && chmod +x ./devcontainer-features-install.sh \
  35 | >>>  && ./devcontainer-features-install.sh \
  36 | >>>  && rm -rf /tmp/dev-container-features/black_0
  37 |
--------------------
ERROR: failed to solve: process "/bin/bash -o pipefail -c cp -ar /tmp/build-features-src/black_0 /tmp/dev-container-features  && chmod -R 0755 /tmp/dev-container-features/black_0  && cd /tmp/dev-container-features/black_0  && chmod +x ./devcontainer-features-install.sh  && ./devcontainer-features-install.sh  && rm -rf /tmp/dev-container-features/black_0" did not complete successfully: exit code: 1

View build details: ]8;;docker-desktop://dashboard/build/default/default/w3kxnf2msyaha4jntwrrp3z59\docker-desktop://dashboard/build/default/default/w3kxnf2msyaha4jntwrrp3z59]8;;\
[2023-10-26T03:24:50.889Z] Stop (150291 ms): Run: docker buildx build --load --build-arg BUILDKIT_INLINE_CACHE=1 -f /tmp/devcontainercli-badger/container-features/0.51.3-1698290531190/Dockerfile-with-features -t vsc-markdown-to-json-f8ad31d84594ef91756778208ae96bf09cbbb588331486895ec5534ee2ffea76 --target dev_containers_target_stage --build-context dev_containers_feature_content_source=/tmp/devcontainercli-badger/container-features/0.51.3-1698290531190 --build-arg _DEV_CONTAINERS_BASE_IMAGE=dev_container_auto_added_stage_label --build-arg _DEV_CONTAINERS_IMAGE_USER=vscode --build-arg _DEV_CONTAINERS_FEATURE_CONTENT_SOURCE=dev_container_feature_content_temp /home/badger/git/markdown-to-json
[2023-10-26T03:24:50.894Z] Error: Command failed: docker buildx build --load --build-arg BUILDKIT_INLINE_CACHE=1 -f /tmp/devcontainercli-badger/container-features/0.51.3-1698290531190/Dockerfile-with-features -t vsc-markdown-to-json-f8ad31d84594ef91756778208ae96bf09cbbb588331486895ec5534ee2ffea76 --target dev_containers_target_stage --build-context dev_containers_feature_content_source=/tmp/devcontainercli-badger/container-features/0.51.3-1698290531190 --build-arg _DEV_CONTAINERS_BASE_IMAGE=dev_container_auto_added_stage_label --build-arg _DEV_CONTAINERS_IMAGE_USER=vscode --build-arg _DEV_CONTAINERS_FEATURE_CONTENT_SOURCE=dev_container_feature_content_temp /home/badger/git/markdown-to-json
[2023-10-26T03:24:50.894Z]     at BAA (/home/badger/.vscode/extensions/ms-vscode-remote.remote-containers-0.315.1/dist/spec-node/devContainersSpecCLI.js:463:1860)
[2023-10-26T03:24:50.895Z]     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[2023-10-26T03:24:50.895Z]     at async Ww (/home/badger/.vscode/extensions/ms-vscode-remote.remote-containers-0.315.1/dist/spec-node/devContainersSpecCLI.js:462:1691)
[2023-10-26T03:24:50.895Z]     at async SK (/home/badger/.vscode/extensions/ms-vscode-remote.remote-containers-0.315.1/dist/spec-node/devContainersSpecCLI.js:462:610)
[2023-10-26T03:24:50.895Z]     at async SAA (/home/badger/.vscode/extensions/ms-vscode-remote.remote-containers-0.315.1/dist/spec-node/devContainersSpecCLI.js:479:3660)
[2023-10-26T03:24:50.896Z]     at async GC (/home/badger/.vscode/extensions/ms-vscode-remote.remote-containers-0.315.1/dist/spec-node/devContainersSpecCLI.js:479:4775)
[2023-10-26T03:24:50.896Z]     at async ZeA (/home/badger/.vscode/extensions/ms-vscode-remote.remote-containers-0.315.1/dist/spec-node/devContainersSpecCLI.js:611:12251)
[2023-10-26T03:24:50.896Z]     at async VeA (/home/badger/.vscode/extensions/ms-vscode-remote.remote-containers-0.315.1/dist/spec-node/devContainersSpecCLI.js:611:11992)
[2023-10-26T03:24:50.906Z] Stop (161777 ms): Run: /usr/share/code/code --ms-enable-electron-run-as-node /home/badger/.vscode/extensions/ms-vscode-remote.remote-containers-0.315.1/dist/spec-node/devContainersSpecCLI.js up --user-data-folder /home/badger/.config/Code/User/globalStorage/ms-vscode-remote.remote-containers/data --container-session-data-folder /tmp/devcontainers-4b84e523-30af-4dfe-9c50-0eb79f04b2341698290527924 --workspace-folder /home/badger/git/markdown-to-json --workspace-mount-consistency cached --id-label devcontainer.local_folder=/home/badger/git/markdown-to-json --id-label devcontainer.config_file=/home/badger/git/markdown-to-json/.devcontainer/devcontainer.json --log-level debug --log-format json --config /home/badger/git/markdown-to-json/.devcontainer/devcontainer.json --default-user-env-probe loginInteractiveShell --mount type=volume,source=vscode,target=/vscode,external=true --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root
[2023-10-26T03:24:50.907Z] Exit code 1
[2023-10-26T03:24:50.910Z] Command failed: /usr/share/code/code --ms-enable-electron-run-as-node /home/badger/.vscode/extensions/ms-vscode-remote.remote-containers-0.315.1/dist/spec-node/devContainersSpecCLI.js up --user-data-folder /home/badger/.config/Code/User/globalStorage/ms-vscode-remote.remote-containers/data --container-session-data-folder /tmp/devcontainers-4b84e523-30af-4dfe-9c50-0eb79f04b2341698290527924 --workspace-folder /home/badger/git/markdown-to-json --workspace-mount-consistency cached --id-label devcontainer.local_folder=/home/badger/git/markdown-to-json --id-label devcontainer.config_file=/home/badger/git/markdown-to-json/.devcontainer/devcontainer.json --log-level debug --log-format json --config /home/badger/git/markdown-to-json/.devcontainer/devcontainer.json --default-user-env-probe loginInteractiveShell --mount type=volume,source=vscode,target=/vscode,external=true --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root
[2023-10-26T03:24:50.910Z] Exit code 1
[2023-10-26T03:25:29.317Z] Error opening dev container configurations: CodeExpectedError: ENOPRO: No file system provider found for resource 'vscode-remote://dev-container%2B7b22686f737450617468223a222f686f6d652f6261646765722f6769742f6d61726b646f776e2d746f2d6a736f6e222c226c6f63616c446f636b6572223a66616c73652c22636f6e66696746696c65223a7b22246d6964223a312c22667350617468223a222f686f6d652f6261646765722f6769742f6d61726b646f776e2d746f2d6a736f6e2f2e646576636f6e7461696e65722f646576636f6e7461696e65722e6a736f6e222c2265787465726e616c223a2266696c653a2f2f2f686f6d652f6261646765722f6769742f6d61726b646f776e2d746f2d6a736f6e2f2e646576636f6e7461696e65722f646576636f6e7461696e65722e6a736f6e222c2270617468223a222f686f6d652f6261646765722f6769742f6d61726b646f776e2d746f2d6a736f6e2f2e646576636f6e7461696e65722f646576636f6e7461696e65722e6a736f6e222c22736368656d65223a2266696c65227d7d/workspaces/markdown-to-json'
    at r.j (vscode-file://vscode-app/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:645:11397)
    at async r.exists (vscode-file://vscode-app/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:645:13603)
    at async Promise.all (index 0)
    at async vscode-file://vscode-app/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:1861:2796

any thoughts?

itsalljustdata commented 1 year ago

Seemingly the "vscode" user cannot import pipx, but root can

vscode ➜ / $ python
Python 3.11.2 (main, Feb 11 2023, 02:24:27) [GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pipx
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'pipx'
>>> 
vscode ➜ / $ sudo -i
root ➜ ~ $ python
Python 3.11.2 (main, Feb 11 2023, 02:24:27) [GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pipx
>>> 
root ➜ ~ $ 

Upon further investigation, pipx is in root's secret world...

root ➜ ~ $ python
Python 3.11.2 (main, Feb 11 2023, 02:24:27) [GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pipx
>>> print (pipx.__file__)
/root/.local/lib/python3.11/site-packages/pipx/__init__.py
>>> 

Complete list of packages in /root/.local/......

matthewdeanmartin commented 1 year ago

Huh. Maybe I should make the devcontainer here more "plain vanilla". I can't open the devcontainer here either.

The referenced container is mine over here: https://github.com/matthewdeanmartin/convenient_py_devcontainer

and is unrelated to njvack's work.

I'll update the devcontainer to something with fewer things that can go wrong this evening or tomorrow.