paper-qa
paper-qa copied to clipboard
Issue with Installation
Thanks for making this tool! Macbook M2 (Sonoma 14.6.1) I ran the following install command:
pip install paper-qa --break-system-packages
Appears everything installed correctly
Installing collected packages: zipp, urllib3, typing-extensions, tqdm, tenacity, tantivy, sniffio, six, setuptools, rpds-py, regex, PyYAML, python-dotenv, PyMuPDFb, pygments, packaging, numpy, multidict, mdurl, MarkupSafe, latexcodec, jiter, idna, html2text, h11, fsspec, frozenlist, filelock, docstring-parser, distro, click, charset-normalizer, certifi, attrs, annotated-types, aiohappyeyeballs, yarl, requests, referencing, PyMuPDF, pydantic-core, pybtex, markdown-it-py, jinja2, importlib-metadata, httpcore, anyio, aiosignal, tiktoken, rich, pydantic, jsonschema-specifications, huggingface-hub, httpx, aiohttp, tokenizers, pydantic-settings, openai, jsonschema, fhaviary, litellm, paper-qa
Successfully installed MarkupSafe-2.1.5 PyMuPDF-1.24.10 PyMuPDFb-1.24.10 PyYAML-6.0.2 aiohappyeyeballs-2.4.0 aiohttp-3.10.5 aiosignal-1.3.1 annotated-types-0.7.0 anyio-4.5.0 attrs-24.2.0 certifi-2024.8.30 charset-normalizer-3.3.2 click-8.1.7 distro-1.9.0 docstring-parser-0.16 fhaviary-0.6.1 filelock-3.16.1 frozenlist-1.4.1 fsspec-2024.9.0 h11-0.14.0 html2text-2024.2.26 httpcore-1.0.5 httpx-0.27.2 huggingface-hub-0.25.0 idna-3.10 importlib-metadata-8.5.0 jinja2-3.1.4 jiter-0.5.0 jsonschema-4.23.0 jsonschema-specifications-2023.12.1 latexcodec-3.0.0 litellm-1.46.6 markdown-it-py-3.0.0 mdurl-0.1.2 multidict-6.1.0 numpy-2.1.1 openai-1.46.1 packaging-24.1 paper-qa-5.0.6 pybtex-0.24.0 pydantic-2.9.2 pydantic-core-2.23.4 pydantic-settings-2.5.2 pygments-2.18.0 python-dotenv-1.0.1 referencing-0.35.1 regex-2024.9.11 requests-2.32.3 rich-13.8.1 rpds-py-0.20.0 setuptools-75.1.0 six-1.16.0 sniffio-1.3.1 tantivy-0.22.0 tenacity-9.0.0 tiktoken-0.7.0 tokenizers-0.20.0 tqdm-4.66.5 typing-extensions-4.12.2 urllib3-2.2.3 yarl-1.11.1 zipp-3.20.2
I then cd'ed to my papers folder and ran
pqa ask 'How much methotrexate was added?'
and received the following error:
/opt/homebrew/opt/[email protected]/bin/python3.12: No module named paperqa.__main__; 'paperqa' is a package and cannot be directly executed
Any and all help appreciated. Would love to get this tool up and running!
Hey @GrahamSErwin! I'm here to help you with any bugs, questions, or to become a contributor. Let's squash those bugs together! 🤖
To resolve the error "No module named paperqa.main; 'paperqa' is a package and cannot be directly executed" when running pqa ask 'How much methotrexate was added?', you should use the paperqa command instead of pqa. The correct command to run would be:
python -m paperqa ask 'How much methotrexate was added?'
This command ensures that the main function in the paperqa package is executed correctly [1].
To continue talking to Dosu, mention @dosu.
Thanks, I did try that!
python -m paperqa ask 'How much methotrexate was added?'
/opt/homebrew/opt/[email protected]/bin/python3.12: No module named paperqa.__main__; 'paperqa' is a package and cannot be directly executed
Hi @GrahamSErwin thanks for the issue. It seems to be an install issue. Can you run /opt/homebrew/opt/[email protected]/bin/python3.12 -m pip list and share the output?
I am thinking somehow the pip you used to install comes from a different Python
Yeah that makes sense. I do see paperqa amongst the list of packages, after running that command:
Package Version
aiohappyeyeballs 2.4.0 aiohttp 3.10.5 aiosignal 1.3.1 annotated-types 0.7.0 anyio 4.5.0 attrs 24.2.0 build 1.2.2 certifi 2024.8.30 charset-normalizer 3.3.2 click 8.1.7 distro 1.9.0 docstring_parser 0.16 fhaviary 0.6.1 filelock 3.16.1 frozenlist 1.4.1 fsspec 2024.9.0 h11 0.14.0 html2text 2024.2.26 httpcore 1.0.5 httpx 0.27.2 huggingface-hub 0.25.0 idna 3.10 importlib_metadata 8.5.0 Jinja2 3.1.4 jiter 0.5.0 jsonschema 4.23.0 jsonschema-specifications 2023.12.1 latexcodec 3.0.0 litellm 1.46.6 markdown-it-py 3.0.0 MarkupSafe 2.1.5 mdurl 0.1.2 multidict 6.1.0 numpy 2.1.1 openai 1.46.1 packaging 24.1 paper-qa 5.0.6 pip 24.2 pybtex 0.24.0 pydantic 2.9.2 pydantic_core 2.23.4 pydantic-settings 2.5.2 Pygments 2.18.0 PyMuPDF 1.24.10 PyMuPDFb 1.24.10 pyproject_hooks 1.1.0 python-dotenv 1.0.1 PyYAML 6.0.2 referencing 0.35.1 regex 2024.9.11 requests 2.32.3 rich 13.8.1 rpds-py 0.20.0 setuptools 75.1.0 six 1.16.0 sniffio 1.3.1 tantivy 0.22.0 tenacity 9.0.0 tiktoken 0.7.0 tokenizers 0.20.0 tqdm 4.66.5 typing_extensions 4.12.2 urllib3 2.2.3 wheel 0.44.0 yarl 1.11.1 zipp 3.20.2
I am not sure why you're hitting this, so we will try a few things now.
Are you on Windows, Mac, etc? If Mac, can you print your bin directory, and if on Windows can you print your Scripts directory?
Also, can you try locally cloning this repo, setting up uv, running uv sync, and then trying the same command?
Thanks James. I am running a Macbook M2 (Sonoma 14.6.1)
And apologies, I don't work in the Terminal too often. Can you tell me what command you'd like me to run to print my bin directory? I did the following, if that's what you are asking.
echo $PATH
/opt/homebrew/opt/[email protected]/libexec/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Users/user/.local/bin:/Users/user/.local/bin
Hi @GrahamSErwin , run this: python -c "import sys; print(sys.executable)", then take the output of that (minus the python at the end) and pass it to ls:
> python -c "import sys; print(sys.executable)"
/Users/user/code/paper-qa/.venv/bin/python
> ls /Users/user/code/paper-qa/.venv/bin
activate dmypy html2text isort mypyc ...........
ls /opt/homebrew/opt/[email protected]/bin/
2to3 pip3 python3 wheel3
2to3-3.12 pip3.12 python3-config wheel3.12
idle3 pydoc3 python3.12
idle3.12 pydoc3.12 python3.12-config
@GrahamSErwin so you should see pqa in your bin somewhere. That comes from https://github.com/Future-House/paper-qa/blob/v5.0.6/pyproject.toml#L66-L67
For example with me:
> ls /Users/user/code/paper-qa/.venv/bin
activate dmypy html2text ......... jsonschema normalizer pqa pyftmerge pyreverse ......... pip pybtex pylint python3 tqdm
I am thinking something about your environment or set up is not correct yet. Can you try using a Python virtual environment?
Yes will try that and report back. Thanks James.
The virtual environment solved my problem. Thanks James! Sharing what I did here in case anyone else runs into an issue with their environment.
pip install paper-qa --break-system-packages
python3 -m venv paperqa_env
source paperqa_env/bin/activate
pip install paper-qa
To make it easier to activate this environment in the future, I created an alias. Add the following line to your ~/.zshrc file:
alias activate_paperqa='cd my_papers && source paperqa_env/bin/activate'
Load the new alias:
source ~/.zshrc
Good to go!
pqa ask 'What concentrations of methotrexate were used?'
虚拟环境解决了我的问题。谢谢 James!在这里分享我所做的,以防其他人遇到他们的环境问题。
pip install paper-qa --break-system-packages python3 -m venv paperqa_env source paperqa_env/bin/activate pip install paper-qa为了便于将来激活此环境,我创建了一个别名。将以下行添加到您的 ~/.zshrc 文件中:
alias activate_paperqa='cd my_papers && source paperqa_env/bin/activate'加载新别名:
source ~/.zshrc好了!
pqa ask 'What concentrations of methotrexate were used?'
hi,Can you provide the versions of the dependency libraries required to run this project?
@FahaxikiHoney from the CONTRIBUTING.md we talk about using uv for versions. You can see the versions:
- We require: https://github.com/Future-House/paper-qa/blob/v5.0.7/pyproject.toml#L19-L36
- What CI uses: https://github.com/Future-House/paper-qa/blob/v5.0.7/uv.lock
I am going to close this one out, feel free open a new issue if there's further questions