Home > Software engineering >  Python PyDictionary Import error from futures
Python PyDictionary Import error from futures

Time:05-08

So I run python -m pip install PyDictionary and I get this output:

Collecting PyDictionary
  Using cached PyDictionary-2.0.1-py3-none-any.whl (6.1 kB)
Requirement already satisfied: requests in d:\python\lib\site-packages (from PyDictionary) (2.27.1)
Collecting goslate
  Using cached goslate-1.5.2.tar.gz (16 kB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: click in d:\python\lib\site-packages (from PyDictionary) (8.1.3)
Collecting bs4
  Using cached bs4-0.0.1.tar.gz (1.1 kB)
  Preparing metadata (setup.py) ... done
Collecting beautifulsoup4
  Using cached beautifulsoup4-4.11.1-py3-none-any.whl (128 kB)
Requirement already satisfied: colorama in d:\python\lib\site-packages (from click->PyDictionary) (0.4.4)
Collecting futures
  Using cached futures-3.0.5.tar.gz (25 kB)
  Preparing metadata (setup.py) ... 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 "D:\Python\lib\site-packages\setuptools\__init__.py", line 189, in <module>
          monkey.patch_all()
        File "D:\Python\lib\site-packages\setuptools\monkey.py", line 99, in patch_all
          patch_for_msvc_specialized_compiler()
        File "D:\Python\lib\site-packages\setuptools\monkey.py", line 169, in patch_for_msvc_specialized_compiler
          patch_func(*msvc14('_get_vc_env'))
        File "D:\Python\lib\site-packages\setuptools\monkey.py", line 149, in patch_params
          mod = import_module(mod_name)
        File "D:\Python\lib\importlib\__init__.py", line 126, in import_module
          return _bootstrap._gcd_import(name[level:], package, level)
        File "D:\Python\lib\site-packages\setuptools\_distutils\_msvccompiler.py", line 20, in <module>
          import unittest.mock
        File "D:\Python\lib\unittest\mock.py", line 26, in <module>
          import asyncio
        File "D:\Python\lib\asyncio\__init__.py", line 8, in <module>
          from .base_events import *
        File "D:\Python\lib\asyncio\base_events.py", line 18, in <module>
          import concurrent.futures
        File "C:\Users\localuser\AppData\Local\Temp\pip-install-vsl457j6\futures_9b56e18f578949cd955c2218e6840e1e\concurrent\futures\__init__.py", line 8, in <module>
          from concurrent.futures._base import (FIRST_COMPLETED,
        File "C:\Users\localuser\AppData\Local\Temp\pip-install-vsl457j6\futures_9b56e18f578949cd955c2218e6840e1e\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.

How do I fix it so I can download PyDictionary. I am using python 3.10.4. I have saved Python onto a hard drive D: but it causes no other problems for pip. The main problem I can see is that there is a problem importing Futures but from my research I have found that Futures is already downloaded for python 3 but when I try to uninstall it is says skipping as futures in not installed so maybe that is the problem but I don`t know how to solve it. Anyone have any ideas?

CodePudding user response:

This seems to be a known issue with this package. When issues like this occur, it is always best to go and check the official GitHub repository of the project and look through the open issues.

https://github.com/geekpradd/PyDictionary/issues/52#issuecomment-1105459595

I don't have any privileges on this repo. But I did some debugging I think the actual issue here is that goslate depends on futures, and futures >=3.0.0 isn't installable on python3 at all. The pypi page calls this out saying 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. -- https://pypi.org/project/futures/ I am able to work around the issue by installing futures <3.0.0 before installing PyDictionary:

  • Related