Import requests-html could not be resolved

I recommend trying everything in command line.

MacOS is based on Unix and it is very command line friendly.

I also recommend working with Python virtual envs, so create a virtual env and then install what you need there.

Go to a folder where you want to create the Python virtualenvs, and create a virtualenv called learn for example, then install requests_html in there:

mkdir ~/venvs
cd ~/venvs
python3 -m venv learn

source learn/bin/activate
learn/bin/pip install requests-html

Then when running your project, make sure you have that virtual env activated

source learn/bin/activate

It is useful at this stage to confirm if the python program used is the one from your virtual env so try

which python
which python3

And let us know the answer. Ideally either python or python3 is the one from within the virtualenv. Then, with the good one, try:


python myproject.py

You got the import correctly, it should be in your file, myproject.py

import requests_html

Hello, so i used this pip install requests-html but i got the package but the version 0.0.1. After that i tried using pip install requests-html==0.10.0 but it gives me this error.

PS C:\Users\E.Lozada\PycharmProjects\CryptoRobot> pip install requests-html==0.10.0
Collecting requests-html==0.10.0
Using cached requests_html-0.10.0-py3-none-any.whl (13 kB)
Collecting bs4
Using cached bs4-0.0.1.tar.gz (1.1 kB)
Preparing metadata (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\e.lozada\pycharmprojects\cryptorobot\venv\scripts\python.exe' -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\User
s\E.Lozada\AppData\Local\Temp\pip-install-b6yf4ds\bs4_2fc2cb37473140aa9d79dd0f5df821bb\setup.py'"'"'; file='"'"'C:\Users\E.Lozada\AppData\Loc
al\Temp\pip-install-b6yf4ds\bs4_2fc2cb37473140aa9d79dd0f5df821bb\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 'C:\Users\E.Lozada\AppData\Local\Temp\pip-pip-egg-info-r5chv3nr'
cwd: C:\Users\E.Lozada\AppData\Local\Temp\pip-install-b6yf4ds\bs4_2fc2cb37473140aa9d79dd0f5df821bb
Complete output (23 lines):
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\E.Lozada\AppData\Local\Temp\pip-install-b6yf4ds\bs4_2fc2cb37473140aa9d79dd0f5df821bb\setup.py", line 4, in
setup(
File "c:\users\e.lozada\pycharmprojects\cryptorobot\venv\lib\site-packages\setuptools_init.py", line 153, in setup
return distutils.core.setup(**attrs)
File "C:\Users\E.Lozada\AppData\Local\Programs\Python\Python310\lib\distutils\core.py", line 108, in setup
setup_distribution = dist = klass(attrs)
File "c:\users\e.lozada\pycharmprojects\cryptorobot\venv\lib\site-packages\setuptools\dist.py", line 453, in init
Distribution.init(
File "C:\Users\E.Lozada\AppData\Local\Programs\Python\Python310\lib\distutils\dist.py", line 292, in init
self.finalize_options()
File "c:\users\e.lozada\pycharmprojects\cryptorobot\venv\lib\site-packages\setuptools\dist.py", line 830, in finalize_options
for ep in sorted(loaded, key=by_order):
File "c:\users\e.lozada\pycharmprojects\cryptorobot\venv\lib\site-packages\setuptools\dist.py", line 829, in
loaded = map(lambda e: e.load(), filtered)
File "c:\users\e.lozada\pycharmprojects\cryptorobot\venv\lib\site-packages\pkg_resources_init.py", line 2463, in load
self.require(*args, **kwargs)
File "c:\users\e.lozada\pycharmprojects\cryptorobot\venv\lib\site-packages\pkg_resources_init.py", line 2486, in require
items = working_set.resolve(reqs, env, installer, extras=self.extras)
File "c:\users\e.lozada\pycharmprojects\cryptorobot\venv\lib\site-packages\pkg_resources_init.py", line 782, in resolve
raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (pyparsing 3.0.6 (c:\users\e.lozada\pycharmprojects\cryptorobot\venv\lib\site-packages), Requirement.parse('pypars
ing<3,>=2.0.2'), {'packaging'})

WARNING: Discarding https://files.pythonhosted.org/packages/10/ed/7e8b97591f6f456174139ec089c769f89a94a1a4025fe967691de971f314/bs4-0.0.1.tar.gz#sha256=36ecea
1fd7cc5c0c6e4a1ff075df26d50da647b75376626cc186e2212886dd3a (from https://pypi.org/simple/bs4/). Command errored out with exit status 1: python setup.py egg_i
nfo Check the logs for full command output.
Using cached bs4-0.0.0.tar.gz (1.1 kB)
Preparing metadata (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\e.lozada\pycharmprojects\cryptorobot\venv\scripts\python.exe' -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\User
s\E.Lozada\AppData\Local\Temp\pip-install-b6yf4ds\bs4_4edbd5daf5dc4e879fb67bbd80ec8862\setup.py'"'"'; file='"'"'C:\Users\E.Lozada\AppData\Loc
al\Temp\pip-install-b6yf4ds\bs4_4edbd5daf5dc4e879fb67bbd80ec8862\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 'C:\Users\E.Lozada\AppData\Local\Temp\pip-pip-egg-info-pxog7o8k'
cwd: C:\Users\E.Lozada\AppData\Local\Temp\pip-install-b6yf4ds\bs4_4edbd5daf5dc4e879fb67bbd80ec8862
Complete output (23 lines):
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\E.Lozada\AppData\Local\Temp\pip-install-b6yf4ds\bs4_4edbd5daf5dc4e879fb67bbd80ec8862\setup.py", line 4, in
setup(
File "c:\users\e.lozada\pycharmprojects\cryptorobot\venv\lib\site-packages\setuptools_init.py", line 153, in setup
return distutils.core.setup(**attrs)
File "C:\Users\E.Lozada\AppData\Local\Programs\Python\Python310\lib\distutils\core.py", line 108, in setup
setup_distribution = dist = klass(attrs)
File "c:\users\e.lozada\pycharmprojects\cryptorobot\venv\lib\site-packages\setuptools\dist.py", line 453, in init
Distribution.init(
File "C:\Users\E.Lozada\AppData\Local\Programs\Python\Python310\lib\distutils\dist.py", line 292, in init
self.finalize_options()
File "c:\users\e.lozada\pycharmprojects\cryptorobot\venv\lib\site-packages\setuptools\dist.py", line 830, in finalize_options
for ep in sorted(loaded, key=by_order):
File "c:\users\e.lozada\pycharmprojects\cryptorobot\venv\lib\site-packages\setuptools\dist.py", line 829, in
loaded = map(lambda e: e.load(), filtered)
File "c:\users\e.lozada\pycharmprojects\cryptorobot\venv\lib\site-packages\pkg_resources_init.py", line 2463, in load
self.require(*args, **kwargs)
File "c:\users\e.lozada\pycharmprojects\cryptorobot\venv\lib\site-packages\pkg_resources_init.py", line 2486, in require
items = working_set.resolve(reqs, env, installer, extras=self.extras)
File "c:\users\e.lozada\pycharmprojects\cryptorobot\venv\lib\site-packages\pkg_resources_init.py", line 782, in resolve
raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (pyparsing 3.0.6 (c:\users\e.lozada\pycharmprojects\cryptorobot\venv\lib\site-packages), Requirement.parse('pypars
ing<3,>=2.0.2'), {'packaging'})

WARNING: Discarding https://files.pythonhosted.org/packages/50/fe/c4bf5083af20ec85ac5d278dfd12a9756724100c308b7bdccbaa7cbf5715/bs4-0.0.0.tar.gz#sha256=28408e
bf82f66e2cf1e2a484c62f6e5d901fd6bdf1d9a6787207599538f0dbe6 (from https://pypi.org/simple/bs4/). Command errored out with exit status 1: python setup.py egg_i
nfo Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement bs4 (from requests-html) (from versions: 0.0.0, 0.0.1)
ERROR: No matching distribution found for bs4

Any idea how can i fix this?

How do I fix an import request in Python?

For windows just give path as cd and path to the "Scripts" of python and then execute the command easy_install.exe requests. Then try import requests... Show activity on this post. Installing requests through pip didn't help me.

How do I install HTML in Python?

How to install HTML package for python3..
html is already part of Standard Library that comes with Python 3.x Why you want to install it? Just directly use it by importing. docs.python.org/3.5/library/html.html. ... .
I want to use from html import HTML so that I can directly use HTML inbuilt functions. – Veeresh Hollur..

How do I fix No module named request in Python?

The Python "ModuleNotFoundError: No module named 'requests'" occurs when we forget to install the requests module before importing it or install it in an incorrect environment. To solve the error, install the module by running the pip install requests command.

Is requests HTML faster than selenium?

Let's see an example of extracting data with Selenium: One of the disadvantages of Selenium is speed. Web scraping with Selenium is slower than HTTP requests to the web browser because all the scripts present on the web page will be executed.