简体   繁体   中英

Pip3 can't install "empy" for python 3.8.6 (No matching distribution found for empy)

I was trying to install empy with pip3 install empy command inside a virtual environment created with python 3.8.6 on my ubuntu 18.04 pc but got the following main error:

ERROR: Could not find a version that satisfies the requirement empy (from versions: 3.3.2, 3.3.4)
ERROR: No matching distribution found for empy 

I also installed "libffi-dev" using sudo apt-get install libffi-dev to prevent the error ModuleNotFoundError: No module named '_ctypes' but still the error persists and remains unchanged.

Full error as in the terminal:

(py3venv) expert-bot@expert-nx:~/python3_ws$ pip3 install empy
Collecting empy
  Using cached empy-3.3.4.tar.gz (62 kB)
  Preparing metadata (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/expert-bot/python3_ws/py3venv/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-04mt1wt_/empy_f5b8490ded264bce82e92de860ffaccf/setup.py'"'"'; file__='"'"'/tmp/pip-install-04mt1wt_/empy_f5b8490ded264bce82e92de860ffaccf/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-vx6cf784
       cwd: /tmp/pip-install-04mt1wt_/empy_f5b8490ded264bce82e92de860ffaccf/
  Complete output (13 lines):
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/home/expert-bot/python3_ws/py3venv/lib/python3.8/site-packages/setuptools/__init__.py", line 18, in <module>
      from setuptools.dist import Distribution
    File "/home/expert-bot/python3_ws/py3venv/lib/python3.8/site-packages/_virtualenv.py", line 89, in exec_module
      old(module)
    File "/home/expert-bot/python3_ws/py3venv/lib/python3.8/site-packages/setuptools/dist.py", line 37, in <module>
      from setuptools import windows_support
    File "/home/expert-bot/python3_ws/py3venv/lib/python3.8/site-packages/setuptools/windows_support.py", line 2, in <module>
      import ctypes
    File "/usr/local/lib/python3.8/ctypes/__init__.py", line 7, in <module>
      from _ctypes import Union, Structure, Array
  ModuleNotFoundError: No module named '_ctypes'
  ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/3b/95/88ed47cb7da88569a78b7d6fb9420298df7e99997810c844a924d96d3c08/empy-3.3.4.tar.gz#sha256=73ac49785b601479df4ea18a7c79bc1304a8a7c34c02b9472cf1206ae88f01b3 (from https://pypi.org/simple/empy/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  Using cached empy-3.3.2.tar.gz (138 kB)
  Preparing metadata (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/expert-bot/python3_ws/py3venv/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-04mt1wt_/empy_104fd15b7f9e408eb4a702d46fe5de03/setup.py'"'"'; file__='"'"'/tmp/pip-install-04mt1wt_/empy_104fd15b7f9e408eb4a702d46fe5de03/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-_fwmqok0
       cwd: /tmp/pip-install-04mt1wt_/empy_104fd15b7f9e408eb4a702d46fe5de03/
  Complete output (13 lines):
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/home/expert-bot/python3_ws/py3venv/lib/python3.8/site-packages/setuptools/__init__.py", line 18, in <module>
      from setuptools.dist import Distribution
    File "/home/expert-bot/python3_ws/py3venv/lib/python3.8/site-packages/_virtualenv.py", line 89, in exec_module
      old(module)
    File "/home/expert-bot/python3_ws/py3venv/lib/python3.8/site-packages/setuptools/dist.py", line 37, in <module>
      from setuptools import windows_support
    File "/home/expert-bot/python3_ws/py3venv/lib/python3.8/site-packages/setuptools/windows_support.py", line 2, in <module>
      import ctypes
    File "/usr/local/lib/python3.8/ctypes/__init__.py", line 7, in <module>
      from _ctypes import Union, Structure, Array
  ModuleNotFoundError: No module named '_ctypes'
  ----------------------------------------
WARNING: Discarding
https://files.pythonhosted.org/packages/b7/56/72a285d257c7791616960493a04f14c05ca1bf7a83dd208485cf991563bd/empy-3.3.2.tar.gz#sha256=99f016af2770c48ab57a65df7aae251360dc69a1514c15851458a71d4ddfea9c (from https://pypi.org/simple/empy/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement empy (from versions: 3.3.2, 3.3.4)
ERROR: No matching distribution found for empy 

What is the possible solution to this problem?

It looks like your Python is missing the _ctypes module, but I think empy will install after that. I believe _ctypes (which depend on libffi) is build into Python at the time of installing Python itself. If you've installed Python yourself and then installed libffi, try reinstalling Python. It will even write in the terminal what "optional" modules it builds, and here _ctypes should be among them.

Oh and if the Python configure script has a hard time finding libffi, supply --with-system-ffi as well as adding the libffi include directory to CPPFLAGS , and the libffi lib directory to LDFLAGS and LD_LIBRARY_PATH , eg

export CPPFLAGS="-I/path/to/libffi/include ${CPPFLAGS}"
export LDFLAGS="-L/path/to/libffi/lib -Wl,-rpath=/path/to/libffi/lib ${LDFLAGS}"
export LD_LIBRARY_PATH="/path/to/libffi/lib:${LD_LIBRARY_PATH}"
 ./configure --with-system-ffi ...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM