OpenCV को स्थापित करना विफल हो जाता है क्योंकि यह "स्किल्ड" नहीं खोज सकता है

Aug 17 2020

मेरी एक डॉकटर छवि है जिसे मुझे इसमें ओपन सीसीवी स्थापित करने की आवश्यकता है और कल से यह विफल होना शुरू हो गया क्योंकि यह "स्किवंट" मॉड्यूल नहीं पा सकता है:

Step 12/24 : RUN pip install opencv-python opencv-contrib-python
 ---> Running in a0f746a23aed
Collecting opencv-python
  Downloading https://files.pythonhosted.org/packages/77/f5/49f034f8d109efcf9b7e98fbc051878b83b2f02a1c73f92bbd37f317288e/opencv-python-4.4.0.42.tar.gz (88.9MB)
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-cciracwm/opencv-python/setup.py", line 9, in <module>
        import skbuild
    ModuleNotFoundError: No module named 'skbuild'

और होस्ट पर भी मुझे वह मॉड्यूल नहीं मिल रहा है और pip searchया तो कुछ भी नहीं लौटा रहा है या सर्वर त्रुटि देता है:

sudo pip3 search skbuild
WARNING: The directory '/home/ali/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
ERROR: Exception:
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/pip/_internal/cli/base_command.py", line 216, in _main
    status = self.run(options, args)
  File "/usr/local/lib/python3.6/dist-packages/pip/_internal/commands/search.py", line 60, in run
    pypi_hits = self.search(query, options)
  File "/usr/local/lib/python3.6/dist-packages/pip/_internal/commands/search.py", line 80, in search
    hits = pypi.search({'name': query, 'summary': query}, 'or')
  File "/usr/lib/python3.6/xmlrpc/client.py", line 1112, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib/python3.6/xmlrpc/client.py", line 1452, in __request
    verbose=self.__verbose
  File "/usr/local/lib/python3.6/dist-packages/pip/_internal/network/xmlrpc.py", line 45, in request
    return self.parse_response(response.raw)
  File "/usr/lib/python3.6/xmlrpc/client.py", line 1342, in parse_response
    return u.close()
  File "/usr/lib/python3.6/xmlrpc/client.py", line 656, in close
    raise Fault(**self._stack[0])
xmlrpc.client.Fault: <Fault -32403: 'server error; service unavailable'>

क्या यह इसलिए है क्योंकि उनके सर्वर में कुछ समस्याएं हैं या यह मेरे पाइप से संबंधित है?

अपडेट करें

मैंने इसे अलग-अलग अजगर और पाइप संस्करणों, अजगर संस्करणों 3.6 और 3.7 और पाइप संस्करण 19.12 और 20.2.2 और 9.0.1 (एक अंदर की छवि) पर आजमाया।

अपडेट २

मैंने pip install scikit-buildopencv स्थापना से पहले एक कदम जोड़ा था लेकिन मुझे cmake से संबंधित एक और त्रुटि मिली:

Step 12/25 : RUN pip install scikit-build
 ---> Running in afe0c5c0fca0
Collecting scikit-build
  Downloading https://files.pythonhosted.org/packages/78/c9/7c2c7397ea64e36ebb292446896edcdecbb8c1aa6b9a1a32f6f67984c3df/scikit_build-0.11.1-py2.py3-none-any.whl (72kB)
Collecting packaging (from scikit-build)
  Downloading https://files.pythonhosted.org/packages/46/19/c5ab91b1b05cfe63cccd5cfc971db9214c6dd6ced54e33c30d5af1d2bc43/packaging-20.4-py2.py3-none-any.whl
Requirement already satisfied: wheel>=0.29.0 in /usr/lib/python3/dist-packages (from scikit-build)
Collecting distro (from scikit-build)
  Downloading https://files.pythonhosted.org/packages/25/b7/b3c4270a11414cb22c6352ebc7a83aaa3712043be29daa05018fd5a5c956/distro-1.5.0-py2.py3-none-any.whl
Requirement already satisfied: setuptools>=28.0.0; python_version >= "3" in /usr/lib/python3/dist-packages (from scikit-build)
Requirement already satisfied: six in /usr/lib/python3/dist-packages (from packaging->scikit-build)
Collecting pyparsing>=2.0.2 (from packaging->scikit-build)
  Downloading https://files.pythonhosted.org/packages/8a/bb/488841f56197b13700afd5658fc279a2025a39e22449b7cf29864669b15d/pyparsing-2.4.7-py2.py3-none-any.whl (67kB)
Installing collected packages: pyparsing, packaging, distro, scikit-build
Successfully installed distro-1.5.0 packaging-20.4 pyparsing-2.4.7 scikit-build-0.11.1
Removing intermediate container afe0c5c0fca0
 ---> 533658ddf26d
Step 13/25 : RUN pip install opencv-python opencv-contrib-python
 ---> Running in 0f2c03bc042a
