Windows import pwd error #316

Closed
opened 2025-11-11 14:16:39 -06:00 by GiteaMirror · 5 comments
Owner

Originally created by @babico on GitHub (Feb 18, 2024).

Bug Report

Description

Bug Summary:
Python pwd library not in Windows so langchain library can't work after run start_windows.bat.

Steps to Reproduce:

git clone https://github.com/open-webui/open-webui.git
cd open-webui/
cp -RPp example.env .env

npm i
npm run build

cd ./backend
pip install -r requirements.txt -U
start_windows.bat

Expected Behavior:
Work

Actual Behavior:
Not work

Environment

  • Operating System: Windows 10

Reproduction Details

Confirmation:

  • I have read and followed all the instructions provided in the README.md.
  • I have reviewed the troubleshooting.md document.
  • I have included the console logs.

Logs and Screenshots

Browser Console Logs:

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\bin\.pyenv\pyenv-win\versions\3.11.6\Scripts\uvicorn.exe\__main__.py", line 7, in <module>
  File "C:\bin\.pyenv\pyenv-win\versions\3.11.6\Lib\site-packages\click\core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\bin\.pyenv\pyenv-win\versions\3.11.6\Lib\site-packages\click\core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "C:\bin\.pyenv\pyenv-win\versions\3.11.6\Lib\site-packages\click\core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\bin\.pyenv\pyenv-win\versions\3.11.6\Lib\site-packages\click\core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\bin\.pyenv\pyenv-win\versions\3.11.6\Lib\site-packages\uvicorn\main.py", line 418, in main
    run(
  File "C:\bin\.pyenv\pyenv-win\versions\3.11.6\Lib\site-packages\uvicorn\main.py", line 587, in run
    server.run()
  File "C:\bin\.pyenv\pyenv-win\versions\3.11.6\Lib\site-packages\uvicorn\server.py", line 62, in run
    return asyncio.run(self.serve(sockets=sockets))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\bin\.pyenv\pyenv-win\versions\3.11.6\Lib\asyncio\runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "C:\bin\.pyenv\pyenv-win\versions\3.11.6\Lib\asyncio\runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\bin\.pyenv\pyenv-win\versions\3.11.6\Lib\asyncio\base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "C:\bin\.pyenv\pyenv-win\versions\3.11.6\Lib\site-packages\uvicorn\server.py", line 69, in serve
    config.load()
  File "C:\bin\.pyenv\pyenv-win\versions\3.11.6\Lib\site-packages\uvicorn\config.py", line 458, in load
    self.loaded_app = import_from_string(self.app)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\bin\.pyenv\pyenv-win\versions\3.11.6\Lib\site-packages\uvicorn\importer.py", line 24, in import_from_string
    raise exc from None
  File "C:\bin\.pyenv\pyenv-win\versions\3.11.6\Lib\site-packages\uvicorn\importer.py", line 21, in import_from_string
    module = importlib.import_module(module_str)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\bin\.pyenv\pyenv-win\versions\3.11.6\Lib\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 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "Y:\open-webui\backend\main.py", line 17, in <module>
    from apps.rag.main import app as rag_app
  File "Y:\open-webui\backend\apps\rag\main.py", line 19, in <module>
    from langchain_community.document_loaders import (
  File "C:\bin\.pyenv\pyenv-win\versions\3.11.6\Lib\site-packages\langchain_community\document_loaders\__init__.py", line 163, in <module>
    from langchain_community.document_loaders.pebblo import PebbloSafeLoader
  File "C:\bin\.pyenv\pyenv-win\versions\3.11.6\Lib\site-packages\langchain_community\document_loaders\pebblo.py", line 5, in <module>
    import pwd
ModuleNotFoundError: No module named 'pwd'

Additional Information

I found solution on langchain issue page https://github.com/langchain-ai/langchain/issues/17514#issuecomment-1949073290 I change requirements.txt with pwdless version, and it just work. I didn't test it properly maybe it has some issue.

Originally created by @babico on GitHub (Feb 18, 2024). # Bug Report ## Description **Bug Summary:** Python `pwd` library not in Windows so `langchain` library can't work after run `start_windows.bat`. **Steps to Reproduce:** ``` git clone https://github.com/open-webui/open-webui.git cd open-webui/ cp -RPp example.env .env npm i npm run build cd ./backend pip install -r requirements.txt -U start_windows.bat ``` **Expected Behavior:** Work **Actual Behavior:** Not work ## Environment - **Operating System:** Windows 10 ## Reproduction Details **Confirmation:** - [x] I have read and followed all the instructions provided in the README.md. - [x] I have reviewed the troubleshooting.md document. - [x] I have included the console logs. ## Logs and Screenshots **Browser Console Logs:** ``` Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "C:\bin\.pyenv\pyenv-win\versions\3.11.6\Scripts\uvicorn.exe\__main__.py", line 7, in <module> File "C:\bin\.pyenv\pyenv-win\versions\3.11.6\Lib\site-packages\click\core.py", line 1157, in __call__ return self.main(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\bin\.pyenv\pyenv-win\versions\3.11.6\Lib\site-packages\click\core.py", line 1078, in main rv = self.invoke(ctx) ^^^^^^^^^^^^^^^^ File "C:\bin\.pyenv\pyenv-win\versions\3.11.6\Lib\site-packages\click\core.py", line 1434, in invoke return ctx.invoke(self.callback, **ctx.params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\bin\.pyenv\pyenv-win\versions\3.11.6\Lib\site-packages\click\core.py", line 783, in invoke return __callback(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\bin\.pyenv\pyenv-win\versions\3.11.6\Lib\site-packages\uvicorn\main.py", line 418, in main run( File "C:\bin\.pyenv\pyenv-win\versions\3.11.6\Lib\site-packages\uvicorn\main.py", line 587, in run server.run() File "C:\bin\.pyenv\pyenv-win\versions\3.11.6\Lib\site-packages\uvicorn\server.py", line 62, in run return asyncio.run(self.serve(sockets=sockets)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\bin\.pyenv\pyenv-win\versions\3.11.6\Lib\asyncio\runners.py", line 190, in run return runner.run(main) ^^^^^^^^^^^^^^^^ File "C:\bin\.pyenv\pyenv-win\versions\3.11.6\Lib\asyncio\runners.py", line 118, in run return self._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\bin\.pyenv\pyenv-win\versions\3.11.6\Lib\asyncio\base_events.py", line 653, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "C:\bin\.pyenv\pyenv-win\versions\3.11.6\Lib\site-packages\uvicorn\server.py", line 69, in serve config.load() File "C:\bin\.pyenv\pyenv-win\versions\3.11.6\Lib\site-packages\uvicorn\config.py", line 458, in load self.loaded_app = import_from_string(self.app) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\bin\.pyenv\pyenv-win\versions\3.11.6\Lib\site-packages\uvicorn\importer.py", line 24, in import_from_string raise exc from None File "C:\bin\.pyenv\pyenv-win\versions\3.11.6\Lib\site-packages\uvicorn\importer.py", line 21, in import_from_string module = importlib.import_module(module_str) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\bin\.pyenv\pyenv-win\versions\3.11.6\Lib\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 1147, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 690, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 940, in exec_module File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed File "Y:\open-webui\backend\main.py", line 17, in <module> from apps.rag.main import app as rag_app File "Y:\open-webui\backend\apps\rag\main.py", line 19, in <module> from langchain_community.document_loaders import ( File "C:\bin\.pyenv\pyenv-win\versions\3.11.6\Lib\site-packages\langchain_community\document_loaders\__init__.py", line 163, in <module> from langchain_community.document_loaders.pebblo import PebbloSafeLoader File "C:\bin\.pyenv\pyenv-win\versions\3.11.6\Lib\site-packages\langchain_community\document_loaders\pebblo.py", line 5, in <module> import pwd ModuleNotFoundError: No module named 'pwd' ``` ## Additional Information I found solution on langchain issue page https://github.com/langchain-ai/langchain/issues/17514#issuecomment-1949073290 I change `requirements.txt` with pwdless version, and it just work. I didn't test it properly maybe it has some issue.
Author
Owner

@jannikstdl commented on GitHub (Feb 19, 2024):

This seems to be a problem with langchain. Either we wait until it gets fixed (in the issue the next release was mentioned) or we set the langchain package to a specific version which will work (langchain==0.1.6 langchain-community==0.0.19 langchain-core==0.1.23.) I think we should wait since start_windows is still in the making.. @tjbck what do you think?

For now you can run start.sh in WSL for Windows. Or pip unistall langchain langchain-community and pip install langchain==0.1.6 langchain-community==0.0.19 on your machine.

@jannikstdl commented on GitHub (Feb 19, 2024): This seems to be a problem with langchain. Either we wait until it gets fixed (in the issue the next release was mentioned) or we set the langchain package to a specific version which will work (`langchain==0.1.6 langchain-community==0.0.19 langchain-core==0.1.23.`) I think we should wait since `start_windows `is still in the making.. @tjbck what do you think? For now you can run start.sh in WSL for Windows. Or `pip unistall langchain langchain-community` and `pip install langchain==0.1.6 langchain-community==0.0.19` on your machine.
Author
Owner

@tjbck commented on GitHub (Feb 19, 2024):

I believe it's best if we wait until langchain team sort this out, like @jannikstdl mentioned start_windows.bat is WIP at the moment. I'll keep this issue open and be monitoring this issue closely.

@tjbck commented on GitHub (Feb 19, 2024): I believe it's best if we wait until langchain team sort this out, like @jannikstdl mentioned `start_windows.bat` is WIP at the moment. I'll keep this issue open and be monitoring this issue closely.
Author
Owner

@jannikstdl commented on GitHub (Feb 23, 2024):

@babico this should be fixed https://github.com/langchain-ai/langchain/pull/17532 , can you try this again and give feedback?

Before run pip install --upgrade langchain langchain-community on your machine / virtual env.

@jannikstdl commented on GitHub (Feb 23, 2024): @babico this should be fixed [https://github.com/langchain-ai/langchain/pull/17532](PR) , can you try this again and give feedback? Before run `pip install --upgrade langchain langchain-community` on your machine / virtual env.
Author
Owner

@babico commented on GitHub (Feb 23, 2024):

@babico this should be fixed https://github.com/langchain-ai/langchain/pull/17532 , can you try this again and give feedback?

Before run pip install --upgrade langchain langchain-community on your machine / virtual env.

Yes, installing the new version fixed the problem. It worked directly without any problem.

@babico commented on GitHub (Feb 23, 2024): > @babico this should be fixed [https://github.com/langchain-ai/langchain/pull/17532](PR) , can you try this again and give feedback? > > Before run `pip install --upgrade langchain langchain-community` on your machine / virtual env. Yes, installing the new version fixed the problem. It worked directly without any problem.
Author
Owner

@tjbck commented on GitHub (Feb 24, 2024):

Thanks for the confirmation, I'll close this issue!

@tjbck commented on GitHub (Feb 24, 2024): Thanks for the confirmation, I'll close this issue!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#316