Error Pushing To Heroku with 2captcha library - ModuleNotFoundError: No module named 'requests'

BIBISUFA

New member
I'm getting this error - ModuleNotFoundError: No module named 'requests' when I run git push heroku master. It's saying I don't have the requests in my requirements.txt but it's clearly in there. I believe something weird is happening because of 2captcha-python. Any ideas on how I can resolve this error? Included my requirements.txt file and error log below.

Requirements.txt file:
Code:
requests==2.25.1

2captcha-python==1.1.0

beautifulsoup4==4.9.3

bs4==0.0.1

cachetools==4.2.2

certifi==2021.5.30

chardet==4.0.0

df2gspread==1.0.4

google-api-python-client==1.6.7

google-auth==1.31.0

google-auth-oauthlib==0.4.4

gspread==3.7.0

httplib2==0.19.1

idna==2.10

lxml==4.6.3

numpy==1.20.3

oauth2client==4.1.3

oauthlib==3.1.1

pandas==1.2.4

pyasn1==0.4.8

pyasn1-modules==0.2.8

pyparsing==2.4.7

python-dateutil==2.8.1

pytz==2021.1

requests-oauthlib==1.3.0

rsa==4.7.2

selenium==3.141.0

six==1.16.0

soupsieve==2.2.1

uritemplate==3.0.1

urllib3==1.26.5


Error log:
Code:
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Building on the Heroku-20 stack
remote: -----> Using buildpacks:
remote:        1. heroku/python
remote:        2. https://github.com/heroku/heroku-buildpack-google-chrome
remote:        3. https://github.com/heroku/heroku-buildpack-chromedriver
remote: -----> Python app detected
remote: -----> No Python version was specified. Using the buildpack default: python-3.9.5
remote:        To use a different version, see: https://devcenter.heroku.com/articles/python-runtimes
remote: -----> Installing python-3.9.5
remote: -----> Installing pip 20.2.4, setuptools 47.1.1 and wheel 0.36.2
remote: -----> Installing SQLite3
remote: -----> Installing requirements with pip
remote:        Collecting requests==2.25.1
remote:          Downloading requests-2.25.1-py2.py3-none-any.whl (61 kB)
remote:        Collecting 2captcha-python==1.1.0
remote:          Downloading 2captcha-python-1.1.0.tar.gz (8.8 kB)
remote:            ERROR: Command errored out with exit status 1:
remote:             command: /app/.heroku/python/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-qcbdr2fk/2captcha-python/setup.py'"'"'; __file__='"'"'/tmp/pip-install-qcbdr2fk/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-pip-egg-info-y8s7an11
remote:                 cwd: /tmp/pip-install-qcbdr2fk/2captcha-python/
remote:            Complete output (9 lines):
remote:            Traceback (most recent call last):
remote:              File "<string>", line 1, in <module>
remote:              File "/tmp/pip-install-qcbdr2fk/2captcha-python/setup.py", line 4, in <module>
remote:                from twocaptcha import __version__
remote:              File "/tmp/pip-install-qcbdr2fk/2captcha-python/twocaptcha/__init__.py", line 1, in <module>
remote:                from .api import ApiClient
remote:              File "/tmp/pip-install-qcbdr2fk/2captcha-python/twocaptcha/api.py", line 3, in <module>
remote:                import requests
remote:            ModuleNotFoundError: No module named 'requests'
remote:            ----------------------------------------
remote:        ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
remote:  !     Push rejected, failed to compile Python app.
remote:
remote:  !     Push failed
remote: Verifying deploy...
remote:
remote: !       Push rejected to python-selenium-southcarolina.
remote:
To https://git.heroku.com/python-selenium-southcarolina.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/python-selenium-southcarolina.git'
 

Jonth

New member
pip first downloads all modules and later install them. So when pip downloads 2captcha then requests is already downloaded but not installed. And this makes problem.

You have to first install all modules except 2captcha and later install only 2captcha. OR first install only requests and later other modules.
 

corinnaucdjv

New member
Hi there,
When I'm trying to stream my signals from GUI session to Python, an error comes out on the cmd board: 'ModuleNotFoundError: No module named 'serial''. Should I specify my port serial by entering 'python openbci_lsl.py [PORT] --stream'? If yes, how I can specify it? Thank you.
 
Last edited:

cristydavidd

New member
Requests is not a built in module (does not come with the default python installation), so you will have to install requests module:

Windows

Use pip install requests (or pip3 install requests for python3) if you have pip installed and Pip.exe added to the Path Environment Variable. If pip is installed but not in your path you can use python -m pip install requests (or python3 -m pip install requests for python3)

Alternatively from a cmd prompt, use > Path\easy_install.exe requests, where Path is your Python*\Scripts folder, if it was installed. (For example: C:\Python32\Scripts)

If you manually want to add a library to a windows machine, you can download the compressed library, uncompress it, and then place it into the Lib\site-packages folder of your python path. (For example: C:\Python27\Lib\site-packages)


Linux

For Debian/Ubuntu Python2: sudo apt-get install python-requests

For Debian/Ubuntu Python3: sudo apt-get install python3-requests