ERROR in install opencv in my python 3.6.6 - python-3.x

I HAVE PYTHON 3.6.6 INSTALLED IN MY WINDOWS 7 PLATFORM BUT WHEN I TRIED TO INSTALL OPENCV PACKAGE IT SAYS REQUIREMENT ALREADY SATISFIED AND IF I TRY TO IMPORT CV2 IT SAYS NO MODULE .I'VE TRIED ALL POSSIBLE METHODS ON INTERNET WHAT SHOULD I DO
i tried to download opencv exe from sourceforge and copying cv2.pyd file and then pasting it in site packages
i tried pip install opencv_python-4.0.1-cp37-cp37m-win_amd64.whl
but nothing works

The error message says that you are asking PIP install a version of cv2 for 64-bit Python 2.7, and that installation is failing. So the installation is not happening because it's the wrong version. That might be because you don't have Python 2.7, or because you have a 32-bit processor, or both. Navigate to Python36\Scripts and issue the command pip install opencv_python. Then pip will find the appropriate file to download, and install it.

Related

Installing Spacy is failing with Python 3.7 on Windows 10

Installing Spacy on Windows 10 with pip is failing. Installing any other of a number of modules is working fine for me.
Here is a pastebin containing the error message:
pip install -U spacy
or
python -m pip install spacy
output:
https://pastebin.com/Y9np4veN
I have tried this both with and without virtualenv and it is failing in the same manner either way. I have also already tried installing and updating setuptools. I've ensured that I am using Python 3.7 and pip3. There is no other version of python or pip installed on my PC.
I downgraded to Python 3.6 and was able to successfully install spacy
Using x86-64 ("64-bit") version of Python 3.7 (3.7.4) instead of x86 ("32-bit") one on Windows fixed the issue for me.

Error while installing psycopg2 in Windows

I tried to install psycopg2 as:
pip install psycopg2
It was giving error for pg_config. I checked some stackoverflow notes and installed PostgreSQL. Added the path of pg_config in $PATH.
Now it is giving the below error:
LINK : fatal error LNK1181: cannot open input file 'libpq.lib'
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC\\Tools\\MSVC\\14.14.26428\\bin\\HostX86\\x64\\link.exe' failed with exit status 1181
Any help on this?
Have you tried reinstall without pip?
sudo apt-get install python3-psycopg2
EDIT: Since you're on windows:
You can try this if you're using python 2.7:
pip uninstall psycopg2
pip install git+https://github.com/nwcell/psycopg2-windows.git#win64-py27#egg=psycopg2
If you're using python 3.4:
pip uninstall psycopg2
pip install git+https://github.com/nwcell/psycopg2-windows.git#win64-py34#egg=psycopg2
More info here.
If you prefer, you can download the installer (.exe) and install it.
You can find it here.
I found the issue.... I was using Python 3.7 version. Looks like the latest stable version of psycopg2 (2.7.4) is not yet supported on Python 3.7. It is supported till 3.6
I downgraded my python to 3.6.5 in Anaconda and also to 2.7.15 through PyCharm. I was able to install psycopg2 in both and use them.
Go to https://pypi.org/project/psycopg2
in release history and select the version you want to download.
There will be a table with files and the versions of python that can be compatible with the selected version.
Now download the wheel file that matches your system configuration(mac/linux/win-32/win-64)
I did this and was able to download the package.
For windows10(64-bit), download psycopg2-2.7.7-cp36-cp36m-win_amd64.whl (998.5 kB), in case you have selected 2.7.7
For Windows users, to install the psycopg2 without any errors first install Python 3.7.4 version and then install psycopg2 using command pip install psycopg2 as it worked complete fine with me. I think there is some issue in Python 3.8.0 version onwards because while installing psycopg it is showing an error in setup wheels.
In case you are here in 2020, this is a problem with version 3.8 of python. I had the issue recently. Try using virtualenv so that you can use lower versions of python in your workspace until psycopg2 is supported fully on Python version 3.8

import ortools in mac

I am trying to run some code using ortools on a python environment. I did not have troubles on a windows machine but I am having problems on mac (10.12.6). if in my virtual environment I run
pip freeze
or
conda list
ortools appears in my list of installed packages. But if I try to use it
ipython
from ortools.linear_solver import pywrapplp
I get an error saying that there's no module named ortools. If I go to
mac/anaconda3/envs/nameenv/lib/python3.6/site-packages I do have a folder called ortools with some python files including pywrapplp. Do you know what I am doing wrong ?
EDIT
following request from coments:
import os
os.getcwd()
returns '/Users/imac'
which ipython
/anaconda3/bin/ipython
Installing ortools is a bit of a headache. It was some days ago, I think I finally made it with
easy_install ortools
I think it is a problem with the path. I guess because I did not install it with conda it does not find the package. I got around writting:
sys.path.append('/anaconda3/envs/env_name/lib/python3.6/site-packages/')
at the begining of my ipynb. That way I can run ortools.
You could have several python interpreter installed (python2 and python3)
So if you want to use it with ipython, which seems to be bind on python3 in your case.
First check if you have pypi package ortools installed
ipython -m pip show ortools
If you got an error it means the package is not installed.
so you can easily install it using:
ipython -m pip install --user ortools
note: We provide Pypi ortools package (64 bits) for Manylinux, Windows and MacOS.
You can also rebuild it from source https://developers.google.com/optimization/introduction/installing/source

PyQt5-5.8.2 doesn't function on Windows 10

I need to install qscintilla. I use pip for that:
> pip install qscintilla
PyQt5 automatically upgrades to the latest version '5.8.2', and sip upgrades to '4.19.2'. I suppose this has to do with the needs of qscintilla. Perhaps the latest version of qscintilla needs the latest PyQt version to operate properly.
Unfortunately, PyQt5-5.8.2 combined with sip-4.19.2 don't work on Windows 10. I get the following error:
> python
>>> import PyQt5.QtWidgets
ImportError: DLL load failed: The specified module could not be found.
I have checked my PATH variable in Windows 10, and I found the following directory: C:\Anaconda3\Library\bin. I've checked that folder, and the dll's are all present: Qt5Widgets.dll, 'Qt5Gui.dll`, ... So I can hardly believe that Python cannot find them.
I will now go through the things I've tried so far.
1. Clean install of Anaconda => upgrade PyQt5.
I've removed Python completely from my PC, and installed Anaconda from scratch: Python 3.6 for Windows 64-bit.
Anaconda is shipped with an older version of PyQt5. I check the version like this:
> python
>>> from PyQt5.QtCore import QT_VERSION_STR
>>> from PyQt5.Qt import PYQT_VERSION_STR
>>> from sip import SIP_VERSION_STR
>>>
>>> QT_VERSION_STR
>>> '5.6.2'
>>> PYQT_VERSION_STR
>>> '5.6'
>>> SIP_VERSION_STR
>>> '4.18'
I simply upgrade my PyQt version, because I know that the qscintilla installation would do that anyway. If the problem is present after upgrading PyQt (and before installing qscintilla), I can rule out possible problems caused by the qscintilla installation. So here we go:
> pip install pyqt5 --upgrade
Collecting pyqt5
...
Successfully installed pyqt5-5.8.2 sip-4.19.2
As I expected, the upgraded version of pyqt results in the error:
> python
>>> import PyQt5.QtWidgets
ImportError: DLL load failed: The specified module could not be found.
2. Install PyQt5-5.7.1 instead of PyQt5-5.8.2.
I've found a wheel file from PyQt5-5.7.1 on this page: https://pypi.python.org/pypi/PyQt5/5.7.1
I hope that qscintilla will work on this one too. After all, it is a quite recent version. But first, I want to find out if I get it installed properly, and if the error above has gone.
> pip uninstall PyQt5
> pip uninstall sip
>
> pip install C:\..\Downloads\PyQt5-5.7.1-5.7.1-cp34.cp35.cp36-none-win_amd64.whl --no-cache-dir
...
Successfully installed pyqt5-5.7.1 sip-4.19.2
Unfortunately, the error persists.
3. Answers from StackOverflow.
I've checked several posts on StackOverflow, but none of them helped me out.
This post is too old: PyQt5 : The DLL load failed : the specified module could not be found
This post gives a possible reason: "Probably it's because pyqt .pyd files are linked against python3.dll, and not python3.6 dll." DLL load failed when importing PyQt5 . The answer suggests that I should use an older version of PyQt5. I've tried that (see above), but it still fails. The answer also suggests to build PyQt5 from the source code. I've tried that as well, but the build process gets stuck..
Can anyone help me? Perhaps you have successfully built the latest PyQt5-5.8.2 version from source code into a wheel file? I would be so happy if you share that file.
The root issue for me was different versions of PyQt wheel (5.9) and pyqt windows distro (5.6 - the last precompiled version available).
I found matching 5.6 wheel, but it only supported Python 3.5.
So, I downgraded Python to 3.5 and installed PyQt5-5.6-cp35-none-win_amd64.whl
pip install pyqt5==5.6
works equally well.
I found a workaround: don't use Anaconda. I deleted Anaconda from my PC and did a fresh install like this:
1. Install Python 64-bit
Download the 64-bit installer for Windows from this URL: https://www.python.org/downloads/release/python-361/
Make sure to include pip when asked for the installation options!
2. Install PyQt5
Install PyQt5 by typing the following in your Windows command terminal:
> pip install PyQt5 --no-cache-dir
...
Successfully installed PyQt5-5.8.2 sip-4.19.2
The --no-cache-dir option makes sure that pip will not use an old version stored somewhere on your computer, but download the latest one instead.
3. Install QScintilla
Install QScintilla like this:
> pip install qscintilla --no-cache-dir
Successfully installed qscintilla-2.10
It does work on windows 10. Your application failed to access specified DLL. A restart is required to get it working. I went through all the answers in the SO forums and it turns out a computer restart can set everything straight. so restart your pc.

Install NumPy for Python 3.5

I am using python 3.5 and I am trying to install NumPy but when I try to install from command prompt using command: pip install numpy
I get a whole lot of errors. The main error though seems to be at the end: error: Unable to find vcvarsall.bat
I have also tried downloading the numpy binaries from http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy and installing using command: pip install numpy-1.10.4+mkl-cp35-cp35m-win_amd64.whl
But I get an error that says: numpy-1.10.4+mkl-cp35-cp35m-win_amd64.whl is not a supported wheel on this platform.
Then I found a numpy-1.10.2-win32-superpack-python3.4.exe file here https://sourceforge.net/projects/numpy/files/NumPy/1.10.2/ but when I try to run that I get an error that I require Python version 3.4.
I looked and cannot find an installer for python 3.5.exe, do I need to uninstall python 3.5 and install 3.4 instead? Or is there anyway to install numpy for Python 3.5?
I am using Windows 10/64 bit.
An easy way to obtain numpy, scipy, pandas, ... is to install anaconda.
Anaconda will automatically download and install the latest modules.
https://www.continuum.io/downloads
I hope this will help you along.

Resources