1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

pyenv上でpip3 install --upgrade tensorflow時にエラー(ModuleNotFoundError: No module named '_ctypes')

Posted at

pyenv上で、pip3 install --upgrade tensorflow時にエラー(ModuleNotFoundError: No module named '_ctypes')

$ pip3 install --upgrade tensorflow
Collecting tensorflow
  Using cached tensorflow-2.5.0-cp39-cp39-manylinux2010_x86_64.whl (454.4 MB)
Collecting tensorflow-estimator<2.6.0,>=2.5.0rc0
  Using cached tensorflow_estimator-2.5.0-py2.py3-none-any.whl (462 kB)
Collecting protobuf>=3.9.2
  Using cached protobuf-3.17.3-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl (1.0 MB)
Collecting flatbuffers~=1.12.0
  Downloading flatbuffers-1.12-py2.py3-none-any.whl (15 kB)
Collecting gast==0.4.0
  Using cached gast-0.4.0-py3-none-any.whl (9.8 kB)
Collecting wrapt~=1.12.1
  Using cached wrapt-1.12.1.tar.gz (27 kB)
    ERROR: Command errored out with exit status 1:
     command: /home/ubuntu/.pyenv/versions/3.9.1/envs/sue-robo_env/bin/python3.9 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-1_kqqf4q/wrapt_e6e7652d6e884566bcac4d205c9669f4/setup.py'"'"'; __file__='"'"'/tmp/pip-install-1_kqqf4q/wrapt_e6e7652d6e884566bcac4d205c9669f4/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-utc7m761
         cwd: /tmp/pip-install-1_kqqf4q/wrapt_e6e7652d6e884566bcac4d205c9669f4/
    Complete output (11 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/home/ubuntu/.pyenv/versions/3.9.1/envs/sue-robo_env/lib/python3.9/site-packages/setuptools/__init__.py", line 23, in <module>
        from setuptools.dist import Distribution
      File "/home/ubuntu/.pyenv/versions/3.9.1/envs/sue-robo_env/lib/python3.9/site-packages/setuptools/dist.py", line 34, in <module>
        from setuptools import windows_support
      File "/home/ubuntu/.pyenv/versions/3.9.1/envs/sue-robo_env/lib/python3.9/site-packages/setuptools/windows_support.py", line 2, in <module>
        import ctypes
      File "/home/ubuntu/.pyenv/versions/3.9.1/lib/python3.9/ctypes/__init__.py", line 8, in <module>
        from _ctypes import Union, Structure, Array
    ModuleNotFoundError: No module named '_ctypes'
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/82/f7/e43cefbe88c5fd371f4cf0cf5eb3feccd07515af9fd6cf7dbf1d1793a797/wrapt-1.12.1.tar.gz#sha256=b62ffa81fb85f4332a4f609cab4ac40709470da05643a082ec1eb88e6d9b97d7 (from https://pypi.org/simple/wrapt/). 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 wrapt~=1.12.1 (from tensorflow) (from versions: 1.0.0, 1.1.0, 1.1.1, 1.1.2, 1.1.3, 1.1.4, 1.2.0, 1.2.1, 1.3.0, 1.3.1, 1.4.0, 1.4.1, 1.4.2, 1.5.0, 1.5.1, 1.6.0, 1.7.0, 1.8.0, 1.9.0, 1.10.0, 1.10.1, 1.10.2, 1.10.4, 1.10.5, 1.10.6, 1.10.7, 1.10.8, 1.10.9, 1.10.10, 1.10.11, 1.11.0, 1.11.1, 1.11.2, 1.12.0, 1.12.1)
ERROR: No matching distribution found for wrapt~=1.12.1

以下によりライブラリインストール、pyenvで該当するpythonバージョンを再インストールして解決

sudo apt-get install libffi-dev 
pyenv install 3.9.1

参考

https://github.com/pyenv/pyenv/wiki/common-build-problems
https://teratail.com/questions/174992
https://stackoverflow.com/questions/45577194/failed-to-activate-virtualenv-with-pyenv/45578839
https://teratail.com/questions/88209
https://stackoverflow.com/questions/56418874/cant-install-pyqt5-using-pip
https://qiita.com/Uejun/items/6d19c141707751e7f111

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?