1

I use pycharm ide for coding, But when I tried installing PyDictionary module it gave this error on console:

PyCharm screenshot

The system is running windows10 with Python version 3.10.2 with latest pip and setuptool. All necessary path variables are set and other modules import and install without issues. This case is happening only with python 3.10.2

Collecting PyDictionary
  Using cached PyDictionary-2.0.1-py3-none-any.whl (6.1 kB)
Collecting goslate
  Using cached goslate-1.5.2.tar.gz (16 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Collecting bs4
  Using cached bs4-0.0.1.tar.gz (1.1 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Collecting click
  Using cached click-8.0.4-py3-none-any.whl (97 kB)
Requirement already satisfied: requests in c:\users\sysadmin\appdata\local\programs\python\python310\lib\site-packages (from PyDictionary) (2.27.1)
Collecting beautifulsoup4
  Using cached beautifulsoup4-4.10.0-py3-none-any.whl (97 kB)
Collecting colorama
  Using cached colorama-0.4.4-py2.py3-none-any.whl (16 kB)
Collecting futures
  Using cached futures-3.0.5.tar.gz (25 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'error'

  error: subprocess-exited-with-error
  
  python setup.py egg_info did not run successfully.
  exit code: 1
  
  [27 lines of output]
  Traceback (most recent call last):
    File "<string>", line 2, in <module>
    File "<pip-setuptools-caller>", line 14, in <module>
    File "C:\Users\sysadmin\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\__init__.py", line 244, in <module>
      monkey.patch_all()
    File "C:\Users\sysadmin\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\monkey.py", line 99, in patch_all
      patch_for_msvc_specialized_compiler()
    File "C:\Users\sysadmin\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\monkey.py", line 169, in patch_for_msvc_specialized_compiler
      patch_func(*msvc14('_get_vc_env'))
    File "C:\Users\sysadmin\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\monkey.py", line 149, in patch_params
      mod = import_module(mod_name)
    File "C:\Users\sysadmin\AppData\Local\Programs\Python\Python310\lib\importlib\__init__.py", line 126, in import_module
      return _bootstrap._gcd_import(name[level:], package, level)
    File "C:\Users\sysadmin\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\_distutils\_msvccompiler.py", line 20, in <module>
      import unittest.mock
    File "C:\Users\sysadmin\AppData\Local\Programs\Python\Python310\lib\unittest\mock.py", line 26, in <module>
      import asyncio
    File "C:\Users\sysadmin\AppData\Local\Programs\Python\Python310\lib\asyncio\__init__.py", line 8, in <module>
      from .base_events import *
    File "C:\Users\sysadmin\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 18, in <module>
      import concurrent.futures
    File "C:\Users\sysadmin\AppData\Local\Temp\pip-install-ucxsouan\futures_c24a44afb56f439e8f819b7a8a5ff59d\concurrent\futures\__init__.py", line 8, in <module>
      from concurrent.futures._base import (FIRST_COMPLETED,
    File "C:\Users\sysadmin\AppData\Local\Temp\pip-install-ucxsouan\futures_c24a44afb56f439e8f819b7a8a5ff59d\concurrent\futures\_base.py", line 357
      raise type(self._exception), self._exception, self._traceback
                                 ^
  SyntaxError: invalid syntax
  [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 tried the same on windows command shell with admin privileges. But same. Anyone has the same issue?

diler singh
  • 11
  • 1
  • 3
  • "I tried the same on windows command shell with admin privileges"—please _don't do this_. Only run things with elevated privileges if there is a reason to do so and you fully understand the implications. Blindly re-running failing commands as Administrator or root is a great way to break your system. – ChrisGPT was on strike Mar 03 '22 at 12:05
  • That error shows a Python 2-style `raise`. It looks like there's a transitive dependency on [`futures`](https://pypi.org/project/futures/), which explicitly does _not_ support Python 3: "It **does not** work on Python 3 due to Python 2 syntax being used in the codebase. Python 3 users should not attempt to install it, since the package is already included in the standard library." – ChrisGPT was on strike Mar 03 '22 at 12:10
  • 'But when I tried installing a module' *which* module? – Sören Mar 03 '22 at 12:12
  • @Sören sorry I forgot to mention PyDictionary. – diler singh Mar 03 '22 at 12:18
  • @Chris you said PyDictionary is already included? How do you import and access it. – diler singh Mar 03 '22 at 12:18
  • @dilersingh, no _PyDictionary_ is not included. [`concurrent.futures` is](https://docs.python.org/library/concurrent.futures.html). It looks like some nested dependency is trying to install the `futures` module from PyPI, which is a version backported to Python 2. – ChrisGPT was on strike Mar 03 '22 at 12:19
  • 1
    pydictionary depends on goslate, which depends on futures. This is a bug. – Sören Mar 03 '22 at 12:27
  • And [goslate itself appears to be deprecated](https://pypi.org/project/goslate/): "Google has updated its translation service recently with a ticket mechanism to prevent simple crawler program like `goslate` from accessing. Though a more sophisticated crawler may still work technically, however it would have crossed the fine line between using the service and breaking the service. `goslate` will not be updated to break google’s ticket mechanism. Free lunch is over. Thanks for using." So it's unlikely the author will invest any time fixing that bug. – ChrisGPT was on strike Mar 03 '22 at 12:30
  • @Sören so this translates to anyone using 3.10.2 not able to use PyDictionary. Awesome!!! – diler singh Mar 03 '22 at 12:31
  • PyDictionary should probably just remove its dependency on `goslate`. There is [an open issue for this](https://github.com/geekpradd/PyDictionary/issues/42). – ChrisGPT was on strike Mar 03 '22 at 12:31
  • @dilersingh, likely any version of Python 3, not just the latest. And to be clear: this is something that the PyDictionary folks should fix. It's _their_ fault, not Python's or PyCharm's or anybody else's. They are the ones depending on an old, unmaintained library that is itself buggy. Feel free to add your voice to that open issue. – ChrisGPT was on strike Mar 03 '22 at 12:32
  • `goslate`'s source repository appears to have been removed: https://bitbucket.org/zhuoqiang/goslate – ChrisGPT was on strike Mar 03 '22 at 12:38
  • @Chris https://github.com/zhuoqiang/goslate – Sören Mar 03 '22 at 12:49
  • @Sören, interesting. The contribution links still go to Bitbucket: https://github.com/zhuoqiang/goslate#how-to-contribute In any case, that doesn't change much. goslate is deprecated and broken; PyDictionary should probably stop depending on it. – ChrisGPT was on strike Mar 03 '22 at 13:25

3 Answers3

6

PyDictionary depends on goslate which is dependant on futures, since futures is not supported by Python 3 it causes error. One way of preventing this is to install goslate directly from the GitHub Repository, here is the link. But you will not get the latest version.

First install goslate from GitHub Repository:

pip install -e git+https://github.com/yeahwhat-mc/goslate#egg=goslate

Then install PyDictionary:

pip install PyDictionary
zain.py
  • 181
  • 2
  • 5
3

For me upgrading setuptools solved it.

python3 -m pip install --upgrade pip setuptools
Lajos
  • 2,549
  • 6
  • 31
  • 38
1

Try going with wordhoard or py-dictionary

pip install wordhoard
pip install Py-Dictionary

and you can perform the operations. Below I have found the synonym of the word

inp_word = "name"
dict = Dictionary(inp_word,50)
#Py-dictionary
for i in dict.synonyms():
    syn_words.append(i)

#wordhoard
for i in Synonyms(inp_word).find_synonyms():
    syn_words.append(i)

print(set(syn_words))

Mostly both will have same results but I don't want to leave out things so only I am using combinedly