import pandas as pd
import re
from tqdm import tqdm
from ecommercetools import seo
Querylist1 = ['denmark, inflation',
'denmark, immigration',
'denmark, global warming',
'toronto, inflation',
'toronto, immigration',
'toronto, global warming',
'washington, inflation',
]
targets = []
for query in tqdm(Querylist1):
pages_num = 5
conditions = ['wikipedia','twitter','linkedin','facebook','news']
# Step 4.3: the main body.
try:
res = seo.get_serps(query, pages=pages_num)
except:
continue
for c in conditions[:]:
temp1 = res[res['link'].str.contains(c,case=False)]['title'].to_list()
temp2 = res[res['link'].str.contains(c,case=False)]['link'].to_list()
if len(temp1)==0:
y = ''
else:
y = temp1[0]
if len(temp2)==0:
z = ''
continue
else:
z = temp2[0]
targets.append([y,z,c,query])
targets = pd.DataFrame(targets, columns=['title','link','link category','query keyword used'])
print(targets)
This is a simple script. but when i run pip install ecommercetools
following error is displayed:
error
PS C:UsersDELLDesktopNew folder> pip install ecommercetools
Collecting ecommercetools
Using cached ecommercetools-0.42.9-py3-none-any.whl.metadata (54 kB)
Collecting gapandas (from ecommercetools)
Using cached gapandas-1.0-py3-none-any.whl.metadata (4.1 kB)
Collecting httplib2>=0.15.0 (from ecommercetools)
Using cached httplib2-0.22.0-py3-none-any.whl.metadata (2.6 kB)
Collecting lifetimes (from ecommercetools)
Using cached Lifetimes-0.11.3-py3-none-any.whl.metadata (4.8 kB)
Requirement already satisfied: numpy in c:usersdellappdatalocalprogramspythonpython311libsite-packages (from ecommercetools) (1.26.3)
Requirement already satisfied: pandas in c:usersdellappdatalocalprogramspythonpython311libsite-packages (from ecommercetools) (2.2.0)
Collecting pycausalimpact (from ecommercetools)
Using cached pycausalimpact-0.1.1-py2.py3-none-any.whl.metadata (8.3 kB)
Requirement already satisfied: requests in c:usersdellappdatalocalprogramspythonpython311libsite-packages (from ecommercetools) (2.31.0)
Requirement already satisfied: requests-html in c:usersdellappdatalocalprogramspythonpython311libsite-packages (from ecommercetools) (0.10.0)
Collecting sklearn (from ecommercetools)
Using cached sklearn-0.0.post12.tar.gz (2.6 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [15 lines of output]
The 'sklearn' PyPI package is deprecated, use 'scikit-learn'
rather than 'sklearn' for pip commands.
Here is how to fix this error in the main use cases:
- use 'pip install scikit-learn' rather than 'pip install sklearn'
- replace 'sklearn' by 'scikit-learn' in your pip requirements files
(requirements.txt, setup.py, setup.cfg, Pipfile, etc ...)
- if the 'sklearn' package is used by one of your dependencies,
it would be great if you take some time to track which package uses
'sklearn' instead of 'scikit-learn' and report it to their issue tracker
- as a last resort, set the environment variable
SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL=True to avoid this error
More information is available at
https://github.com/scikit-learn/sklearn-pypi-package
[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.
I also installed scikit-learn. but installing ecommercetools displayed the same error.
the only understandable thing i can see is:
Collecting sklearn (from ecommercetools)
Using cached sklearn-0.0.post12.tar.gz (2.6 kB)
Preparing metadata (setup.py) ... error
I think when i run pip install ecommercetools
it tries to install the default sklearn instead of the new package that i installed ( scikit-learn )
Any help would be appreciated
as mentioned above
Hassan Bin Aman is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
To replace deprecated sklearn with scikit-learn, identify and update code sections that rely on outdated functionality, using compatible alternatives where needed. Check for broader library compatibility and review scikit-learn’s documentation for solutions or workarounds.
jacksmito is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.