everyone.
My problem is that I need the last version of OpenCV (4.3.0) to run a code but when I checked my version of opencv with the line:
print(cv2.__version__)
it said that my version of cv2 is the 3.4.2. So I went into my anaconda, environment, I marked opencv for upgrade, but it seems it is the last version it can install. So I tried a command in the cmd.prompt of anaconda :
pip install --upgrade opencv-python==4.3.0.36
And then, when I checked "opencv" in the installed modules of my anaconda environment, I saw two opencv. One is "opencv" version 3.4.2, and then, just below, there is "opencv-pyton" version 4.3.0. BUT, when I checked again my version of cv2 with "print(cv2.version)", it was still telling me that my version is 3.4.2 (I also tried to uninstall the opencv 3.4.2 to see if anaconda would then take into account the opencv-pyton 4.3.0 but no, it gives me an error).
Does anyone have an idea how to upgrade my version of opencv with anaconda ? Thanks everyone.
You may be missing the conda-forge channel in your .condarc settings.
try this to install from conda-forge:
conda install -c conda-forge opencv=4.3.0
Related
I know this has been asked many times, I saw them tried to solve my problem but I can't, nothing works for me.
I have a mac m1, My os version is BigSur 11.5.1
My python3 version is 3.8.10
I have a project folder, which I created my env in there as atai_env
I ran pip upgrade, my pip version is current which is 21.3.1
I activated my env and ran pip install tensorflow which gives this error;
ERROR: Could not find a version that satisfies the requirement tensorflow (from versions: none)
ERROR: No matching distribution found for tensorflow
I saw some command as pip install tensorflow-macos so I tried it, it seems to install but at the end it gives this Failed to build h5py which I tried to install but failed again
Then I tried to ran pip command given here for python 3.8 -> https://www.tensorflow.org/install/pip and it gives below error;
tensorflow-2.7.0-cp38-cp38-macosx_10_11_x86_64.whl is not a supported wheel on this platform.
I am so sick of this :/ I tried to install other versions of python but it always fails. Can someone explain what should I do, I can't believe I spent more than 2 hours on this.
On the tensorflow install page, it seems I should only be running pip install tensorflow but that doesn't work
Ok, Nothing that I found on google helped. I started over, and decided to try python versions starting from 3.9 with decreasing versions. Finally this command just worked -> pip install tensorflow with python 3.7.9 It is so frustrating, cost me a few hours. I wasn't expecting it would be unstable like this. Anyway, if you happen to face it just try to use one of the version 7 even tho tensorflow says it works for 3.7 - 3.9
PS: I am sorry but this is really stupid, it is almost 2022 and we are working on AI with this framework comon :/
I have MacOS BigSur 11.6.1 running and just created a virtualenv with Python 3.8.12. Installing tensorflow works without any problems:
pip install tensorflow
pip install tensorflow 1 err | 8s | voice_assistant py
Collecting tensorflow
Downloading tensorflow-2.7.0-cp38-cp38-macosx_10_11_x86_64.whl (207.1 MB)
I could successfully install and run TensorFlow from my M1 MacBook Pro. Monterey 12.4. Here's what I did:
1. Install Homebrew first
How typical.
2. Install Anaconda via Homebrew
brew install anaconda
Installing Python is a mess and I know most tutorials will suggest to use pyenv as the version management tools. I tried that, but didn't work. What worked for me is Anaconda.
3. Download PyCharm
It's a GUI-friendly way to switch between Python versions and environments.
4. Set the Python interpreter inside PyCharm
Note that I use Conda Environment. Note also that the conda executable is inside /opt/homebrew/anaconda3/bin/conda.
5. Install tensorflow-macos from the PyCharm terminal
After doing this, you can import tensorflow as tf inside your .py files.
You can try upgrading the version of pip.
I am trying to install/upgrade GDAL 2.2.4. But every time i try to install or upgrade to version GDAL 2.2.4 i get an error message. I have completely uninstalled and reinstalled anaconda (64bit) (with python 2.7).
Using the conda command to install in command line (i.e. conda install gdal) works fine. However, it only installs to GDAL 2.2.2. I need the newest version for its capacity to handle BigTIFF formats. When I use pip to install (i.e. pip install gdal) I get this massive error [i took a screen shot because i dont know how to copy from cmd]:
How do I overcome this error and install GDAL 2.2.4 ?
Gdal 2.2.4 is available through anaconda with conda-forge.
Try the following
conda install -c conda-forge gdal
I've been beginning to work with images in Python and I wanted to start using PIL (Pillow). To install it, I ran pip install Pillow. When installing, PIL was not previously installed. I also tried uninstalling it and reinstalling it, as well as using pip3 install Pillow.
When I run it in Python, my first line is:
File "C:\Program Files\Python36\lib\site-packages\PIL\Image.py", line 56, in <module>
from . import _imaging as core
ImportError: DLL load failed: The specified procedure could not be found.
I checked the directory, and the file _imaging.cp36-win_amd64.pyd is present under the PIL folder.
Why is this happening if the needed DLL is there? How can I fix it?
I had this problem as well with Python 3.6. I just avoided the problem by uninstalling pillow (4.1.0) and then installing an older version of pillow (4.0.0). It seems to run okay with the older version.
As in Sean's answer, I had to uninstall (I'm using Anaconda Python 3.6, BTW) with
conda uninstall pillow
I tried it with PIL, but there was no such package. Uninstalling pillow also meant uninstalling packages that depend on it, in my case "anaconda-navigator" and "scikit-image". After I reinstalled Pillow 4.0.0 with
conda install pillow=4.0.0
and tested it with
python -c "from PIL import Image"
which, if successful, you don't see an error message, I reinstalled the packages that were uninstalled along with Pillow 4.1.0.
conda install anaconda-navigator
conda install scikit-image
If you're using Anaconda, try
conda uninstall pillow and then pip install pillow
Came across this issue while working on Caffe2 on Windows 10 (Anaconda 4.5) and this worked for me. Here's the github post on this issue.
This problem is also fixed by upgrading Python to 3.6.1, per this GitHub discussion.
The difference is that Pillow 4.1.0 was built with Python 3.6.1 while Pillow 4.0.0 was built with Python 3.6.0.
Apparently PYTHON36.DLL from Python 3.6.0 is missing functions (PySlice_AdjustIndices and PySlice_Unpack) that are used when building with Python 3.6.1.
The solution is to upgrade to Python 3.6.1.
There's a problem in Python itself which means binary wheels build using Python 3.6.1 (like Pillow 4.1.0) won't install on Python 3.6.0.
This has affected a number of Python libraries.
However, there's the new Pillow 4.1.1 release works around this, so you can now update to Pillow 4.1.1 and use it with both Python 3.6.0 and 3.6.1.
More info:
https://github.com/python-pillow/Pillow/issues/2479
https://mail.python.org/pipermail/python-dev/2017-March/147707.html
https://bugs.python.org/issue29943
for new people 2022
i solved it
you can look at this
https://pillow.readthedocs.io/en/latest/installation.html
if PIL dont want to uninstall delete or cut it to another folder
This works for me using win10 and py 3.6.
Simply uninstall Pillow 4.1.0
pip3 uninstall Pillow
Then install Pillow 4.0.0
pip3 install Pillow==4.0.0
I had the same problem with anaconda 5.0.1, using it with caffe on windows 10. i just did
conda install PIL
it worked for me.
Seems like some issue is there with tensorflow 1.12.0 +Python 3.6.0 + win10
Working fine with conda tensorflow.
below steps worked for me for pip tensorflow.
uninstall tensorflow
replace your python version with 3.6.1
install latest version of tensorflow(1.13.0)
For installing Tensorflow follow below link:-
https://www.tensorflow.org/install/pip
If you are a Windows user and do not have Microsoft Visual C++ the error occurs. I got the same error and resolved this by installing the Microsoft Visual C++. Link for downloading can be found here.
https://support.microsoft.com/en-us/topic/the-latest-supported-visual-c-downloads-2647da03-1eea-4433-9aff-95f26a218cc0
First uninstall existing version
pip uninstall pillow
Then try installing
pip install pillow==4.0.0
Can anyone tell me commands to get contrib module for anaconda
I need that module for
matches = flann.knnMatch(des1,des2,k=2)
to run correctly
error thrown is
cv2.error: ......\modules\python\src2\cv2.cpp:163: error: (-215) The data should normally be NULL! in function NumpyAllocator::allocate
Also I am using Anaconda openCV version 3, and strictly dont want to switch to lower versions
P.S. as suggested at many places to edit file cv2.cpp option is not available with anaconda.
I would recommend installing pip in your anaconda environment then just doing: pip install opencv-contrib-python. This comes will opencv and opencv-contrib.
Anaconda supports pip install to install package into conda environment. You can download OpenCV 3.2.0 with opencv_contrib from this well known Unofficial Windows Binaries for Python Extension Packages website. See the filename below for the right version. Then type the command in Anaconda Prompt window to install the package:
For Python 3.5 and 64-bit Windows:
pip install opencv_python‑3.2.0+contrib‑cp35‑cp35m‑win_amd64.whl
For Python 3.6 and 64-bit Windows:
pip install opencv_python‑3.2.0+contrib‑cp36‑cp36m‑win_amd64.whl
Most of the OpenCV 3.2.0 packages in Anaconda repository didn't specific if they come with opencv_contrib. The pip install approach is easier and proven, see one of the SO post. The only drawback is that conda list will not show pip installed package there but actually it's.
However, if you want to have trial on conda install, below is the command for installing OpenCV 3.2.0 for Python 3.5 or 3.6 but likely without opencv_contrib.
conda install -c conda-forge opencv=3.2.0
Hope this help.
You can try this: https://anaconda.org/michael_wild/opencv-contrib
To install this package with conda run:
conda install -c michael_wild opencv-contrib
These anaconda packages include the contrib modules with base OpenCV3. Though the file list says it's currently for Windows only!
The question is old but I thought to update the answer with the latest information. My Anaconda version is 2019.10 and build channel is py_37_0 . I used pip install opencv-python==3.4.2.17 and pip install opencv-contrib-python==3.4.2.17. Now they are also visible as installed packages in Anaconda navigator and I am able to use patented methods like SIFT etc.
Method 1: in Anaconda Prompt write this, will install opencv-contrib v4.6
pip install opencv-contrib-python
Method 2: Install previous version of opencv-contrib v3.3.1
According to https://anaconda.org/michael_wild/opencv-contrib it says it support win64bit only and python 3.6.x.
So, first you need to create new enviroment support python 3.6
conda create --opencv_contrib36 python=3.6.13
then, install the packages
conda install -c michael_wild opencv-contrib
There is repo in conda-forge which includes opencv-contrib: https://github.com/conda-forge/opencv-feedstock
To use it:
conda install --channel=conda-forge libopencv opencv py-opencv
if you run into Numpy error, try pinning more recent version (of Numpy).
This worked for me in Windows 10 on Anaconda 5.3 with python 3.6
conda install -c conda-forge opencv
So, initially, I just had python 3.5 from the anaconda installation and all was fine. Then I was following a tutorial that suggested the use of enthought canopy, which used python 2.7.
After this I did a 'pip install opencv-python' and that installed the 2.7 version of the library. I should note, I am on Ubunutu 16 desktop for development.
I cannot seem to find a way for installing opencv and possibly cv2 for python3, the version installed in my user directory. Maybe I should remove enthought canopy. But I will still need to find the correct versions of opencv, cv2 for anaconda3.
Thanks in advance for any help,
Bruce
Once you have anaconda installed, try the following (as seen in this tutorial):
conda create -n opencv numpy scipy scikit-learn matplotlib python=3
source activate opencv
conda install -c https://conda.binstar.org/menpo opencv3
it will first create a virtual environment called opencv with the packages opencv, numpy, scipy, scikit-learn and matplotlib.
It works for me on Mac.