chatgpt-retrieval-plugin icon indicating copy to clipboard operation
chatgpt-retrieval-plugin copied to clipboard

python process_jsonl.py -h throws ModuleNotFoundError: No module named 'models' Exception

Open iori0758 opened this issue 3 years ago • 2 comments

Hi,I'm new to python I want process my jsonl data,when I run python process_jsonl.py -h,it throws "ModuleNotFoundError: No module named 'models' "Exception image Could you please advise some tips where I am wrong

iori0758 avatar Mar 26 '23 03:03 iori0758

Make sure to follow the instructions in the main README to create and activate a virtual environment :) https://github.com/openai/chatgpt-retrieval-plugin#quickstart

isafulf avatar Mar 26 '23 03:03 isafulf

@isafulf yes,I did follow the instructions,and it doesn't show error jerome$ pip install poetry Requirement already satisfied: poetry in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (1.4.1) Requirement already satisfied: urllib3<2.0.0,>=1.26.0 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from poetry) (1.26.15) Requirement already satisfied: pyproject-hooks<2.0.0,>=1.0.0 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from poetry) (1.0.0) Requirement already satisfied: cachecontrol[filecache]<0.13.0,>=0.12.9 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from poetry) (0.12.11) Requirement already satisfied: build<0.11.0,>=0.10.0 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from poetry) (0.10.0) Requirement already satisfied: installer<0.8.0,>=0.7.0 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from poetry) (0.7.0) Requirement already satisfied: lockfile<0.13.0,>=0.12.2 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from poetry) (0.12.2) Requirement already satisfied: packaging>=20.4 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from poetry) (23.0) Requirement already satisfied: pexpect<5.0.0,>=4.7.0 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from poetry) (4.8.0) Requirement already satisfied: keyring<24.0.0,>=23.9.0 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from poetry) (23.13.1) Requirement already satisfied: trove-classifiers>=2022.5.19 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from poetry) (2023.3.9) Requirement already satisfied: poetry-core==1.5.2 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from poetry) (1.5.2) Requirement already satisfied: xattr<0.11.0,>=0.10.0 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from poetry) (0.10.1) Requirement already satisfied: pkginfo<2.0.0,>=1.9.4 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from poetry) (1.9.6) Requirement already satisfied: tomli<3.0.0,>=2.0.1 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from poetry) (2.0.1) Requirement already satisfied: jsonschema<5.0.0,>=4.10.0 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from poetry) (4.17.3) Requirement already satisfied: crashtest<0.5.0,>=0.4.1 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from poetry) (0.4.1) Requirement already satisfied: filelock<4.0.0,>=3.8.0 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from poetry) (3.10.4) Requirement already satisfied: html5lib<2.0,>=1.0 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from poetry) (1.1) Requirement already satisfied: virtualenv!=20.4.5,!=20.4.6,<21.0.0,>=20.4.3 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from poetry) (20.21.0) Requirement already satisfied: requests<3.0,>=2.18 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from poetry) (2.28.2) Requirement already satisfied: poetry-plugin-export<2.0.0,>=1.3.0 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from poetry) (1.3.0) Requirement already satisfied: tomlkit!=0.11.2,!=0.11.3,<1.0.0,>=0.11.1 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from poetry) (0.11.6) Requirement already satisfied: cleo<3.0.0,>=2.0.0 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from poetry) (2.0.1) Requirement already satisfied: platformdirs<3.0.0,>=2.5.2 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from poetry) (2.6.2) Requirement already satisfied: requests-toolbelt<0.11.0,>=0.9.1 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from poetry) (0.10.1) Requirement already satisfied: shellingham<2.0,>=1.5 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from poetry) (1.5.0.post1) Requirement already satisfied: dulwich<0.22.0,>=0.21.2 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from poetry) (0.21.3) Requirement already satisfied: msgpack>=0.5.2 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from cachecontrol[filecache]<0.13.0,>=0.12.9->poetry) (1.0.5) Requirement already satisfied: rapidfuzz<3.0.0,>=2.2.0 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from cleo<3.0.0,>=2.0.0->poetry) (2.13.7) Requirement already satisfied: six>=1.9 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from html5lib<2.0,>=1.0->poetry) (1.16.0) Requirement already satisfied: webencodings in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from html5lib<2.0,>=1.0->poetry) (0.5.1) Requirement already satisfied: attrs>=17.4.0 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from jsonschema<5.0.0,>=4.10.0->poetry) (22.2.0) Requirement already satisfied: pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from jsonschema<5.0.0,>=4.10.0->poetry) (0.19.3) Requirement already satisfied: jaraco.classes in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from keyring<24.0.0,>=23.9.0->poetry) (3.2.3) Requirement already satisfied: importlib-metadata>=4.11.4 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from keyring<24.0.0,>=23.9.0->poetry) (6.1.0) Requirement already satisfied: ptyprocess>=0.5 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from pexpect<5.0.0,>=4.7.0->poetry) (0.7.0) Requirement already satisfied: charset-normalizer<4,>=2 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from requests<3.0,>=2.18->poetry) (3.1.0) Requirement already satisfied: certifi>=2017.4.17 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from requests<3.0,>=2.18->poetry) (2022.12.7) Requirement already satisfied: idna<4,>=2.5 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from requests<3.0,>=2.18->poetry) (3.4) Requirement already satisfied: distlib<1,>=0.3.6 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from virtualenv!=20.4.5,!=20.4.6,<21.0.0,>=20.4.3->poetry) (0.3.6) Requirement already satisfied: cffi>=1.0 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from xattr<0.11.0,>=0.10.0->poetry) (1.15.1) Requirement already satisfied: pycparser in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from cffi>=1.0->xattr<0.11.0,>=0.10.0->poetry) (2.21) Requirement already satisfied: zipp>=0.5 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from importlib-metadata>=4.11.4->keyring<24.0.0,>=23.9.0->poetry) (3.15.0) Requirement already satisfied: more-itertools in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from jaraco.classes->keyring<24.0.0,>=23.9.0->poetry) (9.1.0) Jeromes-MBP:chatgpt-retrieval-plugin jerome$ poetry env use python3.10 Using virtualenv: /Users/jerome/Library/Caches/pypoetry/virtualenvs/chatgpt-retrieval-plugin-QoXEv2bZ-py3.10 Jeromes-MBP:chatgpt-retrieval-plugin jerome$ poetry shell Spawning shell within /Users/jerome/Library/Caches/pypoetry/virtualenvs/chatgpt-retrieval-plugin-QoXEv2bZ-py3.10 bash-3.2$ . /Users/jerome/Library/Caches/pypoetry/virtualenvs/chatgpt-retrieval-plugin-QoXEv2bZ-py3.10/bin/activate (chatgpt-retrieval-plugin-py3.10) bash-3.2$ poetry install Installing dependencies from lock file

No dependencies to install or update

Installing the current project: chatgpt-retrieval-plugin (0.1.0) (chatgpt-retrieval-plugin-py3.10) bash-3.2$ poetry run start

INFO: Will watch for changes in these directories: ['/Users/jerome/chatgpt-workspace/chatgpt-retrieval-plugin'] INFO: Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit) INFO: Started reloader process [8487] using StatReload INFO: Started server process [8492] INFO: Waiting for application startup. INFO: Application startup complete.

but I do the follow commands ,it throws the exception jerome$ python process_jsonl.py -h Traceback (most recent call last): File "/Users/jerome/chatgpt-workspace/chatgpt-retrieval-plugin/scripts/process_jsonl/process_jsonl.py", line 6, in from models.models import Document, DocumentMetadata, Source ModuleNotFoundError: No module named 'models'

iori0758 avatar Mar 26 '23 08:03 iori0758

Based on your prompt, I would say you are not in a virtual environment. Find where your virtual environment is poetry env info --path and activate it.

CyberAmyntas avatar Mar 28 '23 07:03 CyberAmyntas

@iori0758 Did you resolve this? I also have the same issue and verified I had activated my virtual environment. D

mcheung610 avatar May 17 '23 23:05 mcheung610