Jan-05-2019, 04:18 AM
(Jan-05-2019, 03:47 AM)snippsat Wrote: [ -> ]In Python 3 it's okay to use file,in python 2 it was not.
Gorramit, no one told me Python 3 was going to be backwards incompatible with complaints about newbie code.
(Jan-05-2019, 03:47 AM)snippsat Wrote: [ -> ]In Python 3 it's okay to use file,in python 2 it was not.
(Jan-05-2019, 03:47 AM)snippsat Wrote: [ -> ]Are you using Anaconda3 or miniconda?The error comes from miniconda,but you have also have C:\Users\gonca\
Error:error: OpenCV(3.4.2) c:\miniconda3\conda-bld\opencv-suite_1534379934306\...Anaconda3
. You know that Anaconda3(full version 1400+ packages) and miniconda3(0 packages have to install with conda or pip) are different standalone versions?ichabod801 Wrote:Also, file is a really bad variable name. file is a built-in type in PythonIn Python 3 it's okay to usefile
,in python 2 it was not.# Python 2.7 >>> file <type 'file'> # Python 3.7 >>> file Traceback (most recent call last): File "<interactive input>", line 1, in <module> NameError: name 'file' is not definedI have usedfile
many times in Python 3,even if old habits sometime hit in and tells that's is wrong when it really is not
(Jan-05-2019, 02:16 PM)gkiller007 Wrote: [ -> ]I'm using Anaconda 3, is this problem of reading the path, related with this Ide?Then error should never point to miniconda3.
11 orig = cv2.imread(r'C:/Users/gonca/Desktop/landscape' + file) ---> 12 orig = cv2.cvtColor(orig, cv2.COLOR_BGR2RGB)Here the file get read,but then a error occurs in:
Error:error: OpenCV(3.4.2) c:\miniconda3\conda-bld\opencv-suite_1534379934306\...
Also here is the problem not reading of file but a problem in OpenCV(3.4.2) that's install in miniconda3.(Jan-05-2019, 02:38 PM)snippsat Wrote: [ -> ](Jan-05-2019, 02:16 PM)gkiller007 Wrote: [ -> ]I'm using Anaconda 3, is this problem of reading the path, related with this Ide?Then error should never point to miniconda3. In your previous post:11 orig = cv2.imread(r'C:/Users/gonca/Desktop/landscape' + file) ---> 12 orig = cv2.cvtColor(orig, cv2.COLOR_BGR2RGB)Here the file get read,but then a error occurs in:Also here is the problem not reading of file but a problem in OpenCV(3.4.2). If you start from Andonda3 and error occurs in miniconda3,then something is mixed up and wrong. Andonda3 and miniconda3 are stand alone versions and should never be mixed together.
Error:error: OpenCV(3.4.2) c:\miniconda3\conda-bld\opencv-suite_1534379934306\...
(Jan-05-2019, 02:42 PM)gkiller007 Wrote: [ -> ]So, maybe i messed up on the instalation of Anaconda 3 right?It's easiest for you to use the full Python 3.7 version of Anaconda.
What do you suggest? unnintall everyting and install again? what version should i install?
G:\>cd anaconda3 G:\Anaconda3>python -V Python 3.7.1 # Point to Anaconda3 G:\Anaconda3>python -c "import sys; print(sys.executable)" G:\Anaconda3\python.exe G:\Anaconda3>cd Scripts # Point to Anaconda3 G:\Anaconda3\Scripts>pip -V pip 18.1 from G:\Anaconda3\lib\site-packages\pip (python 3.7) # Point to Anaconda3 G:\Anaconda3\Scripts>conda -V conda 4.5.12Like this it should work for you from anywhere in cmd when Anaconda is in Windows Path.
C:\Anaconda3
and C:\Anaconda3\Scripts
.(Jan-05-2019, 03:26 PM)snippsat Wrote: [ -> ](Jan-05-2019, 02:42 PM)gkiller007 Wrote: [ -> ]So, maybe i messed up on the instalation of Anaconda 3 right? What do you suggest? unnintall everyting and install again? what version should i install?It's easiest for you to use the full Python 3.7 version of Anaconda. Under install make sure that you add to Path if want this to be your main Python version.Restart Pc after install. Now test in for cmd,it should point to Anacond3 from anywhere in cmd not miniconda3. If point to miniconda3 most remove from Windows Path. It shall look like this,i have to do it from Anacond3 folder because Python 3.7(python.org),is my my main Python version in Windows path.
G:\>cd anaconda3 G:\Anaconda3>python -V Python 3.7.1 # Point to Anaconda3 G:\Anaconda3>python -c "import sys; print(sys.executable)" G:\Anaconda3\python.exe G:\Anaconda3>cd Scripts # Point to Anaconda3 G:\Anaconda3\Scripts>pip -V pip 18.1 from G:\Anaconda3\lib\site-packages\pip (python 3.7) # Point to Anaconda3 G:\Anaconda3\Scripts>conda -V conda 4.5.12Like this it should work for you from anywhere in cmd when Anaconda is in Windows Path. When i talk about Windows Path i mean Environment Variables Path. So for you it should be pointing to Anaconda3 egC:\Anaconda3
andC:\Anaconda3\Scripts
. If see miniconda3 in Path remove it.
from sklearn.decomposition import NMF from matplotlib import pyplot as plt import cv2 import numpy as np import os import sys import statistics
ModuleNotFoundError Traceback (most recent call last) <ipython-input-7-7128546282f5> in <module> 1 from sklearn.decomposition import NMF 2 from matplotlib import pyplot as plt ----> 3 import cv2 4 import numpy as np 5 import os ModuleNotFoundError: No module named 'cv2'
python -m pip install --user numpy -I pip install opencv-pythonTest that it work:
G:\Anaconda3 λ python Python 3.7.1 (default, Dec 10 2018, 22:54:23) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import cv2 >>> cv2.__version__ '3.4.5' >>>Look at Anaconda and other ways to run Python.
(Jan-05-2019, 06:34 PM)snippsat Wrote: [ -> ]Do:python -m pip install --user numpy -I pip install opencv-pythonTest that it work:G:\Anaconda3 λ python Python 3.7.1 (default, Dec 10 2018, 22:54:23) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import cv2 >>> cv2.__version__ '3.4.5' >>>Look at Anaconda and other ways to run Python.
Error:(base) C:\Users\gonca>python -m pip install --user numpy -I
Collecting numpy
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))': /simple/numpy/
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))': /simple/numpy/
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))': /simple/numpy/
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))': /simple/numpy/
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))': /simple/numpy/
Could not find a version that satisfies the requirement numpy (from versions: )
No matching distribution found for numpy
pip install opencv-pythonThe do test
import cv2
and see if get any errors.(Jan-05-2019, 09:11 PM)snippsat Wrote: [ -> ]Try only.pip install opencv-pythonThe do testimport cv2
and see if get any errors.