Got an error while installing opencv-python

0 votes

I am using python 2.7.18

I want to install opencv-python using command prompt but it is showing me the error as follows:

I am using command as follows:

C:\Python27>python -m pip install opencv-python

It is showing me error as follows:

DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Collecting opencv-python
  Using cached opencv-python-4.3.0.38.tar.gz (88.0 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  ERROR: Command errored out with exit status 1:
   command: 'C:\Python27\python.exe' 'C:\Python27\lib\site-packages\pip\_vendor\pep517\_in_process.py' get_requires_for_build_wheel 'c:\users\nisha\appdata\local\temp\tmpyicvra'
       cwd: c:\users\nisha\appdata\local\temp\pip-install-6hcuqj\opencv-python
  Complete output (22 lines):
  Traceback (most recent call last):
    File "C:\Python27\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 280, in <module>
      main()
    File "C:\Python27\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 263, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "C:\Python27\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 114, in get_requires_for_build_wheel
      return hook(config_settings)
    File "c:\users\nisha\appdata\local\temp\pip-build-env-cqi62z\overlay\Lib\site-packages\setuptools\build_meta.py", line 146, in get_requires_for_build_wheel
      return self._get_build_requires(config_settings, requirements=['wheel'])
    File "c:\users\nisha\appdata\local\temp\pip-build-env-cqi62z\overlay\Lib\site-packages\setuptools\build_meta.py", line 127, in _get_build_requires
      self.run_setup()
    File "c:\users\nisha\appdata\local\temp\pip-build-env-cqi62z\overlay\Lib\site-packages\setuptools\build_meta.py", line 243, in run_setup
      self).run_setup(setup_script=setup_script)
    File "c:\users\nisha\appdata\local\temp\pip-build-env-cqi62z\overlay\Lib\site-packages\setuptools\build_meta.py", line 142, in run_setup
      exec(compile(code, __file__, 'exec'), locals())
    File "setup.py", line 448, in <module>
      main()
    File "setup.py", line 99, in main
      % {"ext": re.escape(sysconfig.get_config_var("EXT_SUFFIX"))}
    File "C:\Python27\lib\re.py", line 210, in escape
      s = list(pattern)
  TypeError: 'NoneType' object is not iterable
  ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Python27\python.exe' 'C:\Python27\lib\site-packages\pip\_vendor\pep517\_in_process.py' get_requires_for_build_wheel 'c:\users\nisha\appdata\local\temp\tmpyicvra' Check the logs for full command output.

Can anyone please help me to solve this error.

Thanking You...




Sep 17, 2020 in Python by Nishant
• 120 points
10,760 views

1 answer to this question.

0 votes

Hello @Nishant,

The error you got itself suggest to upgrade your Python vesion.

Use this commad:

python -m pip install --upgrade pip 

Try this

    answered Sep 17, 2020 by Niroj
    • 82,840 points

    I'm having upgraded version of pip 20.2.3

    Still I have executed command which you have suggested and it showing me output as follows:

    Command:

    C:\Python27>python -m pip install --upgrade pip

    Output:

    DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
    Requirement already up-to-date: pip in c:\python27\lib\site-packages (20.2.3)

    After this again I tried to install opencv using same command as follows:

    C:\Python27>python -m pip install opencv-python

    But again I have encountered an error as follows:

    DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
    Collecting opencv-python
      Using cached opencv-python-4.3.0.38.tar.gz (88.0 MB)
      Installing build dependencies ... done
      Getting requirements to build wheel ... error
      ERROR: Command errored out with exit status 1:
       command: 'C:\Python27\python.exe' 'C:\Python27\lib\site-packages\pip\_vendor\pep517\_in_process.py' get_requires_for_build_wheel 'c:\users\nisha\appdata\local\temp\tmp_oeqic'
           cwd: c:\users\nisha\appdata\local\temp\pip-install-qwjkcd\opencv-python
      Complete output (22 lines):
      Traceback (most recent call last):
        File "C:\Python27\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 280, in <module>
          main()
        File "C:\Python27\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 263, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "C:\Python27\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 114, in get_requires_for_build_wheel
          return hook(config_settings)
        File "c:\users\nisha\appdata\local\temp\pip-build-env-vqpyq4\overlay\Lib\site-packages\setuptools\build_meta.py", line 146, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
        File "c:\users\nisha\appdata\local\temp\pip-build-env-vqpyq4\overlay\Lib\site-packages\setuptools\build_meta.py", line 127, in _get_build_requires
          self.run_setup()
        File "c:\users\nisha\appdata\local\temp\pip-build-env-vqpyq4\overlay\Lib\site-packages\setuptools\build_meta.py", line 243, in run_setup
          self).run_setup(setup_script=setup_script)
        File "c:\users\nisha\appdata\local\temp\pip-build-env-vqpyq4\overlay\Lib\site-packages\setuptools\build_meta.py", line 142, in run_setup
          exec(compile(code, __file__, 'exec'), locals())
        File "setup.py", line 448, in <module>
          main()
        File "setup.py", line 99, in main
          % {"ext": re.escape(sysconfig.get_config_var("EXT_SUFFIX"))}
        File "C:\Python27\lib\re.py", line 210, in escape
          s = list(pattern)
      TypeError: 'NoneType' object is not iterable
      ----------------------------------------
    ERROR: Command errored out with exit status 1: 'C:\Python27\python.exe' 'C:\Python27\lib\site-packages\pip\_vendor\pep517\_in_process.py' get_requires_for_build_wheel 'c:\users\nisha\appdata\local\temp\tmp_oeqic' Check the logs for full command output.
    
    
    
    
    

    Hello @ Nishant,

    Use python version 3.6 open CV is compatible with that.

    Related Questions In Python

    0 votes
    1 answer

    How to resolve the error while importing cv2 from openCV in python?

    I would recommend you go with anaconda ...READ MORE

    answered Jul 31, 2019 in Python by Mohammad
    • 3,230 points
    1,987 views
    0 votes
    1 answer
    0 votes
    1 answer

    i am getting an error on pycharm while installing packages

    Hi, @There, $ pip install gevent --pre $ pip ...READ MORE

    answered Oct 27, 2020 in Python by Gitika
    • 65,770 points
    2,455 views
    +2 votes
    2 answers

    Error while printing hello world in python.

    You must be trying this command in ...READ MORE

    answered Mar 31, 2018 in Python by GandalfDwhite
    • 1,320 points
    6,402 views
    0 votes
    2 answers
    +1 vote
    2 answers

    how can i count the items in a list?

    Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

    answered Jul 7, 2019 in Python by Neha
    • 330 points

    edited Jul 8, 2019 by Kalgi 4,434 views
    0 votes
    1 answer
    0 votes
    1 answer

    How to reimport an updated package while in Python Interpreter?

    Hello, To import an updated package while in ...READ MORE

    answered May 12, 2020 in Python by Niroj
    • 82,840 points
    2,541 views
    0 votes
    1 answer

    Error:mysql_config not found when installing mysqldb python interface

    Hello @kartik, MySQLdb is a python interface for ...READ MORE

    answered May 27, 2020 in Python by Niroj
    • 82,840 points
    14,713 views
    webinar REGISTER FOR FREE WEBINAR X
    REGISTER NOW
    webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP