MetaGPT
MetaGPT copied to clipboard
ModuleNotFoundError: No module named 'pwd'
Bug description When I ran the examples\write_tutorial.py file, there is an error happening in the document.py
from langchain_community.document_loaders.pebblo import PebbloSafeLoader import pwd ModuleNotFoundError: No module named 'pwd'
Bug solved method The bug was in the langchain library v0.0.352 and that was solved in v0.1.8 so i changed the requirements.txt langchain == 0.0.352 --> langchain == 0.1.8
Environment information
- LLM type and model name: OpenAI and gpt-3.5-turbo-1106
- System version: Windows 11
- Python version: conda python 3.9.18
Screenshots or logs
File "C:\Users\itsab\anaconda3\envs\metagpt\lib\site-packages\langchain_community\document_loaders\__init__.py", line 163, in <module>
from langchain_community.document_loaders.pebblo import PebbloSafeLoader
File "C:\Users\itsab\anaconda3\envs\metagpt\lib\site-packages\langchain_community\document_loaders\pebblo.py", line 5, in <module>
import pwd
ModuleNotFoundError: No module named 'pwd'
I have related problem. Since MetaGPT relies on langchain == 0.0.352, it is unable to solve dependencies using piptool, when I ask for langchain == 0.1.x and metagpt == 0.7.x at the same time.
pwd
is a builtin module only available in Linux, and the older versions of Langchain did not take this into account and thus lead to error in Windows.
Hi @linzeyang @Abhishek0075 , I'm using windows too, and just trying the example from the quickstart tutorial it throws the same error.
The version is metagpt==0.7.6
.
The environment version is the same:
- LLM type and model name: OpenAI and gpt-3.5-turbo-1106
- System version: Windows 11
- Python version: conda python 3.9.18
Code:
# imports
import asyncio
from metagpt.roles import (
Architect,
Engineer,
ProductManager,
ProjectManager,
)
from metagpt.team import Team
Output:
ModuleNotFoundError Traceback (most recent call last)
Cell In[9], [line 3]
[1] # imports
[2 import asyncio
----> [3]from metagpt.roles import (
[4] Architect,
[5] Engineer,
[6] ProductManager,
[7] ProjectManager,
[8] )
[9] from metagpt.team import Team
....
ModuleNotFoundError: No module named 'pwd'
Can i know what the version of langchain is in your environment?
Yes, on version 0.0.352
langchain==0.0.352
langchain-community==0.0.20
langchain-core==0.1.23
Yes, on version 0.0.352
langchain==0.0.352 langchain-community==0.0.20 langchain-core==0.1.23
Change the version of the langchain to 0.1.8
Hi, thanks for the fast reply! If I update langchain to 0.1.8, I got conflicts with metagpt (v0.7.6):
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
metagpt 0.7.6 requires aiohttp==3.8.4, but you have aiohttp 3.9.3 which is incompatible.
metagpt 0.7.6 requires langchain==0.0.352, but you have langchain 0.1.8 which is incompatible.
metagpt 0.7.6 requires numpy<1.25.0,>=1.24.3, but you have numpy 1.26.4 which is incompatible.
metagpt 0.7.6 requires pydantic==2.5.3, but you have pydantic 2.6.4 which is incompatible.
metagpt 0.7.6 requires tenacity==8.2.2, but you have tenacity 8.2.3 which is incompatible.
metagpt 0.7.6 requires typing-extensions==4.9.0, but you have typing-extensions 4.10.0 which is incompatible.
metagpt 0.7.6 requires typing-inspect==0.8.0, but you have typing-inspect 0.9.0 which is incompatible.
qdrant-client 1.7.0 requires urllib3<2.0.0,>=1.26.14, but you have urllib3 2.2.1 which is incompatible.
i think you should run the command pip install -e .
Just run this command and run the example again
okay, thanks! I'll try it then 👍
Hi @Abhishek0075 it worked, thank you!
I solved it using pip install git+https://github.com/geekan/MetaGPT
, that is by installing latest dev version but this one started giving new error:
Exception ignored in: <function Popen.__del__ at 0x0000020FF4F48C20>
Traceback (most recent call last):
File "C:\Users\Sarfraz\miniconda3\Lib\subprocess.py", line 1130, in __del__
self._internal_poll(_deadstate=_maxsize)
File "C:\Users\Sarfraz\miniconda3\Lib\subprocess.py", line 1575, in _internal_poll
if _WaitForSingleObject(self._handle, 0) == _WAIT_OBJECT_0:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [WinError 6] The handle is invalid
I solved it using
pip install git+https://github.com/geekan/MetaGPT
, that is by installing latest dev version but this one started giving new error:Exception ignored in: <function Popen.__del__ at 0x0000020FF4F48C20> Traceback (most recent call last): File "C:\Users\Sarfraz\miniconda3\Lib\subprocess.py", line 1130, in __del__ self._internal_poll(_deadstate=_maxsize) File "C:\Users\Sarfraz\miniconda3\Lib\subprocess.py", line 1575, in _internal_poll if _WaitForSingleObject(self._handle, 0) == _WAIT_OBJECT_0: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ OSError: [WinError 6] The handle is invalid
can you give me more details and unable to understand what the cause of the error is
We have removed the dependency on langchain in the main branch.
So if anyone encounters a problem, please post it again.
Theoretically, the pwd
problem will no longer occur.