-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[Bug]: pylcs wheel fails to install when running make build #5793
Comments
@autonomousit for the latter, can you try this fix? |
@enyst - thanks for the quick response, wasn't expecting it over the holidays :-) I implemented that fix and now Just for the record here's the error I now get for Starting backend...
INFO: Will watch for changes in these directories: ['/home/ben/Documents/OpenHands']
INFO: Uvicorn running on http://127.0.0.1:3000 (Press CTRL+C to quit)
INFO: Started reloader process [50464] using WatchFiles
Process SpawnProcess-1:
Traceback (most recent call last):
File "/usr/lib/python3.12/multiprocessing/process.py", line 314, in _bootstrap
self.run()
File "/usr/lib/python3.12/multiprocessing/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "/home/ben/.cache/pypoetry/virtualenvs/openhands-ai-7a98SNbC-py3.12/lib/python3.12/site-packages/uvicorn/_subprocess.py", line 80, in subprocess_started
target(sockets=sockets)
File "/home/ben/.cache/pypoetry/virtualenvs/openhands-ai-7a98SNbC-py3.12/lib/python3.12/site-packages/uvicorn/server.py", line 66, in run
return asyncio.run(self.serve(sockets=sockets))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/asyncio/runners.py", line 194, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/asyncio/base_events.py", line 686, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/home/ben/.cache/pypoetry/virtualenvs/openhands-ai-7a98SNbC-py3.12/lib/python3.12/site-packages/uvicorn/server.py", line 70, in serve
await self._serve(sockets)
File "/home/ben/.cache/pypoetry/virtualenvs/openhands-ai-7a98SNbC-py3.12/lib/python3.12/site-packages/uvicorn/server.py", line 77, in _serve
config.load()
File "/home/ben/.cache/pypoetry/virtualenvs/openhands-ai-7a98SNbC-py3.12/lib/python3.12/site-packages/uvicorn/config.py", line 435, in load
self.loaded_app = import_from_string(self.app)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ben/.cache/pypoetry/virtualenvs/openhands-ai-7a98SNbC-py3.12/lib/python3.12/site-packages/uvicorn/importer.py", line 22, in import_from_string
raise exc from None
File "/home/ben/.cache/pypoetry/virtualenvs/openhands-ai-7a98SNbC-py3.12/lib/python3.12/site-packages/uvicorn/importer.py", line 19, in import_from_string
module = importlib.import_module(module_str)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/importlib/__init__.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 999, in exec_module
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "/home/ben/Documents/OpenHands/openhands/server/listen.py", line 3, in <module>
from openhands.server.app import app as base_app
File "/home/ben/Documents/OpenHands/openhands/server/app.py", line 11, in <module>
import openhands.agenthub # noqa F401 (we import this to get the agents registered)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ben/Documents/OpenHands/openhands/agenthub/__init__.py", line 3, in <module>
from openhands.agenthub.micro.agent import MicroAgent
File "/home/ben/Documents/OpenHands/openhands/agenthub/micro/agent.py", line 5, in <module>
from openhands.controller.agent import Agent
File "/home/ben/Documents/OpenHands/openhands/controller/__init__.py", line 1, in <module>
from openhands.controller.agent_controller import AgentController
File "/home/ben/Documents/OpenHands/openhands/controller/agent_controller.py", line 10, in <module>
from openhands.controller.agent import Agent
File "/home/ben/Documents/OpenHands/openhands/controller/agent.py", line 13, in <module>
from openhands.runtime.plugins import PluginRequirement
File "/home/ben/Documents/OpenHands/openhands/runtime/__init__.py", line 3, in <module>
from openhands.runtime.impl.eventstream.eventstream_runtime import (
File "/home/ben/Documents/OpenHands/openhands/runtime/impl/eventstream/eventstream_runtime.py", line 44, in <module>
from openhands.runtime.base import Runtime
File "/home/ben/Documents/OpenHands/openhands/runtime/base.py", line 41, in <module>
from openhands.runtime.utils.edit import FileEditRuntimeMixin
File "/home/ben/Documents/OpenHands/openhands/runtime/utils/edit.py", line 28, in <module>
from openhands.utils.chunk_localizer import Chunk, get_top_k_chunk_matches
File "/home/ben/Documents/OpenHands/openhands/utils/chunk_localizer.py", line 7, in <module>
import pylcs
File "/home/ben/.cache/pypoetry/virtualenvs/openhands-ai-7a98SNbC-py3.12/lib/python3.12/site-packages/pylcs/__init__.py", line 2, in <module>
from _pylcs import *
ModuleNotFoundError: No module named '_pylcs' |
That is weird, but this is suspicious:
We are using 3.12+, 3.12 is minimum. Where did python 3.10 come from? Maybe you can see if you can upgrade poetry? |
@enyst - I'm running on an Ubuntu derivative (pop-os) where python 3.10.x is the system default, I've installed 3.12.8 and poetry should have everything pointing to that. It should just be poetry running on the native system python version and everything in the openhands virtual environment should be on 3.12.8. P.S. I'm headed to bed shortly so don't stress about getting me a quick answer now as I won't see it. |
The log looks like it was trying to install this library on 3.10, and that would not be useful. It What version is poetry, is it up to date? |
Hey @enyst, If I create a simple (pylcs_test_local) ben@local:~/Documents/pylcs_test_local$ pip3 install pylcs
Collecting pylcs
Downloading pylcs-0.1.1.tar.gz (11 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Collecting pybind11>=2.2
Using cached pybind11-2.13.6-py3-none-any.whl (243 kB)
Building wheels for collected packages: pylcs
Building wheel for pylcs (pyproject.toml) ... done
Created wheel for pylcs: filename=pylcs-0.1.1-cp310-cp310-linux_x86_64.whl size=1082092 sha256=7b4eeb5d1cffd40a967e5a3e8d249a4fc58ba8886c185712a92731dbc5df8ae6
Stored in directory: /home/ben/.cache/pip/wheels/eb/64/e8/c902162e883f432251466566e011016795ea03b95d4350d0ee
Successfully built pylcs
Installing collected packages: pybind11, pylcs
Successfully installed pybind11-2.13.6 pylcs-0.1.1 If I try and do the same using python 3.12.8 I get the First install of (pylcs_test) ben@local-pc:~/Documents/pylcs_test$ python3.12 -m pip install pylcs
Collecting pylcs
Downloading pylcs-0.1.1.tar.gz (11 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Collecting pybind11>=2.2 (from pylcs)
Using cached pybind11-2.13.6-py3-none-any.whl.metadata (9.5 kB)
Using cached pybind11-2.13.6-py3-none-any.whl (243 kB)
Building wheels for collected packages: pylcs
Building wheel for pylcs (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for pylcs (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [21 lines of output]
running bdist_wheel
running build
running build_py
creating build/lib.linux-x86_64-cpython-312/pylcs
copying pylcs/__init__.py -> build/lib.linux-x86_64-cpython-312/pylcs
running build_ext
creating tmp
x86_64-linux-gnu-g++ -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/home/ben/Documents/pylcs_test/include -I/usr/include/python3.12 -c /tmp/tmppd20sw4q.cpp -o tmp/tmppd20sw4q.o -std=c++14
x86_64-linux-gnu-g++ -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/home/ben/Documents/pylcs_test/include -I/usr/include/python3.12 -c /tmp/tmph8p_2zae.cpp -o tmp/tmph8p_2zae.o -fvisibility=hidden
building '_pylcs' extension
creating build/temp.linux-x86_64-cpython-312/src
x86_64-linux-gnu-g++ -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/tmp/pip-build-env-npfp6a1d/overlay/lib/python3.12/site-packages/pybind11/include -I/tmp/pip-build-env-npfp6a1d/overlay/lib/python3.12/site-packages/pybind11/include -I/home/ben/Documents/pylcs_test/include -I/usr/include/python3.12 -c src/main.cpp -o build/temp.linux-x86_64-cpython-312/src/main.o -DVERSION_INFO=\"0.1.1\" -std=c++14 -fvisibility=hidden
In file included from /tmp/pip-build-env-npfp6a1d/overlay/lib/python3.12/site-packages/pybind11/include/pybind11/attr.h:13,
from /tmp/pip-build-env-npfp6a1d/overlay/lib/python3.12/site-packages/pybind11/include/pybind11/detail/class.h:12,
from /tmp/pip-build-env-npfp6a1d/overlay/lib/python3.12/site-packages/pybind11/include/pybind11/pybind11.h:12,
from src/main.cpp:1:
/tmp/pip-build-env-npfp6a1d/overlay/lib/python3.12/site-packages/pybind11/include/pybind11/detail/common.h:274:10: fatal error: Python.h: No such file or directory
274 | #include <Python.h>
| ^~~~~~~~~~
compilation terminated.
error: command '/usr/bin/x86_64-linux-gnu-g++' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pylcs
Failed to build pylcs
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (pylcs) Second install attempt for python3.12.8 after installing (pylcs_test) ben@local-pc:~/Documents/pylcs_test$ python3.12 -m pip install pybind11
Collecting pybind11
Using cached pybind11-2.13.6-py3-none-any.whl.metadata (9.5 kB)
Using cached pybind11-2.13.6-py3-none-any.whl (243 kB)
Installing collected packages: pybind11
Successfully installed pybind11-2.13.6
(pylcs_test) ben@local-pc:~/Documents/pylcs_test$ python3.12 -m pip install pylcs
Collecting pylcs
Using cached pylcs-0.1.1.tar.gz (11 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: pybind11>=2.2 in ./lib/python3.12/site-packages (from pylcs) (2.13.6)
Building wheels for collected packages: pylcs
Building wheel for pylcs (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for pylcs (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [21 lines of output]
running bdist_wheel
running build
running build_py
creating build/lib.linux-x86_64-cpython-312/pylcs
copying pylcs/__init__.py -> build/lib.linux-x86_64-cpython-312/pylcs
running build_ext
creating tmp
x86_64-linux-gnu-g++ -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/home/ben/Documents/pylcs_test/include -I/usr/include/python3.12 -c /tmp/tmpds1j6h_g.cpp -o tmp/tmpds1j6h_g.o -std=c++14
x86_64-linux-gnu-g++ -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/home/ben/Documents/pylcs_test/include -I/usr/include/python3.12 -c /tmp/tmpap9deoqm.cpp -o tmp/tmpap9deoqm.o -fvisibility=hidden
building '_pylcs' extension
creating build/temp.linux-x86_64-cpython-312/src
x86_64-linux-gnu-g++ -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/tmp/pip-build-env-w8a1dhso/overlay/lib/python3.12/site-packages/pybind11/include -I/tmp/pip-build-env-w8a1dhso/overlay/lib/python3.12/site-packages/pybind11/include -I/home/ben/Documents/pylcs_test/include -I/usr/include/python3.12 -c src/main.cpp -o build/temp.linux-x86_64-cpython-312/src/main.o -DVERSION_INFO=\"0.1.1\" -std=c++14 -fvisibility=hidden
In file included from /tmp/pip-build-env-w8a1dhso/overlay/lib/python3.12/site-packages/pybind11/include/pybind11/attr.h:13,
from /tmp/pip-build-env-w8a1dhso/overlay/lib/python3.12/site-packages/pybind11/include/pybind11/detail/class.h:12,
from /tmp/pip-build-env-w8a1dhso/overlay/lib/python3.12/site-packages/pybind11/include/pybind11/pybind11.h:12,
from src/main.cpp:1:
/tmp/pip-build-env-w8a1dhso/overlay/lib/python3.12/site-packages/pybind11/include/pybind11/detail/common.h:274:10: fatal error: Python.h: No such file or directory
274 | #include <Python.h>
| ^~~~~~~~~~
compilation terminated.
error: command '/usr/bin/x86_64-linux-gnu-g++' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pylcs
Failed to build pylcs
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (pylcs) |
@enyst you won't believe how stupid this was. When I installed Python 3.12 on my system I did Sorry for wasting your time. |
I've hit this same issue, and i confirm that the installation of dev solved it! :) I wouldn't say it's stupid, it's not at all obvious that one should install python3.12-dev (?) why? |
Thank you for the follow-ups! We may want to remember this for the future. Is your system also a Linux system, @gordicaleksa ? |
May or may not be helpful, but I have to run |
@gordicaleksa - glad my comments helped. @enyst - since multiple people have stumbled on this step, perhaps a small hint in the Development.md requirements section would help in future. |
Is there an existing issue for the same bug?
Describe the bug and reproduction steps
When running
make build
(using latest commit to main #5784) it fails to install with a single error for the Python dependencypylcs
. This issue seems related to not being able to findpybind11
bindings. This may be an upstream issue with pylcs (see this Github Issue).Deleting the
poetry.lock
file and addingpybind11
topyproject.toml
didn't resolve the issue. Instead I manually downloaded the wheel file forpylcs
from piwheels.org and modifiedpyproject.toml
to point to the local wheel file forpylcs
as shown below:pylcs = { file = "/path/to/wheel/pylcs-0.1.1-cp39-cp39-linux_armv7l.whl" }
Everything then installed correctly and I can run
make setup-config
no problems however when I then runmake run
it fails due to not finding_pylcs
. I can run alsomake start-frontend
without errors butmake start-backend
results in another, different error.OpenHands Installation
Development workflow
OpenHands Version
main
Operating System
Linux
Logs, Errors, Screenshots, and Additional Context
Original install error
Make Run Error
Different make start-backend erro
The text was updated successfully, but these errors were encountered: