OpenCV installation failure on windows - python

Hi I am trying to install opencv on windows. I am using python version 3.7.3. I have tried the installation tutorials using pip, conda and also followed steps outlined in the documentation:https://www.learnopencv.com/install-opencv-4-on-windows/. But no success. I am getting the same error regardless of the approach.
Fetching package metadata ...
CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://conda.anaconda.org/a
naconda/win-64/repodata.json>
Elapsed: -
An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.
SSLError(MaxRetryError('HTTPSConnectionPool(host=\'repo.anaconda.com\', port=443): Max retries exceeded with url: /pkgs/main/win-64/current_repodata.json (Caused by SSLError(SSLError("bad handshake: Error([(\'SSL routines\', \'tls_process_server_certificate\', \'certificate verify failed\')])")))'))
ERROR: Could not find a version that satisfies the requirements dlib(from versions:none)
ERROR: No matching distribution found for dlib
any suggestions on how to solve this issue.

Looks like Conda installer can't verify SSL certificate.
As a workaround you can use a common way of installing Python packages using pip in OS terminal if you already have Python and pip installed.
Packages for standard desktop environments (Windows, macOS, almost any GNU/Linux distribution)
run pip install opencv-python if you need only main modules
run pip install opencv-contrib-python if you need both main and contrib
modules (check extra modules listing from OpenCV documentation)

After trying number of solutions seen online, I was able to resolve the issue.
conda install opencv worked for me. If anyone gets the same issue, refer to this document for reference. It worked for me and hopefully it works for you as well. The link to the document is: http://mathalope.co.uk/2015/05/07/opencv-python-how-to-install-opencv-python-package-to-anaconda-windows/

Its seems your network is not allowing you to access data from command line, we often see these types of issues when we are using office closed network.
In most cases when we disconnect our machines from office network (or take help from IT team to by pass closed network), pip install starts working.
Can you check if running " pip install pandas" also gives you same error, if so then its definitely network issue.

Related

Python: Showing unmet dependencies error and broken packages error despite not having any such packages

We were trying to run a shell script for installing prerequistes(install_prerequistes_onnx.sh) for OpenVINO Model Optimizer but we got the following error:
The Error
We tried resolving it using python 3.6.7 in a virtual environment(tsc). But it was of no use. Also we do not have any broken packages(we checked for them explicitly) but it still shows "unable to correct problems, you have held broken packages".
Can anyone explain the last three lines of the error? Also what does "error in line 78" imply, since our notebook was running fine before incorporating OpenVINO.
PS: We are using Ubuntu 18.04.
Please ensure that you’ve installed external software dependencies.
You may refer to this link for the installation:
https://docs.openvinotoolkit.org/2021.3/openvino_docs_install_guides_installing_openvino_linux.html#install-external-dependencies
For your virtual environment, the broken packages error that you’re facing is due to the Python’s dependency package version is not available on your system.
Try with this command: sudo apt update && sudo apt upgrade
If the issue still persists, you may need to re-install Python.

Overcome SSL error while downloading NLTK data, but inside a virtual environment on macOS with Homebrew-installed Python

I've pip-installed NLTK, and am trying to download corpora with nltk.download(). The GUI pops up, but then I get this error, as shown below:
[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)
There are several questions and answers about this generally, but none of them appear to help if you're running a Python other than the one shipped on python.org. In my case, I'm running a Python 3.6 that I installed through Homebrew, and that inside a virtual environment (using pipenv, if that's relevant). As a result, I do not have any version of Python that comes with the Install Certificates.command script mentioned in other answers.
This code will eventually run in production, so disabling SSL certificate checking is unacceptable.
Now to the question: Given this setup, what is the right way, reproducibly (i.e., on fresh machines) and without ugly hacks, to overcome this SSL error and download NLTK corpora?

How can I avoid this strange "Could not fetch URL" error when doing any pip install

Using python 2.7. Was working fine for months but all of a sudden i start getting this weird error when i try and do pip installs outside of or within a virtualenv. If i do something like this:
pip install pandas
I am told:
Could not fetch URL https://pypi.python.org/simple/pandas/: There was a problem confirming the ssl certificate: EOF occurred in violation of protocol (_ssl.c:590) - skipping
Could not find a version that satisfies the requirement pandas (from versions: )
No matching distribution found for pandas
This occurs for just about any pip library and it is infuriating. I tried updating my pip and it said it was up to date. I read somewhere i should try and update my virtualenv which I did with:
pip install --upgrade virtualenv
But it gave the same error. So enraging haha.
As a temporary fix, you could fetch the appropriate .whl for your system from
this link and install it using
pip install some-package.whl
Otherwise, you should check the top anwser from here which seems to have fixed the problem when having trouble with ssl.

Unable to get tensorflow working on Mac OSX

I am trying to get tensor flow on my Mac OS X Yosemite. I tried it in a number of ways, all of which result in an error.
Method #1: using virtualenv. When I get to the
pip install https://storage.googleapis.com/tensorflow/mac/tensorflow-0.5.0-py2-none-any.whl
I get
BadZipFile: File is not a zip file
Method #2: using Anaconda. Again, when within the anaconda environment I do
pip install --upgrade https://storage.googleapis.com/tensorflow/mac/tensorflow-0.6.0-py2-none-any.whl
I get an error, although a different one this time:
SLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)
Method #3: using bazel. Numerous dependency issues - e.g.,
bazel build -c opt //tensorflow/tools/pip_package:build_pip_package
... no such package '#jpeg_archive// ...
... no such package '#png_archive// ...
etc.
Has anyone been able to successfully build tensorflow on a mac (that's sitting behind a corporate firewall, btw - maybe that's part of the problem). Any insight would be much appreciated.
Thanks!
Natalia
Did you try removing secure to http, something like sudo pip install --upgrade http://... instead (and also, you should try checking pip version too)

Windows 8.1, Python(x,y) 2.7.6.0: "python easy_install" fails with SSL certificate error

On Windows 8.1, with Python(x,y) 2.7.6.0: "python easy_install" fails with SSL certificate error:
*******************************
Searching for behave
Reading https://pypi.python.org/simple/behave/
Scanning index of all packages (this may take a while)
Reading https://pypi.python.org/simple/
easy_install : Download error on https://pypi.python.org/simple/behave/: [Errno 1] _ssl.c:507: error:14090086:SSL
routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed -- Some packages may not be found!
Couldn't find index page for 'behave' (maybe misspelled?)
Download error on https://pypi.python.org/simple/: [Errno 1] _ssl.c:507: error:14090086:SSL
routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed -- Some packages may not be found!
No local packages or download links found for behave
error: Could not find suitable distribution for Requirement.parse('behave')
*******************************
Obviously the SSL connection is broken. Of course normal Internet access by browser works fine, plus in-house Windows network.
By Internet research I did not find any clue, e.g. some other users got the same error recently:
python easy_install fails with SSL certificate error for all packages
But I don't see that any working advice was given or found. Some other advisers asked to install a legacy edition of pip: pip issue installing almost any library But I am unsure how to do it ( as usually installation of pip requires working easy_install ), and it does not help to solve the SSL-broken problem in general.
On the other hand, with the Python Anaconda 1.9.1 distribution shipping Python 2.7.6, easy_install behave works fine, on the SAME computer, while other older Python(x,y) 2.7.5.x distributions fail the same way as 2.7.6.0. On another Win7 computer, with Python (x,y) 2.7.6.0, the SSL connection works, i.e. I may process pypi download successfully, e.g. easy_install behave works.
So it looks as if something with my Win8.1 is broken. Something with SSL?! A common solution for the last 20 years was "Just reinstall Windows and all its applications" :-(.
I am just unsure to re-install Windows from scratch, as this is so much effort and the success is not guaranteed.
As I need a working installation of QT-for-Python, I would like to use Python(x,y) now, and in general, I would like to have a working non-commercial opensource edition of Python on my computer. I know that on Windows, that the Highlander principle applies: There can be only one! - So I just may have ONE Python distribution installed, at a time. I did, i.e. I always deinstalled old Python runtimes and/or Python(x,y) or Anaconda.
So any help is appreciated.

Categories

Resources