Skip to content
This repository has been archived by the owner on Feb 21, 2025. It is now read-only.

Modulenotfounderror #72

Open
marcionegrao opened this issue Jan 14, 2024 · 10 comments
Open

Modulenotfounderror #72

marcionegrao opened this issue Jan 14, 2024 · 10 comments

Comments

@marcionegrao
Copy link

Hello, I keep getting the following error when running main.py. I forked the app and followed the instructions to install it. I apologize if this is a trivial issue that I shouldn't be posting here.

2024-01-14 10:26:33.229 Uncaught app exception
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 534, in _run_script
exec(code, module.dict)
File "/Users/marcionegrao/knowledge_gpt/knowledge_gpt/main.py", line 3, in
from knowledge_gpt.components.sidebar import sidebar
ModuleNotFoundError: No module named 'knowledge_gpt'

@mmz-001
Copy link
Owner

mmz-001 commented Jan 14, 2024

Hmm looks like the project itself (root) isn't installed. Did you use poetry with the virtual environment?

@marcionegrao
Copy link
Author

Yes, I used poetry sand created a virtual environ in the root folder Knowledge_gpt:
(knowledge-gpt-py3.10) marcionegrao@Marcios-MacBook-Air knowledge_gpt % streamlit run main.py

The command to install poetry as listed in the readme didn't work. I used pip install following instructions from Poetry site

@mmz-001
Copy link
Owner

mmz-001 commented Jan 16, 2024

Can you give me the output of pip freeze while in the virtual environment so I can take a look?

@jiyegege
Copy link

jiyegege commented Feb 3, 2024

I had the same problem, maybe you can try python -m streamlit run main.py to give it a try!If you are using pycharm, you can also configure it like I did:
image

@MrLei
Copy link

MrLei commented Mar 26, 2024

I installed everything according to the instructions and the first run shows the same error.
System Win10 Pyth 3.11.8
This is my pip freeze in knowledge_gpt dir:
build==1.1.1
CacheControl==0.14.0
certifi==2024.2.2
charset-normalizer==3.3.2
cleo==2.1.0
colorama==0.4.6
crashtest==0.4.1
distlib==0.3.8
dulwich==0.21.7
fastjsonschema==2.19.1
filelock==3.13.3
idna==3.6
importlib_metadata==7.1.0
install==1.3.5
installer==0.7.0
jaraco.classes==3.3.1
keyring==24.3.1
more-itertools==10.2.0
msgpack==1.0.8
packaging==24.0
pexpect==4.9.0
pkginfo==1.10.0
platformdirs==4.2.0
poetry==1.8.2
poetry-core==1.9.0
poetry-plugin-export==1.7.1
ptyprocess==0.7.0
pyproject_hooks==1.0.0
pywin32-ctypes==0.2.2
rapidfuzz==3.7.0
requests==2.31.0
requests-toolbelt==1.0.0
shell==1.0.1
shellingham==1.5.4
tomlkit==0.12.4
trove-classifiers==2024.3.25
urllib3==2.2.1
virtualenv==20.25.1
zipp==3.18.1

@mmz-001
Copy link
Owner

mmz-001 commented Mar 28, 2024

@MrLei After running activating the virtual environment and running pip freeze the output should look like this:

aiohttp==3.8.5
aiosignal==1.3.1
altair==5.0.1
asttokens==2.2.1
async-timeout==4.0.2
attrs==23.1.0
backcall==0.2.0
black==23.7.0
blinker==1.6.2
cachetools==5.3.1
certifi==2023.7.22
charset-normalizer==3.2.0
click==8.1.6
cohere==3.10.0
colorama==0.4.6
comm==0.1.3
dataclasses-json==0.5.9
debugpy==1.6.7
decorator==5.1.1
docx2txt==0.8
exceptiongroup==1.1.2
executing==1.2.0
faiss-cpu==1.7.4
filelock==3.12.3
flake8==6.0.0
frozenlist==1.4.0
fsspec==2023.9.0
gitdb==4.0.10
GitPython==3.1.32
greenlet==2.0.2
huggingface-hub==0.16.4
idna==3.4
importlib-metadata==6.8.0
iniconfig==2.0.0
ipykernel==6.25.1
ipython==8.14.0
ipywidgets==8.0.7
isort==5.12.0
jedi==0.18.2
Jinja2==3.1.2
jsonschema==4.18.4
jsonschema-specifications==2023.7.1
jupyter_client==8.3.0
jupyter_core==5.3.1
jupyterlab-widgets==3.0.8
-e git+https://github.com/mmz-001/knowledge_gpt@6002862f69489a81f1bc39d0eb265a6960362f48#egg=knowledge_gpt
langchain==0.0.220
langchainplus-sdk==0.0.20
markdown-it-py==3.0.0
MarkupSafe==2.1.3
marshmallow==3.20.1
marshmallow-enum==1.5.1
matplotlib-inline==0.1.6
mccabe==0.7.0
mdurl==0.1.2
multidict==6.0.4
mypy-extensions==1.0.0
nest-asyncio==1.5.6
numexpr==2.8.4
numpy==1.25.1
openai==0.27.8
openapi-schema-pydantic==1.2.4
packaging==23.1
pandas==2.0.3
parso==0.8.3
pathspec==0.11.1
pickleshare==0.7.5
Pillow==9.5.0
platformdirs==3.9.1
pluggy==1.2.0
prompt-toolkit==3.0.39
protobuf==4.23.4
psutil==5.9.5
pure-eval==0.2.2
pyarrow==12.0.1
pycodestyle==2.10.0
pycryptodome==3.18.0
pydantic==1.10.11
pydeck==0.8.0
pyflakes==3.0.1
Pygments==2.15.1
Pympler==1.0.1
PyMuPDF==1.22.5
pytest==7.4.0
python-dateutil==2.8.2
python-dotenv==0.21.1
pytz==2023.3
pytz-deprecation-shim==0.1.0.post0
pywin32==306
PyYAML==6.0.1
pyzmq==25.1.0
referencing==0.30.0
regex==2023.6.3
requests==2.31.0
rich==13.4.2
rpds-py==0.9.2
safetensors==0.3.3
six==1.16.0
smmap==5.0.0
SQLAlchemy==2.0.19
stack-data==0.6.2
streamlit==1.25.0
tenacity==8.2.2
tiktoken==0.4.0
tokenizers==0.13.3
toml==0.10.2
tomli==2.0.1
toolz==0.12.0
tornado==6.3.2
tqdm==4.65.0
traitlets==5.9.0
transformers==4.33.1
typing-inspect==0.9.0
typing_extensions==4.7.1
tzdata==2023.3
tzlocal==4.3.1
urllib3==1.26.16
validators==0.20.0
watchdog==3.0.0
wcwidth==0.2.6
widgetsnbextension==4.0.8
yarl==1.9.2
zipp==3.16.2

@mmz-001
Copy link
Owner

mmz-001 commented Mar 28, 2024

@MrLei @marcionegrao can you show the exact steps including the console logs of how you're running this so I can look into the issue?

@MrLei
Copy link

MrLei commented Apr 4, 2024

The actual error was that not all libraries were loaded.
After uploading, everything started working properly.

This is solusion pip install -r requirements.txt

@VladiBTR
Copy link

VladiBTR commented Oct 7, 2024

Having the same error and when doing pip install -r requirements.txt it downloads to some point and then gives this error:

