Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependency error? #202

Open
github-0-searcher opened this issue Oct 26, 2024 · 4 comments
Open

Dependency error? #202

github-0-searcher opened this issue Oct 26, 2024 · 4 comments

Comments

@github-0-searcher
Copy link

github-0-searcher commented Oct 26, 2024

Hi just found out this repo. Nice work!

I am trying to install it in a new virtual env with

pip install -U poe-api-wrapper[proxy]

But there seems to be a dependency error with rich ...

finally i am either getting 1.3.6 of poe or just failed to import poeserver

ImportError: cannot import name 'PoeServer' from 'poe_api_wrapper'

I tried with python 3.11 and 3.9 this problem still exists.

@github-0-searcher
Copy link
Author

update: I am still getting import error even with installed old 1.3.6

@jishux2
Copy link
Contributor

jishux2 commented Oct 26, 2024

I've encountered this issue before.

The version of poe-api-wrapper doesn't really matter here since the package is imported directly from the current directory. For the ImportError you're experiencing, try installing nltk:

pip install nltk

This fixed the same issue for me.

@github-0-searcher
Copy link
Author

github-0-searcher commented Oct 28, 2024

Hi! Many thanks for your timely reply!

I am still getting this import error even with nltk installed.

To be more precise, I am with:

OS: windows 11
Python: 3.11.4 or 3.10.10

The installation problem still exists.

When tried to install with

pip install -U "poe-api-wrapper[proxy]"

instead of the up-to-date version, I finally get

Successfully installed
Faker-15.3.4
aiohappyeyeballs-2.4.3
aiohttp-3.10.10
aiohttp-proxy-0.1.2
aiosignal-1.3.1
anyio-4.6.2.post1
attrs-24.2.0
ballyregan-1.0.6
beautifulsoup4-4.12.3
bs4-0.0.1
certifi-2024.8.30
charset-normalizer-3.4.0
click-8.1.7
colorama-0.4.6
commonmark-0.9.1
frozenlist-1.4.1
h11-0.14.0
html5lib-1.1
httpcore-1.0.6
httpx-0.27.2
idna-3.10
loguru-0.6.0
lxml-4.9.4
multidict-6.1.0
numpy-2.1.2
pandas-1.5.3
poe-api-wrapper-1.3.6
prettytable-3.11.0
propcache-0.2.0
pydantic-1.10.18
pygments-2.18.0
python-dateutil-2.9.0.post0
pytz-2024.2
requests-2.32.3
requests-toolbelt-1.0.0
rich-12.6.0
shellingham-1.5.4
six-1.16.0
sniffio-1.3.1
soupsieve-2.6
strenum-0.4.15
style-1.1.0
typer-0.6.1
typing-extensions-4.12.2
update-0.0.1
urllib3-2.2.3
wcwidth-0.2.13
webencodings-0.5.1
websocket-client-1.8.0
win32-setctime-1.1.0
yarl-1.15.5

Then i have the import error

>>> from poe_api_wrapper import PoeServer
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'PoeServer' from 'poe_api_wrapper' (C:\Users\xxx\Envs\poe\Lib\site-packages\poe_api_wrapper\__init__.py)

This problem also exists in WSL Ubuntu with python 3.10.12

@jishux2
Copy link
Contributor

jishux2 commented Oct 28, 2024

Thanks for sharing this information - I think I can see where the issue lies. You're working in the Python REPL outside of the project directory. In this case, Python searches for modules in your virtual environment, where poe_api_wrapper is installed as version 1.3.6. Taking a look at its __init__.py:

from .api import PoeApi
from .example import PoeExample

As shown above, the PoeServer class isn't exported in this version.

Regarding the dependency issues you mentioned, it seems the proxy extra's requirement for ballyregan is causing some conflicts. Try installing the dependencies in this order:

pip install ballyregan
pip install -U poe-api-wrapper
pip install numpy==1.26.4  # ballyregan affects numpy version, need to revert to older version

This should get you set up with the latest version of poe-api-wrapper and all its dependencies properly configured.

Don't worry about nltk for now - you can always add it to your environment later if you run into any NLTK-related issues.

Update: I apologize for the error in my previous response. To use the server functionality, you should actually install the package with the llm extra like this: pip install -U 'poe-api-wrapper[llm]'. This is actually mentioned in the Quick Setup section of the README.md. With this correction, everything should work as expected.

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

No branches or pull requests

2 participants