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

Sandbox runtime failed: can't open file '/tmp/*'. No such file or directory #12

Closed
jedwards1230 opened this issue Sep 20, 2024 · 6 comments

Comments

@jedwards1230
Copy link
Contributor

jedwards1230 commented Sep 20, 2024

Description

This is the error I get after initial setup of the Tool. I get the same error no matter the type of prompt I give it. I'm new to Open-WebUI. Happy to share more logs if needed.

[DEBUG MODE] Sandbox runtime failed: Command '('/usr/local/bin/python3', '/tmp/tmp0184d281')' returned non-zero exit status 2. (stderr: /usr/local/bin/python3: can't open file '/tmp/tmp0184d281': [Errno 2] No such file or directory\n); language=python; code=import datetime; datetime.datetime.now().isoformat(); valves=[NETWORKING_ALLOWED=True MAX_RUNTIME_SECONDS=30 MAX_RAM_MEGABYTES=512 AUTO_INSTALL=True DEBUG=True]

General information

  • Open WebUI version: v0.3.22
  • Tool version: 0.5.0
  • Open WebUI setup:
    • Kernel information: Darwin 23.6.0 arm64
    • Runtime: Docker
    • If running in Docker:
      • Docker version: 27.2.0, build 3ab4256
Chat History JSON
[
	{
		"id": "878f3c2f-d678-4abb-8487-ab9d7cd5c8bb",
		"user_id": "6d217951-c77b-4dc1-9b48-c7fa02f6a7d2",
		"title": "🕰 Python Time Checker",
		"chat": {
			"id": "",
			"title": "🕰 Python Time Checker",
			"models": ["openai_manifold_pipeline.chatgpt-4o-latest"],
			"params": {},
			"messages": [
				{
					"id": "3bd54027-310d-44ef-ae0c-ebd6bbdff223",
					"parentId": null,
					"childrenIds": ["dfbc0ae2-db50-40c1-a9d0-1559f25f85b1"],
					"role": "user",
					"content": "what time is it? check with python",
					"timestamp": 1726790715,
					"models": ["openai_manifold_pipeline.chatgpt-4o-latest"]
				},
				{
					"parentId": "3bd54027-310d-44ef-ae0c-ebd6bbdff223",
					"id": "dfbc0ae2-db50-40c1-a9d0-1559f25f85b1",
					"childrenIds": [],
					"role": "assistant",
					"content": "It seems I cannot directly execute a Python script to check the time for you. However, here's a Python code snippet that you can run on your system to get the current time:\n\n```python\nimport datetime\n\n# Get current time\ncurrent_time = datetime.datetime.now()\n\n# Print formatted time\nprint(\"Current time:\", current_time.strftime(\"%Y-%m-%d %H:%M:%S\"))\n```\n\nYou can copy this code and run it in your local Python environment to display the current time.",
					"model": "openai_manifold_pipeline.chatgpt-4o-latest",
					"modelName": "OpenAI: chatgpt-4o-latest",
					"modelIdx": 0,
					"userContext": "",
					"timestamp": 1726790715,
					"statusHistory": [
						{
							"status": "in_progress",
							"description": "Checking if environment supports sandboxing...",
							"done": false
						},
						{
							"status": "in_progress",
							"description": "Checking if environment supports sandboxing...",
							"done": false
						},
						{
							"status": "in_progress",
							"description": "Initializing sandbox configuration...",
							"done": false
						},
						{
							"status": "in_progress",
							"description": "Initializing sandbox configuration...",
							"done": false
						},
						{
							"status": "in_progress",
							"description": "Running Python code in gVisor sandbox...",
							"done": false
						},
						{
							"status": "in_progress",
							"description": "Running Python code in gVisor sandbox...",
							"done": false
						},
						{
							"status": "error",
							"description": "[DEBUG MODE] Sandbox runtime failed: Command '('/usr/local/bin/python3', '/tmp/tmp0184d281')' returned non-zero exit status 2. (stderr: /usr/local/bin/python3: can't open file '/tmp/tmp0184d281': [Errno 2] No such file or directory\n); language=python; code=import datetime; datetime.datetime.now().isoformat(); valves=[NETWORKING_ALLOWED=True MAX_RUNTIME_SECONDS=30 MAX_RAM_MEGABYTES=512 AUTO_INSTALL=True DEBUG=True]",
							"done": true
						}
					],
					"lastSentence": "It seems I cannot directly execute a Python script to check the time for you.",
					"done": true
				}
			],
			"history": {
				"messages": {
					"3bd54027-310d-44ef-ae0c-ebd6bbdff223": {
						"id": "3bd54027-310d-44ef-ae0c-ebd6bbdff223",
						"parentId": null,
						"childrenIds": ["dfbc0ae2-db50-40c1-a9d0-1559f25f85b1"],
						"role": "user",
						"content": "what time is it? check with python",
						"timestamp": 1726790715,
						"models": ["openai_manifold_pipeline.chatgpt-4o-latest"]
					},
					"dfbc0ae2-db50-40c1-a9d0-1559f25f85b1": {
						"parentId": "3bd54027-310d-44ef-ae0c-ebd6bbdff223",
						"id": "dfbc0ae2-db50-40c1-a9d0-1559f25f85b1",
						"childrenIds": [],
						"role": "assistant",
						"content": "It seems I cannot directly execute a Python script to check the time for you. However, here's a Python code snippet that you can run on your system to get the current time:\n\n```python\nimport datetime\n\n# Get current time\ncurrent_time = datetime.datetime.now()\n\n# Print formatted time\nprint(\"Current time:\", current_time.strftime(\"%Y-%m-%d %H:%M:%S\"))\n```\n\nYou can copy this code and run it in your local Python environment to display the current time.",
						"model": "openai_manifold_pipeline.chatgpt-4o-latest",
						"modelName": "OpenAI: chatgpt-4o-latest",
						"modelIdx": 0,
						"userContext": "",
						"timestamp": 1726790715,
						"statusHistory": [
							{
								"status": "in_progress",
								"description": "Checking if environment supports sandboxing...",
								"done": false
							},
							{
								"status": "in_progress",
								"description": "Checking if environment supports sandboxing...",
								"done": false
							},
							{
								"status": "in_progress",
								"description": "Initializing sandbox configuration...",
								"done": false
							},
							{
								"status": "in_progress",
								"description": "Initializing sandbox configuration...",
								"done": false
							},
							{
								"status": "in_progress",
								"description": "Running Python code in gVisor sandbox...",
								"done": false
							},
							{
								"status": "in_progress",
								"description": "Running Python code in gVisor sandbox...",
								"done": false
							},
							{
								"status": "error",
								"description": "[DEBUG MODE] Sandbox runtime failed: Command '('/usr/local/bin/python3', '/tmp/tmp0184d281')' returned non-zero exit status 2. (stderr: /usr/local/bin/python3: can't open file '/tmp/tmp0184d281': [Errno 2] No such file or directory\n); language=python; code=import datetime; datetime.datetime.now().isoformat(); valves=[NETWORKING_ALLOWED=True MAX_RUNTIME_SECONDS=30 MAX_RAM_MEGABYTES=512 AUTO_INSTALL=True DEBUG=True]",
								"done": true
							}
						],
						"lastSentence": "It seems I cannot directly execute a Python script to check the time for you.",
						"done": true
					}
				},
				"currentId": "dfbc0ae2-db50-40c1-a9d0-1559f25f85b1"
			},
			"tags": [],
			"timestamp": 1726790715674,
			"files": []
		},
		"updated_at": 1726790721,
		"created_at": 1726790715,
		"share_id": null,
		"archived": false
	}
]
`docker inspect open-webui:`
[
    {
        "Id": "11a1a432f30b63ccff8e11a4a9a97f5d7d97458a731e5ba825bd1753b8db7c14",
        "Created": "2024-09-19T23:34:32.485947375Z",
        "Path": "bash",
        "Args": [
            "start.sh"
        ],
        "State": {
            "Status": "running",
            "Running": true,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 3286998,
            "ExitCode": 0,
            "Error": "",
            "StartedAt": "2024-09-19T23:34:33.170957583Z",
            "FinishedAt": "0001-01-01T00:00:00Z",
            "Health": {
                "Status": "healthy",
                "FailingStreak": 0,
                "Log": [
                    {
                        "Start": "2024-09-20T00:10:38.619159961Z",
                        "End": "2024-09-20T00:10:38.688777794Z",
                        "ExitCode": 0,
                        "Output": "true\n"
                    },
                    {
                        "Start": "2024-09-20T00:11:08.694900627Z",
                        "End": "2024-09-20T00:11:08.748818252Z",
                        "ExitCode": 0,
                        "Output": "true\n"
                    },
                    {
                        "Start": "2024-09-20T00:11:38.757696044Z",
                        "End": "2024-09-20T00:11:38.835816961Z",
                        "ExitCode": 0,
                        "Output": "true\n"
                    },
                    {
                        "Start": "2024-09-20T00:12:08.838965044Z",
                        "End": "2024-09-20T00:12:08.896036336Z",
                        "ExitCode": 0,
                        "Output": "true\n"
                    },
                    {
                        "Start": "2024-09-20T00:12:38.896694961Z",
                        "End": "2024-09-20T00:12:38.971627294Z",
                        "ExitCode": 0,
                        "Output": "true\n"
                    }
                ]
            }
        },
        "Image": "sha256:6ca3fae60a1d176e9ea78f2843de68eceb3a887d8fcef1207976aff8a70bd214",
        "ResolvConfPath": "/var/lib/docker/containers/11a1a432f30b63ccff8e11a4a9a97f5d7d97458a731e5ba825bd1753b8db7c14/resolv.conf",
        "HostnamePath": "/var/lib/docker/containers/11a1a432f30b63ccff8e11a4a9a97f5d7d97458a731e5ba825bd1753b8db7c14/hostname",
        "HostsPath": "/var/lib/docker/containers/11a1a432f30b63ccff8e11a4a9a97f5d7d97458a731e5ba825bd1753b8db7c14/hosts",
        "LogPath": "/var/lib/docker/containers/11a1a432f30b63ccff8e11a4a9a97f5d7d97458a731e5ba825bd1753b8db7c14/11a1a432f30b63ccff8e11a4a9a97f5d7d97458a731e5ba825bd1753b8db7c14-json.log",
        "Name": "/open-webui",
        "RestartCount": 0,
        "Driver": "overlayfs",
        "Platform": "linux",
        "MountLabel": "",
        "ProcessLabel": "",
        "AppArmorProfile": "",
        "ExecIDs": null,
        "HostConfig": {
            "Binds": null,
            "ContainerIDFile": "",
            "LogConfig": {
                "Type": "json-file",
                "Config": {}
            },
            "NetworkMode": "open-webui_default",
            "PortBindings": {
                "8080/tcp": [
                    {
                        "HostIp": "",
                        "HostPort": "3009"
                    }
                ]
            },
            "RestartPolicy": {
                "Name": "unless-stopped",
                "MaximumRetryCount": 0
            },
            "AutoRemove": false,
            "VolumeDriver": "",
            "VolumesFrom": null,
            "ConsoleSize": [
                0,
                0
            ],
            "CapAdd": null,
            "CapDrop": null,
            "CgroupnsMode": "private",
            "Dns": null,
            "DnsOptions": null,
            "DnsSearch": null,
            "ExtraHosts": [
                "host.docker.internal:host-gateway"
            ],
            "GroupAdd": null,
            "IpcMode": "private",
            "Cgroup": "",
            "Links": null,
            "OomScoreAdj": 0,
            "PidMode": "",
            "Privileged": true,
            "PublishAllPorts": false,
            "ReadonlyRootfs": false,
            "SecurityOpt": [
                "label=disable"
            ],
            "UTSMode": "",
            "UsernsMode": "",
            "ShmSize": 67108864,
            "Runtime": "runc",
            "Isolation": "",
            "CpuShares": 0,
            "Memory": 0,
            "NanoCpus": 0,
            "CgroupParent": "",
            "BlkioWeight": 0,
            "BlkioWeightDevice": null,
            "BlkioDeviceReadBps": null,
            "BlkioDeviceWriteBps": null,
            "BlkioDeviceReadIOps": null,
            "BlkioDeviceWriteIOps": null,
            "CpuPeriod": 0,
            "CpuQuota": 0,
            "CpuRealtimePeriod": 0,
            "CpuRealtimeRuntime": 0,
            "CpusetCpus": "",
            "CpusetMems": "",
            "Devices": null,
            "DeviceCgroupRules": null,
            "DeviceRequests": null,
            "MemoryReservation": 0,
            "MemorySwap": 0,
            "MemorySwappiness": null,
            "OomKillDisable": null,
            "PidsLimit": null,
            "Ulimits": null,
            "CpuCount": 0,
            "CpuPercent": 0,
            "IOMaximumIOps": 0,
            "IOMaximumBandwidth": 0,
            "Mounts": [
                {
                    "Type": "volume",
                    "Source": "open-webui_open-webui",
                    "Target": "/app/backend/data",
                    "VolumeOptions": {}
                }
            ],
            "MaskedPaths": null,
            "ReadonlyPaths": null
        },
        "GraphDriver": {
            "Data": null,
            "Name": "overlayfs"
        },
        "Mounts": [
            {
                "Type": "volume",
                "Name": "open-webui_open-webui",
                "Source": "/var/lib/docker/volumes/open-webui_open-webui/_data",
                "Destination": "/app/backend/data",
                "Driver": "local",
                "Mode": "z",
                "RW": true,
                "Propagation": ""
            }
        ],
        "Config": {
            "Hostname": "11a1a432f30b",
            "Domainname": "",
            "User": "0:0",
            "AttachStdin": false,
            "AttachStdout": true,
            "AttachStderr": true,
            "ExposedPorts": {
                "8080/tcp": {}
            },
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "OPENAI_API_BASE_URL=http://host.docker.internal:9099",
                "OLLAMA_BASE_URL=http://ollama:11434",
                "OPENAI_API_KEY=0p3n-w3bu!",
                "WEBUI_URL=https://chat.example.com/",
                "RAG_WEB_SEARCH_CONCURRENT_REQUESTS=10",
                "ENABLE_RAG_WEB_SEARCH=True",
                "RAG_WEB_SEARCH_ENGINE=searxng",
                "RAG_WEB_SEARCH_RESULT_COUNT=3",
                "PDF_EXTRACT_IMAGES=True",
                "SEARXNG_QUERY_URL=http://host.docker.internal:3010/search?q=\u003cquery\u003e",
                "PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "LANG=C.UTF-8",
                "GPG_KEY=",
                "PYTHON_VERSION=3.11.10",
                "ENV=prod",
                "PORT=8080",
                "USE_OLLAMA_DOCKER=false",
                "USE_CUDA_DOCKER=false",
                "USE_CUDA_DOCKER_VER=cu121",
                "USE_EMBEDDING_MODEL_DOCKER=sentence-transformers/all-MiniLM-L6-v2",
                "USE_RERANKING_MODEL_DOCKER=",
                "SCARF_NO_ANALYTICS=true",
                "DO_NOT_TRACK=true",
                "ANONYMIZED_TELEMETRY=false",
                "WHISPER_MODEL=base",
                "WHISPER_MODEL_DIR=/app/backend/data/cache/whisper/models",
                "SENTENCE_TRANSFORMERS_HOME=/app/backend/data/cache/embedding/models",
                "HF_HOME=/app/backend/data/cache/embedding/models",
                "HOME=/root",
                "WEBUI_BUILD_VERSION=83855b713b0f211144993486ac5265d3d67bb1f8",
                "DOCKER=true"
            ],
            "Cmd": [
                "bash",
                "start.sh"
            ],
            "Healthcheck": {
                "Test": [
                    "CMD-SHELL",
                    "curl --silent --fail http://localhost:${PORT:-8080}/health | jq -ne 'input.status == true' || exit 1"
                ]
            },
            "Image": "ghcr.io/open-webui/open-webui:main",
            "Volumes": null,
            "WorkingDir": "/app/backend",
            "Entrypoint": null,
            "OnBuild": null,
            "Labels": {
                "com.docker.compose.config-hash": "959450e92210409b370ba665fc800cf6037eee39f512cb68b44cfdfc824ffe03",
                "com.docker.compose.container-number": "1",
                "com.docker.compose.depends_on": "pipelines:service_started:false,ollama:service_started:false",
                "com.docker.compose.image": "sha256:6ca3fae60a1d176e9ea78f2843de68eceb3a887d8fcef1207976aff8a70bd214",
                "com.docker.compose.oneoff": "False",
                "com.docker.compose.project": "open-webui",
                "com.docker.compose.project.config_files": "/Users/lilbro/Docker/open-webui/compose.yaml",
                "com.docker.compose.project.working_dir": "/Users/lilbro/Docker/open-webui",
                "com.docker.compose.service": "open-webui",
                "com.docker.compose.version": "2.29.2",
                "org.opencontainers.image.created": "2024-09-19T22:27:30.644Z",
                "org.opencontainers.image.description": "User-friendly WebUI for LLMs (Formerly Ollama WebUI)",
                "org.opencontainers.image.licenses": "MIT",
                "org.opencontainers.image.revision": "83855b713b0f211144993486ac5265d3d67bb1f8",
                "org.opencontainers.image.source": "https://github.com/open-webui/open-webui",
                "org.opencontainers.image.title": "open-webui",
                "org.opencontainers.image.url": "https://github.com/open-webui/open-webui",
                "org.opencontainers.image.version": "main"
            }
        },
        "NetworkSettings": {
            "Bridge": "",
            "SandboxID": "0c6fd0238b30978da2c9050175338efbda44bb1c66a98d9b61336284225b6c5e",
            "SandboxKey": "/var/run/docker/netns/0c6fd0238b30",
            "Ports": {
                "8080/tcp": [
                    {
                        "HostIp": "0.0.0.0",
                        "HostPort": "3009"
                    }
                ]
            },
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "EndpointID": "",
            "Gateway": "",
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "IPAddress": "",
            "IPPrefixLen": 0,
            "IPv6Gateway": "",
            "MacAddress": "",
            "Networks": {
                "open-webui_default": {
                    "IPAMConfig": null,
                    "Links": null,
                    "Aliases": [
                        "open-webui",
                        "open-webui"
                    ],
                    "MacAddress": "02:42:ac:1e:00:05",
                    "DriverOpts": null,
                    "NetworkID": "488ee94558cf078367c140aae915426928eabb9388fc88858a0816f620df6060",
                    "EndpointID": "b5afcdcba59d610947d2a8565860c8fd7eddc6f8e6c84b544693a18ec87d0c37",
                    "Gateway": "172.30.0.1",
                    "IPAddress": "172.30.0.5",
                    "IPPrefixLen": 16,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "DNSNames": [
                        "open-webui",
                        "11a1a432f30b"
                    ]
                }
            }
        }
    }
]
compose.yaml:
services:
    ollama:
        container_name: ollama
        pull_policy: always
        tty: true
        restart: unless-stopped
        image: ollama/ollama:${OLLAMA_DOCKER_TAG-latest}
        ports:
            - ${OLLAMA_WEBAPI_PORT-11434}:11434
        volumes:
            - ollama:/root/.ollama

    open-webui:
        image: ghcr.io/open-webui/open-webui:${WEBUI_DOCKER_TAG-main}
        container_name: open-webui
        privileged: true
        volumes:
            - open-webui:/app/backend/data
        depends_on:
            - ollama
            - pipelines
        ports:
            - ${OPEN_WEBUI_PORT-3009}:8080
        environment:
            - "OLLAMA_BASE_URL=http://ollama:11434"
            - "WEBUI_SECRET_KEY=example"
            - "OPENAI_API_BASE_URL=http://host.docker.internal:9099"
            - "OPENAI_API_KEY=0p3n-w3bu!"
            - "WEBUI_URL=https://chat.example.com/"
            - "PDF_EXTRACT_IMAGES=True"
            - "ENABLE_RAG_WEB_SEARCH=True"
            - "RAG_WEB_SEARCH_ENGINE=searxng"
            - "RAG_WEB_SEARCH_RESULT_COUNT=3"
            - "RAG_WEB_SEARCH_CONCURRENT_REQUESTS=10"
            - "SEARXNG_QUERY_URL=http://host.docker.internal:3010/search?q=<query>"
        extra_hosts:
            - host.docker.internal:host-gateway
        restart: unless-stopped

    pipelines:
        image: ghcr.io/open-webui/pipelines:main
        container_name: pipelines
        volumes:
            - ./pipelines:/app/pipelines
        ports:
            - 9099:9099
        extra_hosts:
            - host.docker.internal:host-gateway
        restart: unless-stopped
    
    searxng:
        image: searxng/searxng:latest
        container_name: searxng
        ports:
            - 3010:8080
        volumes:
            - ./searxng:/etc/searxng
        restart: unless-stopped

volumes:
    ollama: {}
    open-webui: {}
    pipelines: {}
@EtiennePerot
Copy link
Owner

I think I see the problem. I should have a fix out this weekend. In the meantime, you can work around this problem by using Open WebUI v0.3.21 or older.

@EtiennePerot
Copy link
Owner

Some more details as to what the problem is: Open WebUI 0.3.22 restored the ability for a module to use __file__ (see #11). However the __file__ it points to only exists at module import time, not at tool execution time. So the tool fails to re-execute itself based on this __file__ when it runs. The fix is for the tool to automatically copy itself at module import time.

@EntropyYue
Copy link
Contributor

I think I see the problem. I should have a fix out this weekend. In the meantime, you can work around this problem by using Open WebUI v0.3.21 or older.

Can you add a configurable value in the update to set the proxy server? It will be used for installing gvisor. I really need it, thank you very much

@EtiennePerot
Copy link
Owner

@xiaopa233 You can set the HTTPS_PROXY environment variable. I'll update the documentation to reflect this.

@EtiennePerot
Copy link
Owner

EtiennePerot commented Sep 23, 2024

The "can't open file /tmp/*: no such file or directory" issue should be fixed as of release 0.6.0, please update!

@jedwards1230
Copy link
Contributor Author

Works great. Thank you!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants