Skip to main content

pip로 docker-compose 설치 오류

  1. 환경정보
    • os : centos7
    • pip : pip2 / pip3
  2. 작업사항
    • pip2가 설치되어 있는 서버에서 새로운 pip를 올리려고 했더니 python3에서 사용해야 한다함
    • pip 커맨드가 pip2로 심볼릭 링크 걸려있는 상태에서 pip3로 교체
      $> ls -l pip
      /usr/bin/pip -> /usr/bin/pip2
      $> ln -snf /usr/bin/pip3 /usr/bin/pip
      $> pip -V
      pip 21.0.1 from /usr/local/lib/python3.6/site-packages/pip (python 3.6)
  3. pip를 통해 docker-compose 설치

    $ pip instal docker-compose
    ...
    Collecting cryptography>=2.5 (from paramiko>=2.4.2; extra == "ssh"->docker[ssh]<5,>=4.4.3->docker-compose)
       Downloading http://python.org/pypi/+f/2d3/2223e5b0ee029/cryptography-3.4.6.tar.gz (546kB)
        100% |████████████████████████████████| 552kB 43.7MB/s
         Complete output from command python setup.py egg_info:
         WARNING: The wheel package is not available.
         ERROR: 'pip wheel' requires the 'wheel' package. To fix this, run: pip install wheel
         Traceback (most recent call last):
           File "/usr/local/lib/python3.6/site-packages/setuptools/installer.py", line 75, in fetch_build_egg
             subprocess.check_call(cmd)
           File "/usr/lib64/python3.6/subprocess.py", line 311, in check_call
             raise CalledProcessError(retcode, cmd)
         subprocess.CalledProcessError: Command '['/usr/bin/python3', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmpn5ys3xpr', '--quiet', 'cffi>=1.12']' returned non-zero exit status 1.
     The above exception was the direct cause of the following exception: Traceback (most recent call last):   File "<string>", line 1, in <module>   File "/tmp/pip-build-0pwkcfz1/cryptography/setup.py", line 152, in <module>     rust_extensions=rust_extensions,   File "/usr/local/lib/python3.6/site-packages/setuptools/__init__.py", line 152, in setup     _install_setup_requires(attrs)   File "/usr/local/lib/python3.6/site-packages/setuptools/__init__.py", line 147, in _install_setup_requires     dist.fetch_build_eggs(dist.setup_requires)   File "/usr/local/lib/python3.6/site-packages/setuptools/dist.py", line 689, in fetch_build_eggs     replace_conflicting=True,   File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 768, in resolve     replace_conflicting=replace_conflicting   File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1051, in best_match     return self.obtain(req, installer)   File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1063, in obtain     return installer(requirement)   File "/usr/local/lib/python3.6/site-packages/setuptools/dist.py", line 745, in fetch_build_egg     return fetch_build_egg(self, req)   File "/usr/local/lib/python3.6/site-packages/setuptools/installer.py", line 77, in fetch_build_egg     raise DistutilsError(str(e)) from e distutils.errors.DistutilsError: Command '['/usr/bin/python3', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmpn5ys3xpr', '--quiet', 'cffi>=1.12']' returned non-zero exit status 1.     =============================DEBUG ASSISTANCE=============================     If you are seeing a compilation error please try the following steps to     successfully install cryptography:     1) Upgrade to the latest pip and try again. This will fix errors for most        users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip     2) Read https://cryptography.io/en/latest/installation.html for specific        instructions for your platform.     3) Check our frequently asked questions for more information:        https://cryptography.io/en/latest/faq.html     4) Ensure you have a recent Rust toolchain installed:        https://cryptography.io/en/latest/installation.html#rust     5) If you are experiencing issues with Rust for *this release only* you may        set the environment variable `CRYPTOGRAPHY_DONT_BUILD_RUST=1`.     =============================DEBUG ASSISTANCE============================= ---------------------------------------- Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-0pwkcfz1/cryptography/
    • 하지만 에러…????


  4. 발생원인
    • pip모듈을 2버전에서 3버전으로 단순히 심볼릭 링크만 바꾸었던게 문제인듯…
    • python모듈이 2버전으로 설치가 되어 있었을텐데….. 그래서 python3용으로 패키지 강제 재설치


  5. 추가작업
    $ pip install --upgrade setuptools pip --ignore-installed
     WARNING: Running pip install with root privileges is generally not a good idea. Try pip install --user instead. Collecting setuptools Downloading http://python.org/pypi/+f/0e8/6620d658c5ca8/setuptools-53.0.0-py3-none-any.whl (784kB) 100% |████████████████████████████████| 788kB 58.3MB/s Collecting pip Downloading http://python.org/pypi/+f/37f/d50e056e2aed6/pip-21.0.1-py3-none-any.whl (1.5MB) 100% |████████████████████████████████| 1.5MB 36.2MB/s Installing collected packages: setuptools, pip
  6. 다시 docker-compose 설치
    $ pip install docker-compose
     WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
     Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
     To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
     Looking in indexes: http://python.org/pypi/simple/
     Collecting docker-compose
    ...
    Successfully installed PyYAML-5.4.1 attrs-20.3.0 bcrypt-3.2.0 cached-property-1.5.2 certifi-2020.12.5 cffi-1.14.5 chardet-4.0.0 cryptography-3.4.6 distro-1.5.0 docker-4.4.3 docker-compose-1.28.4 dockerpty-0.4.1 docopt-0.6.2 idna-2.10 importlib-metadata-3.6.0 jsonschema-3.2.0 paramiko-2.7.2 pycparser-2.20 pynacl-1.4.0 pyrsistent-0.17.3 python-dotenv-0.15.0 requests-2.25.1 six-1.15.0 texttable-1.6.3 typing-extensions-3.7.4.3 urllib3-1.26.3 websocket-client-0.57.0 zipp-3.4.0
  7. 설치 완료!
    $ pip list| grep docker
     docker             4.4.3
     docker-compose     1.28.4
     dockerpty          0.4.1