Posts: 4,220
Threads: 97
Joined: Sep 2016
(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.
Posts: 16
Threads: 2
Joined: Jan 2019
(Jan-05-2019, 03:47 AM)snippsat Wrote: Are you using Anaconda3 or miniconda? Error: error: OpenCV(3.4.2) c:\miniconda3\conda-bld\opencv-suite_1534379934306\...
The error comes from miniconda,but you have also have C:\Users\gonca\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 Python In Python 3 it's okay to use file ,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 defined I have used file many times in Python 3,even if old habits sometime hit in and tells that's is wrong when it really is not 
I'm using Anaconda 3, is this problem of reading the path, related with this Ide?
Is there any other ide's that cannot have this tipe of errors?
Posts: 7,312
Threads: 123
Joined: Sep 2016
Jan-05-2019, 02:40 PM
(This post was last modified: Jan-05-2019, 02:40 PM by snippsat.)
(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:
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.
If you start from Andonda3 and error occurs in miniconda3,then something is mixed up and wrong.
Anaconda3 and miniconda3 are stand alone versions and should never be mixed together.
Posts: 16
Threads: 2
Joined: Jan 2019
(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: 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). 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.
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?
Posts: 7,312
Threads: 123
Joined: Sep 2016
Jan-05-2019, 03:26 PM
(This post was last modified: Jan-05-2019, 03:26 PM by snippsat.)
(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.
![[Image: hvHkZO.jpg]](https://imageshack.com/a/img923/4097/hvHkZO.jpg)
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.12 Like 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 eg C:\Anaconda3 and C:\Anaconda3\Scripts .
If see miniconda3 in Path remove it.
Posts: 16
Threads: 2
Joined: Jan 2019
(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.12 Like 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 eg C:\Anaconda3 and C:\Anaconda3\Scripts . If see miniconda3 in Path remove it. ![[Image: GUgLry.jpg]](https://imageshack.com/a/img922/8052/GUgLry.jpg)
I've done it all and it has gone well
Now when i run my project i'm missing cv2 module, who do i install 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'
Posts: 7,312
Threads: 123
Joined: Sep 2016
Jan-05-2019, 06:34 PM
(This post was last modified: Jan-05-2019, 06:34 PM by snippsat.)
Do:
python -m pip install --user numpy -I
pip install opencv-python Test 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.
Posts: 16
Threads: 2
Joined: Jan 2019
(Jan-05-2019, 06:34 PM)snippsat Wrote: Do: python -m pip install --user numpy -I pip install opencv-python Test 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.
I ran it and this was the result:
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
Posts: 7,312
Threads: 123
Joined: Sep 2016
Try only.
pip install opencv-python The do test import cv2 and see if get any errors.
Posts: 16
Threads: 2
Joined: Jan 2019
(Jan-05-2019, 09:11 PM)snippsat Wrote: Try only. pip install opencv-python The do test import cv2 and see if get any errors.
Now it gives another error
Could not install packages due to an EnvironmentError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Max retries exceeded with url: /packages/9a/de/901d0546a2465b94be8574bffb4610f57f0fe5c0f2141b7ba43eb8ebac26/opencv_python-3.4.5.20-cp37-cp37m-win_amd64.whl (Caused by ProtocolError('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None)))
|