AutoGPT icon indicating copy to clipboard operation
AutoGPT copied to clipboard

Dependency Conflict with Requests in googlesearch-python and tiktoken

Open yousefissa opened this issue 1 year ago • 7 comments

Issue:

There is a dependency conflict involving the requests package between googlesearch-python and other packages in the project. The googlesearch-python package has a strict dependency on a specific version of requests, which is causing the conflict. the tiktoken and googlesearch-python packages seem to be conflicting.

Using python 3.10

Details:

The conflict is caused by:

The user requested requests>=2.26.0
openai 0.27.2 depends on requests>=2.20
tiktoken 0.3.3 depends on requests>=2.26.0
docker 2.0.0 depends on requests!=2.11.0, !=2.12.2 and >=2.5.2
googlesearch-python 1.1.0 depends on requests==2.25.1
The user requested requests>=2.26.0
openai 0.27.2 depends on requests>=2.20
tiktoken 0.3.3 depends on requests>=2.26.0
docker 2.0.0 depends on requests!=2.11.0, !=2.12.2 and >=2.5.2
googlesearch-python 1.0.1 depends on requests==2.25.1
The user requested requests>=2.26.0
openai 0.27.2 depends on requests>=2.20
tiktoken 0.3.3 depends on requests>=2.26.0
docker 2.0.0 depends on requests!=2.11.0, !=2.12.2 and >=2.5.2
googlesearch-python 1.0.0 depends on requests==2.24.0

or when trying to pin specific versions:

The conflict is caused by:
    The user requested requests
    openai 0.27.2 depends on requests>=2.20
    tiktoken 0.3.3 depends on requests>=2.26.0
    googlesearch-python 1.1.0 depends on requests==2.25.1

Please let me know if there are any plans to address this issue or if you need any additional information.

yousefissa avatar Apr 03 '23 15:04 yousefissa

Yeah some version pining would be great too... I see a lot of unpinned versions

I'm getting the same error

Jdban avatar Apr 03 '23 16:04 Jdban

Duplicate of #30

The problem is not tiktoken, but googlesearch-python. I've just created a PR containing a workaround, using tomviner's PR on googlesearch which loosened its requirements

Try if this fixes your problem: https://github.com/Torantulino/Auto-GPT/pull/86

mofe23 avatar Apr 03 '23 16:04 mofe23

https://github.com/Torantulino/Auto-GPT/pull/86 this one is working well !

amauryfischer avatar Apr 03 '23 16:04 amauryfischer

Someone on Discord suggested this that worked for me: git+https://github.com/tomviner/googlesearch@loosen-requirements#googlesearch-python

simon0117 avatar Apr 03 '23 17:04 simon0117

To resolve this dependency conflict, you can try the following steps:

1)Use a virtual environment to isolate the project dependencies from other Python installations on your system.

2)Uninstall the conflicting packages that are not needed for your project.

3)Install the required versions of requests and googlesearch-python packages in your virtual environment using pip.

Here are the steps in more detail:

1)Create a virtual environment: Copy code python -m venv myenv 2)Activate the virtual environment: bash Copy code source myenv/bin/activate # on Linux or macOS myenv\Scripts\activate.bat # on Windows 3)Uninstall the conflicting packages: Copy code pip uninstall tiktoken docker 4)Install the required versions of requests and googlesearch-python packages: Copy code pip install requests==2.25.1 googlesearch-python If you still need tiktoken and docker packages, you can try installing them with the same version of requests as googlesearch-python:

Copy code pip install tiktoken docker requests==2.25.1 Alternatively, you can try updating the dependencies of the conflicting packages to use a compatible version of requests. However, this may not always be possible or practical, especially if the conflicting packages have strict dependency requirements.

AnkurSalunkhe11 avatar Apr 03 '23 17:04 AnkurSalunkhe11

To resolve this dependency conflict, you can try the following steps:

1)Use a virtual environment to isolate the project dependencies from other Python installations on your system.

2)Uninstall the conflicting packages that are not needed for your project.

3)Install the required versions of requests and googlesearch-python packages in your virtual environment using pip.

Here are the steps in more detail:

1)Create a virtual environment: Copy code python -m venv myenv 2)Activate the virtual environment: bash Copy code source myenv/bin/activate # on Linux or macOS myenv\Scripts\activate.bat # on Windows 3)Uninstall the conflicting packages: Copy code pip uninstall tiktoken docker 4)Install the required versions of requests and googlesearch-python packages: Copy code pip install requests==2.25.1 googlesearch-python If you still need tiktoken and docker packages, you can try installing them with the same version of requests as googlesearch-python:

Copy code pip install tiktoken docker requests==2.25.1 Alternatively, you can try updating the dependencies of the conflicting packages to use a compatible version of requests. However, this may not always be possible or practical, especially if the conflicting packages have strict dependency requirements.

Still Getting the following error on Mac

Collecting requests==2.25.1 Using cached requests-2.25.1-py2.py3-none-any.whl (61 kB) Collecting googlesearch-python Using cached googlesearch-python-1.2.0.tar.gz (7.4 kB) Preparing metadata (setup.py) ... error error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> [6 lines of output] Traceback (most recent call last): File "", line 2, in File "", line 34, in File "/private/var/folders/0x/1gmts4910vs5kjmbz0shlj3h0000gn/T/pip-install-gcq2yqik/googlesearch-python_1e337451113649e48921cb002ccd8c43/setup.py", line 6, in with open("requirements.txt") as fh: FileNotFoundError: [Errno 2] No such file or directory: 'requirements.txt' [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. error: metadata-generation-failed

× Encountered error while generating package metadata. ╰─> See above for output.

note: This is an issue with the package mentioned above, not pip. hint: See above for details.

aodrasa avatar Apr 04 '23 02:04 aodrasa

Currently, the latest master branch no longer has this problem. git pull or re git clone the repo and pip install --user -r requirements.txt.

Qoyyuum avatar Apr 15 '23 13:04 Qoyyuum

To pin or not to pin Still not sure what's best here I'm going with: only pin when we need to We're now using poetry which should sort this out for us.

p-i- avatar Apr 15 '23 21:04 p-i-