ERROR: Exception:
Traceback (most recent call last):
File "C:\knowledge_gpt.venv\Lib\site-packages\pip_internal\cli\base_command.py", line 105, in _run_wrapper
status = _inner_run()
^^^^^^^^^^^^
File "C:\knowledge_gpt.venv\Lib\site-packages\pip_internal\cli\base_command.py", line 96, in _inner_run
return self.run(options, args)
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\knowledge_gpt.venv\Lib\site-packages\pip_internal\cli\req_command.py", line 67, in wrapper
return func(self, options, args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\knowledge_gpt.venv\Lib\site-packages\pip_internal\commands\install.py", line 379, in run
requirement_set = resolver.resolve(
^^^^^^^^^^^^^^^^^
File "C:\knowledge_gpt.venv\Lib\site-packages\pip_internal\resolution\resolvelib\resolver.py", line 95, in resolve
result = self._result = resolver.resolve(
^^^^^^^^^^^^^^^^^
File "C:\knowledge_gpt.venv\Lib\site-packages\pip_vendor\resolvelib\resolvers.py", line 546, in resolve
state = resolution.resolve(requirements, max_rounds=max_rounds)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\knowledge_gpt.venv\Lib\site-packages\pip_vendor\resolvelib\resolvers.py", line 397, in resolve
self._add_to_criteria(self.state.criteria, r, parent=None)
File "C:\knowledge_gpt.venv\Lib\site-packages\pip_vendor\resolvelib\resolvers.py", line 173, in _add_to_criteria
if not criterion.candidates:
^^^^^^^^^^^^^^^^^^^^
File "C:\knowledge_gpt.venv\Lib\site-packages\pip_vendor\resolvelib\structs.py", line 156, in bool
return bool(self._sequence)
^^^^^^^^^^^^^^^^^^^^
File "C:\knowledge_gpt.venv\Lib\site-packages\pip_internal\resolution\resolvelib\found_candidates.py", line 174, in bool
return any(self)
^^^^^^^^^
File "C:\knowledge_gpt.venv\Lib\site-packages\pip_internal\resolution\resolvelib\found_candidates.py", line 162, in
return (c for c in iterator if id(c) not in self._incompatible_ids)
^^^^^^^^
File "C:\knowledge_gpt.venv\Lib\site-packages\pip_internal\resolution\resolvelib\found_candidates.py", line 53, in _iter_built
candidate = func()
^^^^^^
File "C:\knowledge_gpt.venv\Lib\site-packages\pip_internal\resolution\resolvelib\factory.py", line 186, in _make_candidate_from_link
base: Optional[BaseCandidate] = self._make_base_candidate_from_link(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\knowledge_gpt.venv\Lib\site-packages\pip_internal\resolution\resolvelib\factory.py", line 232, in _make_base_candidate_from_link
self._link_candidate_cache[link] = LinkCandidate(
^^^^^^^^^^^^^^
File "C:\knowledge_gpt.venv\Lib\site-packages\pip_internal\resolution\resolvelib\candidates.py", line 303, in init
super().init(
File "C:\knowledge_gpt.venv\Lib\site-packages\pip_internal\resolution\resolvelib\candidates.py", line 158, in init
self.dist = self._prepare()
^^^^^^^^^^^^^^^
File "C:\knowledge_gpt.venv\Lib\site-packages\pip_internal\resolution\resolvelib\candidates.py", line 235, in _prepare
dist = self._prepare_distribution()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\knowledge_gpt.venv\Lib\site-packages\pip_internal\resolution\resolvelib\candidates.py", line 314, in _prepare_distribution
return preparer.prepare_linked_requirement(self._ireq, parallel_builds=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\knowledge_gpt.venv\Lib\site-packages\pip_internal\operations\prepare.py", line 527, in prepare_linked_requirement
return self._prepare_linked_requirement(req, parallel_builds)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\knowledge_gpt.venv\Lib\site-packages\pip_internal\operations\prepare.py", line 642, in _prepare_linked_requirement
dist = _get_prepared_distribution(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\knowledge_gpt.venv\Lib\site-packages\pip_internal\operations\prepare.py", line 72, in _get_prepared_distribution
abstract_dist.prepare_distribution_metadata(
File "C:\knowledge_gpt.venv\Lib\site-packages\pip_internal\distributions\sdist.py", line 56, in prepare_distribution_metadata
self._install_build_reqs(finder)
File "C:\knowledge_gpt.venv\Lib\site-packages\pip_internal\distributions\sdist.py", line 126, in _install_build_reqs
build_reqs = self._get_build_requires_wheel()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\knowledge_gpt.venv\Lib\site-packages\pip_internal\distributions\sdist.py", line 103, in _get_build_requires_wheel
return backend.get_requires_for_build_wheel()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\knowledge_gpt.venv\Lib\site-packages\pip_internal\utils\misc.py", line 706, in get_requires_for_build_wheel
return super().get_requires_for_build_wheel(config_settings=cs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\knowledge_gpt.venv\Lib\site-packages\pip_vendor\pyproject_hooks_impl.py", line 166, in get_requires_for_build_wheel
return self._call_hook('get_requires_for_build_wheel', {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\knowledge_gpt.venv\Lib\site-packages\pip_vendor\pyproject_hooks_impl.py", line 321, in _call_hook
raise BackendUnavailable(data.get('traceback', ''))
pip._vendor.pyproject_hooks._impl.BackendUnavailable: Traceback (most recent call last):
File "C:\knowledge_gpt.venv\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 77, in build_backend
obj = import_module(mod_path)
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Vladi\AppData\Local\Programs\Python\Python312\Lib\importlib_init
.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1387, in _gcd_import
File "", line 1360, in _find_and_load
File "", line 1310, in _find_and_load_unlocked
File "", line 488, in _call_with_frames_removed
File "", line 1387, in _gcd_import
File "", line 1360, in _find_and_load
File "", line 1331, in _find_and_load_unlocked
File "", line 935, in _load_unlocked
File "", line 995, in exec_module
File "", line 488, in call_with_frames_removed
File "C:\Users\Vladi\AppData\Local\Temp\pip-build-env-8oxg4b7x\overlay\Lib\site-packages\setuptools_init
.py", line 10, in
import distutils.core
ModuleNotFoundError: No module named 'distutils'

@probe365
Copy link

probe365 commented Nov 1, 2024

Hi!
I'm having the same error message related above. When I access localhost appears the following error message:

aThe Daily Fill - Evernote.pdf

Could you, please, help me on this error?
Many thanks,
Paulo

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants