0

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

RMPR
  • 3,368
  • 4
  • 19
  • 31
Adam
  • 5
  • 3
  • Mac OS 10.15.2 / Python 3.8.1 / – Adam Feb 18 '20 at 16:12
  • WARNING: You are using pip version 19.2.3, however version 20.0.2 is available. You should consider upgrading via the 'pip install --upgrade pip' command.WARNING: You are using pip version 19.2.3, however version 20.0.2 is available. You should consider upgrading via the 'pip install --upgrade pip' command. – Adam Feb 18 '20 at 16:13
  • /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: No module named pip – Adam Feb 18 '20 at 16:13
  • Have now updated it:Successfully installed pip-20.0.2 – Adam Feb 18 '20 at 16:16

2 Answers2

0

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

RMPR
  • 3,368
  • 4
  • 19
  • 31
  • Thanks for the suggestion. 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..... – Adam Feb 18 '20 at 16:23
  • 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. – Adam Feb 18 '20 at 16:27
  • 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 – Adam Feb 18 '20 at 16:27
  • /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: No module named pip – Adam Feb 19 '20 at 11:15
  • ---------------------------------------- ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. – Adam Feb 19 '20 at 11:19
  • @Adam update your question accordingly, it's a little bit messy to put it in the comments – RMPR Feb 19 '20 at 13:06
  • @Adam Regarding your first edit, it seems that `pydictionary` is now installed, the issue is more likely with the internals of the library, so open an [issue on the repository](https://github.com/geekpradd/PyDictionary/issues) the command to install directly with the github repository doesn't work because the project has no setup.py, so I'll update my answer accordingly, don't forget to mark the answer as valid. – RMPR Feb 20 '20 at 14:15
  • Thank you - ill do that – Adam Feb 24 '20 at 14:15
0

See VCS, from the pip docs

pip currently supports cloning over git, git+http, git+https, git+ssh, git+git and git+file:

Here are the supported forms:

git://git.example.com/MyProject#egg=MyProject git+http://git.example.com/MyProject#egg=MyProject git+https://git.example.com/MyProject#egg=MyProject git+ssh://git.example.com/MyProject#egg=MyProject git+git://git.example.com/MyProject#egg=MyProject git+file:///home/user/projects/MyProject#egg=MyProject

Pedro Rodrigues
  • 2,520
  • 2
  • 27
  • 26