Collecting opencv-python
  Downloading https://files.pythonhosted.org/packages/77/f5/49f034f8d109efcf9b7e98fbc051878b83b2f02a1c73f92bbd37f317288e/opencv-python-4.4.0.42.tar.gz (88.9MB)
Collecting opencv-contrib-python
  Downloading https://files.pythonhosted.org/packages/48/98/05bd8e00c71b66c4e7847cc051cac404191d904df58b51a7dcc3767ff747/opencv_contrib_python-4.2.0.34-cp37-cp37m-manylinux1_x86_64.whl (34.2MB)
Collecting numpy>=1.14.5 (from opencv-python)
  Downloading https://files.pythonhosted.org/packages/3d/d1/90cd7e0b27ee86d77f5386d38b74520486100286d50772377791b6ef22ff/numpy-1.19.1-cp37-cp37m-manylinux1_x86_64.whl (13.4MB)
Building wheels for collected packages: opencv-python
  Running setup.py bdist_wheel for opencv-python: started
  Running setup.py bdist_wheel for opencv-python: finished with status 'error'
  Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-w49xv99a/opencv-python/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmpycj03zlwpip-wheel- --python-tag cp37:
  /usr/lib/python3.7/distutils/dist.py:274: UserWarning: Unknown distribution option: 'long_description_content_type'
    warnings.warn(msg)
  Traceback (most recent call last):
    File "/usr/local/lib/python3.7/dist-packages/skbuild/setuptools_wrap.py", line 560, in setup
      cmkr = cmaker.CMaker(cmake_executable)
    File "/usr/local/lib/python3.7/dist-packages/skbuild/cmaker.py", line 95, in __init__
      self.cmake_version = get_cmake_version(self.cmake_executable)
    File "/usr/local/lib/python3.7/dist-packages/skbuild/cmaker.py", line 82, in get_cmake_version
      "Problem with the CMake installation, aborting build. CMake executable is %s" % cmake_executable)
  
  Problem with the CMake installation, aborting build. CMake executable is cmake
  
  ----------------------------------------
  Failed building wheel for opencv-python
  Running setup.py clean for opencv-python
Failed to build opencv-python
Installing collected packages: numpy, opencv-python, opencv-contrib-python
  Found existing installation: numpy 1.13.3
    Not uninstalling numpy at /usr/lib/python3/dist-packages, outside environment /usr
  Running setup.py install for opencv-python: started
    Running setup.py install for opencv-python: finished with status 'error'
    Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-w49xv99a/opencv-python/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-maky1uyw-record/install-record.txt --single-version-externally-managed --compile:
    /usr/lib/python3.7/distutils/dist.py:274: UserWarning: Unknown distribution option: 'long_description_content_type'
      warnings.warn(msg)
    Traceback (most recent call last):
      File "/usr/local/lib/python3.7/dist-packages/skbuild/setuptools_wrap.py", line 560, in setup
        cmkr = cmaker.CMaker(cmake_executable)
      File "/usr/local/lib/python3.7/dist-packages/skbuild/cmaker.py", line 95, in __init__
        self.cmake_version = get_cmake_version(self.cmake_executable)
      File "/usr/local/lib/python3.7/dist-packages/skbuild/cmaker.py", line 82, in get_cmake_version
        "Problem with the CMake installation, aborting build. CMake executable is %s" % cmake_executable)
    
    Problem with the CMake installation, aborting build. CMake executable is cmake

जवाब

35 skvark Aug 17 2020 at 19:44

यदि आप opencv-python PyPI में पैकेज FAQ को पढ़ते हैं , तो यह स्पष्ट रूप से इस विशिष्ट मुद्दे के लिए एक उत्तर प्रदान करता है: आपको अवश्य चलना चाहिए pip install --upgrade pippipबाद में संस्करण की जाँच करें pip -V

ऐसा इसलिए है क्योंकि आपका pipनया manylinux2014पैकेज प्रारूप समझने के लिए बहुत पुराना है और स्रोत से संकलन करने का प्रयास करता है। यह भी विफल हो जाएगा क्योंकि pipयह समझने के लिए बहुत पुराना है कि pyproject.tomlबिल्ड निर्भरता जैसे कि कैसे स्थापित करें scikit-build

एक और मुद्दा जो मैं देख रहा हूं वह यह है कि आप दोनों को स्थापित करते हैं opencv-pythonऔर opencv-contrib-python। आपको ऐसा नहीं करना चाहिए। इसे संकुल के PyPI पृष्ठ में भी समझाया गया है। सबसे अधिक संभावना है कि आप सिर्फ opencv-contrib-python-headlessपैकेज का उपयोग कर रहे होंगे जब से आप डॉकर का उपयोग कर रहे हैं और मुझे लगता है कि आप ओपनसीवी के जीयूआई कार्यों का उपयोग नहीं करते हैं।

6 JimitVaghela Aug 17 2020 at 11:32

skbuild स्किट-बिल्ड के लिए है।

पाइप का उपयोग करके इसे स्थापित करें:

खिड़कियों के लिए के रूप में: pip install scikit-build

सक्सेसफुल इंस्टालेशन के बाद:

pip install cmake