OpenHands icon indicating copy to clipboard operation
OpenHands copied to clipboard

[Bug]: "make run" results in "ModuleNotFoundError: No module named 'opendevin'"

Open Yn8en opened this issue 1 year ago • 6 comments

Is there an existing issue for the same bug?

  • [X] I have checked the troubleshooting document at https://github.com/OpenDevin/OpenDevin/blob/main/docs/guides/Troubleshooting.md
  • [X] I have checked the existing issues.

Describe the bug

Hey Guys, after having a successful build in WSL (poetry install, poetry shell make build) ...

executing "make run" command results in the below described error: ModuleNotFoundError: No module named 'opendevin'

Current Version

Just pulled the repo freshly today, this morning Commit: 3eea6de5 / Branch: main

Installation and Configuration > Reproduction Steps

I use bash > WSL (ubuntu) with all dependencies installed.

> wsl

... ubuntu used, all requirements installed (node, python, npm, pipx, poetry, ...) ... "make build" passes all tests

> poetry install
> poetry shell
> make build 

----- resulting in ------------------------------------------------------------

Build using "make build" was successful:
> [email protected] build
> tsc && vite build

vite v5.2.8 building for production...
✓ 1319 modules transformed.
dist/index.html                         2.00 kB │ gzip:   0.93 kB
dist/assets/index-BFv3DKUU.css        180.42 kB │ gzip:  21.91 kB
dist/assets/web-vitals-BA3w2fPb.js      4.31 kB │ gzip:   1.68 kB
dist/assets/index-jwUbCSUE.js       1,080.03 kB │ gzip: 319.22 kB

(!) Some chunks are larger than 500 kB after minification. Consider:
- Using dynamic import() to code-split the application
- Use build.rollupOptions.output.manualChunks to improve chunking: https://rollupjs.org/configuration-options/#output-manualchunks
- Adjust chunk size limit for this warning via build.chunkSizeWarningLimit.
✓ built in 21.23s
Build completed successfully.

make setup-config

----- resulting in -------- config.toml ---------------------------------------

LLM_MODEL="gpt-3.5-turbo-1106"
LLM_API_KEY="sk-***"
LLM_EMBEDDING_MODEL=""
WORKSPACE_BASE="/mnt/p/Projects/MyWorkspaceFolder"

make run

----- resulting in ------------------------------------------------------------

myawesomename@myawesome-PC:/mnt/p/Projects/OpenDevin$ make run
Running the app...
Starting backend server...
Waiting for the backend to start...
Traceback (most recent call last):
  File "/mnt/p/Projects/OpenDevin/.venv/bin/uvicorn", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/mnt/p/Projects/OpenDevin/.venv/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/p/Projects/OpenDevin/.venv/lib/python3.11/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/mnt/p/Projects/OpenDevin/.venv/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/p/Projects/OpenDevin/.venv/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/p/Projects/OpenDevin/.venv/lib/python3.11/site-packages/uvicorn/main.py", line 409, in main
    run(
  File "/mnt/p/Projects/OpenDevin/.venv/lib/python3.11/site-packages/uvicorn/main.py", line 575, in run
    server.run()
  File "/mnt/p/Projects/OpenDevin/.venv/lib/python3.11/site-packages/uvicorn/server.py", line 65, in run
    return asyncio.run(self.serve(sockets=sockets))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "uvloop/loop.pyx", line 1517, in uvloop.loop.Loop.run_until_complete
  File "/mnt/p/Projects/OpenDevin/.venv/lib/python3.11/site-packages/uvicorn/server.py", line 69, in serve
    await self._serve(sockets)
  File "/mnt/p/Projects/OpenDevin/.venv/lib/python3.11/site-packages/uvicorn/server.py", line 76, in _serve
    config.load()
  File "/mnt/p/Projects/OpenDevin/.venv/lib/python3.11/site-packages/uvicorn/config.py", line 433, in load
    self.loaded_app = import_from_string(self.app)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/p/Projects/OpenDevin/.venv/lib/python3.11/site-packages/uvicorn/importer.py", line 22, in import_from_string
    raise exc from None
  File "/mnt/p/Projects/OpenDevin/.venv/lib/python3.11/site-packages/uvicorn/importer.py", line 19, in import_from_string
    module = importlib.import_module(module_str)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1126, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1126, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1140, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'opendevin'

interrupting ctrl+c leads to:

^Cmake: *** [Makefile:176: run] Interrupt

... so the error clearly happens somewhere inside execution of Line 177 in the "Makefile"

@poetry run uvicorn opendevin.server.listen:app --port $(BACKEND_PORT) &

Model and Agent

no agents chosen, didnt arrive there yet i guess.

> config.toml see above

Yn8en avatar Apr 24 '24 22:04 Yn8en

@Yn8en try setting PYTHONPATH=$(pwd) in your env

rbren avatar Apr 24 '24 22:04 rbren

thanks for the fast reply, i just tried as you suggested:

myawesomename@myawesome-PC:/mnt/p/Projects/OpenDevin$ export PYTHONPATH=$(pwd)
myawesomename@myawesome-PC:/mnt/p/Projects/OpenDevin$ make run

... results in the exact same behaviour!

Yn8en avatar Apr 24 '24 22:04 Yn8en

Could you share the log of make build?

SmartManoj avatar Apr 24 '24 23:04 SmartManoj

Update still regarding the same issue: I did a fresh install of ubuntu WSL over again, going the following sequence of steps:

# unregister ubuntu distro in WSL and reinstall freshly
wsl --unregister ubuntu
wsl --install -d Ubuntu
exit
wsl --set-default Ubuntu
#open bash in VScode
wsl
cd /mnt/p/Projects/OpenDevin
        > me@My-PC:/mnt/p/Projects/OpenDevin$


## basic setup
sudo apt update
sudo apt upgrade -y
sudo apt install make
sudo apt install build-essential -y


#installing python and setting python symlink for python 3.11
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt install python3.11
sudo ln -s /usr/bin/python3.11 /usr/bin/python
python -V
    > Python 3.11.9
python3.11 -V
    > Python 3.11.9


#install Node
sudo apt install nodejs -y
node --version
    > v12.22.9


#installing & activating nvm >> https://github.com/nvm-sh/nvm#installing-and-updating
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion
command -v nvm
    > nvm


#update3 node to v20.12.2
nvm install --lts
    > Now using node v20.12.2 (npm v10.5.0)
nvm use v20.12.2
    > Now using node v20.12.2 (npm v10.5.0)

#install pip and poetry
sudo apt install python3-pip -y
pip install poetry
export PATH="$HOME/.local/bin:$PATH"
poetry -V
    > Poetry (version 1.8.2)
poetry config virtualenvs.in-project true

----------- WSL UBUNTU PREPARATION COMPLETE ------------

#pulled latest commit from OpenDevin
    branch: MAIN
    commit: c45e2ae


#go to OpenDevin Folder and activate venv
poetry env use python3.11
    > (opendevin-py3.11) me@My-PC:/mnt/p/Projects/OpenDevin$
poetry shell
poetry install
#build
make build
    .. or
make build > build.log 2>&1
    (see build.log ...)
    ✓ built in 21.71s
    Build completed successfully.
#setup config
make setup-config
    LLM_MODEL="gpt-3.5-turbo-1106"
    LLM_API_KEY="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"
    LLM_EMBEDDING_MODEL=""
    WORKSPACE_BASE="/mnt/p/Projects/VERGIL-OpenDevin"
#run
make run
    .. or
make run > run.log 2>&1
    (see run.log ...)
    > ModuleNotFoundError: No module named 'opendevin'

build.log run.log

Yn8en avatar Apr 25 '24 18:04 Yn8en

https://github.com/OpenDevin/OpenDevin/issues/584#issuecomment-2032410758

SmartManoj avatar Apr 26 '24 03:04 SmartManoj

thanks for the info, i gonna look into it later and come back with what i got

Yn8en avatar Apr 26 '24 11:04 Yn8en

This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Jun 05 '24 01:06 github-actions[bot]

This issue was closed because it has been stalled for over 30 days with no activity.

github-actions[bot] avatar Jun 12 '24 01:06 github-actions[bot]