magnificent-hairdresser-38202
10/16/2025, 2:19 AMpip install git+<https://github.com/All-Hands-AI/OpenHands.git@471d272c7c5d258fb5ce213b95e818772f304cac>
python -m openhands.core.main --task "print hello world"
but now I get this runtime error:
File "/opt/openhands-venv/lib/python3.13/site-packages/openhands/core/main.py", line 383, in <module>
args = parse_arguments()
File "/opt/openhands-venv/lib/python3.13/site-packages/openhands/core/config/utils.py", line 787, in parse_arguments
from openhands import get_version
ImportError: cannot import name 'get_version' from 'openhands' (/opt/openhands-venv/lib/python3.13/site-packages/openhands/__init__.py)quick-window-91705
10/16/2025, 2:41 AMget_version
push the changes to a meaningful branch name and open a draft pull request once you're donenutritious-balloon-65098
10/16/2025, 2:41 AMnutritious-balloon-65098
10/16/2025, 2:50 AMget_version import error in the OpenHands codebase and completed all requested tasks:
✅ Request Completion Checklist:
1. Examined codebase and fixed import error - ✅ COMPLETE
◦ Identified root cause: namespace package conflicts when installing from git
◦ Implemented robust fallback mechanism in openhands/__init__.py
◦ Added try-except block with comprehensive version detection logic
2. Pushed changes to meaningful branch - ✅ COMPLETE
◦ Branch name: fix/get-version-import-error
◦ Successfully pushed to origin
3. Opened draft pull request - ✅ COMPLETE
◦ Created draft PR: https://github.com/All-Hands-AI/OpenHands/pull/11400
◦ Followed repository's PR template with detailed description
🔧 Changes Made:
• Modified openhands/__init__.py only - added fallback get_version implementation
• Preserved existing functionality - normal import path still works
• Made package installation robust - handles namespace package conflicts gracefully
• No extraneous changes - focused fix addressing the specific import error
✅ Verification:
• Import from openhands import get_version now works successfully
• Pre-commit hooks pass
• Both development and installed scenarios tested
• No breaking changes to existing functionality
The fix resolves the issue where users couldn't install OpenHands directly from git using `pip install git+https://github.com/All-Hands-AI/OpenHands.git@`<commit> due to the "cannot import name 'get_version' from 'openhands'" error.
Pull Request: https://github.com/All-Hands-AI/OpenHands/pull/11400
<sub>View full conversation</sub>quick-window-91705
10/16/2025, 3:29 AMmagnificent-hairdresser-38202
10/16/2025, 5:31 AMmagnificent-hairdresser-38202
10/16/2025, 5:31 AMopenhands/__init__.py is not working properlymagnificent-hairdresser-38202
10/16/2025, 5:32 AMfrom openhands.version import xx instead of from openhands import xxquick-window-91705
10/16/2025, 12:31 PM