I am a beginner, and tried to install PyDictionary with pip. It installed, but I had the same issue as this thread - it did not work: How to get rid of the BeautifulSoup html parser error when I'm not using BeautifulSoup Someone on here suggested installing if directly from the GitHub repo, but I'm not sure which file to download and what to do next.
UPDATE 1
I've updated pip, and used:
python3 -m pip install PyDictionary
(I needed python3 for some reason). I then used this program:
from PyDictionary import PyDictionary
dictionary = PyDictionary()
print (dictionary.synonym("Life"))
But got:
Warning (from warnings module): File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/PyDictionary/utils.py", line 5 return BeautifulSoup(requests.get(url).text) UserWarning: No parser was explicitly specified, so I'm using the best available HTML parser for this system ("lxml"). This usually isn't a problem, but if you run this code on another system, or in a different virtual environment, it may use a different parser and behave differently.
The code that caused this warning is on line 5 of the file /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/PyDictionary/utils.py.
To get rid of this warning, pass the additional argument 'features="lxml"' to the BeautifulSoup constructor. Life has no Synonyms in the API None –
UPDATE 2
python3 -m pip install git+https://github.com/geekpradd/PyDictionary
returns:
Collecting git+github.com/geekpradd/PyDictionary Cloning github.com/geekpradd/PyDictionary to /private/var/folders/sn/081bt1wd0d3gy2styt2_l1vw0000gn/T/pip-req-build-73cegdxt Running command git clone -q github.com/geekpradd/PyDictionary /private/var/folders/sn/081bt1wd0d3gy2styt2_l1vw0000gn/T/pip-req-build-73cegdxtERROR: Command errored out with exit status 1: command: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/sn/081bt1wd0d3gy2styt2_l1vw0000gn/T/pip-req-build-73cegdxt/setup.py'"'"'; file__='"'"'/private/var/folders/sn/081bt1wd0d3gy2styt2_l1vw0000gn/T/pip-req-build-73cegdxt/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 /private/var/folders/sn/081bt1wd0d3gy2styt2_l1vw0000gn/T/pip-req-build-73cegdxt/pip-egg-info cwd: /private/var/folders/sn/081bt1wd0d3gy2styt2_l1vw0000gn/T/pip-req-build-73cegdxt/ Complete output (5 lines): Traceback (most recent call last): File "", line 1, in File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/tokenize.py", line 392, in open buffer = _builtin_open(filename, 'rb') FileNotFoundError: [Errno 2] No such file or directory: '/private/var/folders/sn/081bt1wd0d3gy2styt2_l1vw0000gn/T/pip-req-build-73cegdxt/setup.py' ---------------------------------------- ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output
You can normally install directly using the github repos with
python3 -m pip install git+https://github.com/geekpradd/PyDictionary
But this repository has no setup.py file that's why it fails. To me it's more likely a problem with conflicting python versions, so:
python3 -m pip install PyDictionary
Is enough