2captcha / 2captcha-python

Python 3 package for easy integration with the API of 2captcha captcha solving service to bypass recaptcha, hcaptcha, funcaptcha, geetest and solve any other captchas.
https://2captcha.com
MIT License
497 stars 93 forks source link

Docker compose error #16

Closed BenDonnelly closed 2 years ago

BenDonnelly commented 3 years ago

Hey,

I am having problems using this package with docker compose.

This is my requirements file:

2captcha-python==1.1.0
aniso8601==9.0.1
APScheduler==3.7.0
astroid==2.5.3
beautifulsoup4==4.9.3
cbpro==1.1.4
click==7.1.2
colorama==0.4.4
dnspython==2.1.0
email-validator==1.1.2
Flask==1.1.2
flask-mongoengine==1.0.0
Flask-RESTful==0.3.8
Flask-WTF==0.14.3
idna==3.1
isort==5.8.0
itsdangerous==1.1.0
Jinja2==2.11.3
lazy-object-proxy==1.6.0
MarkupSafe==1.1.1
mccabe==0.6.1
mongoengine==0.23.0
pylint==2.7.4
pymongo==3.5.1
pytz==2021.1
requests==2.13.0
selenium==3.141.0
six==1.10.0
sortedcontainers==2.3.0
soupsieve==2.2.1
toml==0.10.2
typed-ast==1.4.3
tzlocal==2.1
urllib3==1.26.4
websocket-client==0.40.0
Werkzeug==1.0.1
wrapt==1.12.1
WTForms==2.3.3

When doing docker-compose up I get the following error:

 > [6/7] RUN pip3 install -r requirements.txt:
#10 1.578 Collecting requests==2.13.0
#10 1.730   Downloading https://files.pythonhosted.org/packages/7e/ac/a80ed043485a3764053f59ca92f809cc8a18344692817152b0e8bd3ca891/requests-2.13.0-py2.py3-none-any.whl (584kB)
#10 2.112 Collecting 2captcha-python==1.1.0
#10 2.139   Downloading https://files.pythonhosted.org/packages/39/ad/5939251435bf7f47293eded6341ef8d4299aff623270be8c71da7fe9e205/2captcha-python-1.1.0.tar.gz
#10 2.388     ERROR: Command errored out with exit status 1:
#10 2.388      command: /usr/local/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-sf9esfkc/2captcha-python/setup.py'"'"'; __file__='"'"'/tmp/pip-install-sf9esfkc/2captcha-python/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-sf9esfkc/2captcha-python/pip-egg-info
#10 2.388          cwd: /tmp/pip-install-sf9esfkc/2captcha-python/
#10 2.388     Complete output (9 lines):
#10 2.388     Traceback (most recent call last):
#10 2.388       File "<string>", line 1, in <module>
#10 2.388       File "/tmp/pip-install-sf9esfkc/2captcha-python/setup.py", line 4, in <module>
#10 2.388         from twocaptcha import __version__
#10 2.388       File "/tmp/pip-install-sf9esfkc/2captcha-python/twocaptcha/__init__.py", line 1, in <module>
#10 2.388         from .api import ApiClient
#10 2.388       File "/tmp/pip-install-sf9esfkc/2captcha-python/twocaptcha/api.py", line 3, in <module>
#10 2.388         import requests
#10 2.388     ModuleNotFoundError: No module named 'requests'
#10 2.388     ----------------------------------------
#10 2.393 ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
#10 2.582 WARNING: You are using pip version 19.3.1; however, version 21.1 is available.

It looks like the error is coming a 2captcha-python module.

Please could you investigate?

shohamc1 commented 3 years ago

I was running into the same issue.

A quick fix would be to manually run pip3 install requests before installing requirements from the .txt file. An alternative fix is to use v1.0.3 which does not seem to have this issue. Hope that we can get a real solution to this problem soon.

kratzky commented 3 years ago

I guess there's a conflict between requests==2.13.0 in your requirements file and requests>=2.20.0 in requirements file of 2captcha-python

shohamc1 commented 3 years ago

I guess there's a conflict between requests==2.13.0 in your requirements file and requests>=2.20.0 in requirements file of 2captcha-python

In that case usually pip shows a warning. I also tested with a requirements.txt with no version requirements and it throws the same error. To reproduce you can create a new virtualenv and try pip install 2captcha-python.

warren-ru commented 3 years ago

I guess there's a conflict between requests==2.13.0 in your requirements file and requests>=2.20.0 in requirements file of 2captcha-python

I'm using requests==2.25.1, but facing the same issue.

eXtizi commented 2 years ago

same error on Heroku, anybody found a solution?

costastf commented 2 years ago

I am getting the same error in a github actions pipeline, where the same code works localy.

Relevant logs

================================== log start ===================================
Collecting requests~=2.26.0
  Downloading requests-2.26.0-py2.py3-none-any.whl (62 kB)
Collecting boto3~=1.20.18
  Downloading boto3-1.20.18-py3-none-any.whl (131 kB)
Collecting beautifulsoup4~=4.10.0
  Downloading beautifulsoup4-4.10.0-py3-none-any.whl (97 kB)
Collecting opnieuw~=1.1.0
  Downloading opnieuw-1.1.0-py3-none-any.whl (8.9 kB)
Collecting boto3-type-annotations~=0.3.1
  Downloading boto3_type_annotations-0.3.1-py3-none-any.whl (338 kB)
Collecting cachetools~=4.2.4
  Downloading cachetools-4.2.4-py3-none-any.whl (10 kB)
Collecting pyotp~=2.6.0
  Downloading pyotp-2.6.0-py2.py3-none-any.whl (11 kB)
Collecting 2captcha-python~=1.1.0
  Downloading 2captcha-python-1.1.0.tar.gz (8.8 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'error'
  ERROR: Command errored out with exit status 1:
   command: /home/runner/work/awsapilib/awsapilib/.tox/py37/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-qjx6s4xz/2captcha-python_26a35daaee5f47ac953b9f05b9f5ca83/setup.py'"'"'; __file__='"'"'/tmp/pip-install-qjx6s4xz/2captcha-python_26a35daaee5f47ac953b9f05b9f5ca83/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-23lv1u5x
       cwd: /tmp/pip-install-qjx6s4xz/2captcha-python_26a35daaee5f47ac953b9f05b9f5ca83/
  Complete output (9 lines):
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-install-qjx6s4xz/2captcha-python_26a35daaee5f47ac953b9f05b9f5ca83/setup.py", line 4, in <module>
      from twocaptcha import __version__
    File "/tmp/pip-install-qjx6s4xz/2captcha-python_26a35daaee5f47ac953b9f05b9f5ca83/twocaptcha/__init__.py", line 1, in <module>
      from .api import ApiClient
    File "/tmp/pip-install-qjx6s4xz/2captcha-python_26a35daaee5f47ac953b9f05b9f5ca83/twocaptcha/api.py", line 3, in <module>
      import requests
  ModuleNotFoundError: No module named 'requests'
  ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/39/ad/5939251435bf7f47293eded6341ef8d4299aff623270be8c71da7fe9e205/2captcha-python-1.1.0.tar.gz#sha256=57a68523240ec91f280bf6fa72ad2dc673009e5c40d5d89ca5d352a0f8c8f83f (from https://pypi.org/simple/2captcha-python/) (requires-python:>=3.6). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement 2captcha-python~=1.1.0 (from versions: 1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.1.0)
ERROR: No matching distribution found for 2captcha-python~=1.1.0
2captcha commented 2 years ago

fixed with #28 in v1.1.1 thanks to @nathanielobrown