Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot import cv2 module after installing opencv 3.4.1 from anaconda #9448

Closed
melentye opened this issue May 25, 2018 · 4 comments
Closed

cannot import cv2 module after installing opencv 3.4.1 from anaconda #9448

melentye opened this issue May 25, 2018 · 4 comments

Comments

@melentye
Copy link

Actual Behavior

$ python -c 'import cv2'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'cv2'

Expected Behavior

It should import cv2 module without errors.

By the way, it seems to work if I install opencv 3.3.1 from anaconda channel.

Steps to Reproduce

  1. install opencv:
$ conda install -c anaconda opencv=3.4.1
Fetching package metadata .............
Solving package specifications: .

Package plan for installation in environment /Users/andrey.melentyev/.pyenv/versions/miniconda3-latest/envs/envy_mcenvface:

The following packages will be UPDATED:

    opencv: 3.3.1-py36hb620dcb_1 anaconda --> 3.4.1-py36h40b0b35_1 anaconda

Proceed ([y]/n)? y

then try importing cv2:

python -c 'import cv2'
Anaconda or Miniconda version:
$ conda --version
conda 4.3.30
Operating System:

macOS 10.13.4 but it works the same under Debian in Docker.

conda info
Current conda install:

               platform : osx-64
          conda version : 4.3.30
       conda is private : False
      conda-env version : 4.3.30
    conda-build version : not installed
         python version : 3.6.3.final.0
       requests version : 2.18.4
       root environment : /Users/andrey.melentyev/.pyenv/versions/miniconda3-latest  (writable)
    default environment : /Users/andrey.melentyev/.pyenv/versions/miniconda3-latest/envs/envy_mcenvface
       envs directories : /Users/andrey.melentyev/.pyenv/versions/miniconda3-latest/envs
                          /Users/andrey.melentyev/.conda/envs
          package cache : /Users/andrey.melentyev/.pyenv/versions/miniconda3-latest/pkgs
                          /Users/andrey.melentyev/.conda/pkgs
           channel URLs : https://repo.continuum.io/pkgs/main/osx-64
                          https://repo.continuum.io/pkgs/main/noarch
                          https://repo.continuum.io/pkgs/free/osx-64
                          https://repo.continuum.io/pkgs/free/noarch
                          https://repo.continuum.io/pkgs/r/osx-64
                          https://repo.continuum.io/pkgs/r/noarch
                          https://repo.continuum.io/pkgs/pro/osx-64
                          https://repo.continuum.io/pkgs/pro/noarch
            config file : /Users/andrey.melentyev/.condarc
             netrc file : None
           offline mode : False
             user-agent : conda/4.3.30 requests/2.18.4 CPython/3.6.3 Darwin/17.5.0 OSX/10.13.4
                UID:GID : 1545480448:1197883525
conda list --show-channel-urls
#
absl-py                   0.1.10                    <pip>
alabaster                 0.7.10           py36h174008c_0    defaults
appnope                   0.1.0            py36hf537a9a_0    anaconda
asn1crypto                0.24.0                   py36_0    defaults
astor                     0.6.2                     <pip>
astroid                   1.6.1                    py36_0    anaconda
attrs                     17.4.0                   py36_0    anaconda
babel                     2.5.3                    py36_0    defaults
backcall                  0.1.0                    py36_0    anaconda
beautifulsoup4            4.6.0                     <pip>
blas                      1.0                         mkl    anaconda
bleach                    1.5.0                     <pip>
bleach                    2.1.3                    py36_0    anaconda
bs4                       0.0.1                     <pip>
bzip2                     1.0.6                hd86a083_4    anaconda
ca-certificates           2017.08.26           ha1e5d58_0    defaults
cairo                     1.14.12              he60d9cb_2    anaconda
certifi                   2018.1.18                py36_0    defaults
cffi                      1.11.5           py36h342bebf_0    defaults
chardet                   3.0.4            py36h96c241c_1    defaults
chardet                   3.0.4                     <pip>
click                     6.7              py36hec950be_0    anaconda
cookies                   2.2.1                    py36_0    anaconda
cryptography              2.2.1            py36h1de35cc_0    defaults
cycler                    0.10.0           py36hfc81398_0    anaconda
dbus                      1.13.2               h760590f_1    anaconda
decorator                 4.2.1                    py36_0    anaconda
docutils                  0.14             py36hbfde631_0    defaults
entrypoints               0.2.3            py36hd81d71f_2    anaconda
enum34                    1.1.6                     <pip>
expat                     2.2.5                hb8e80ba_0    anaconda
ffmpeg                    3.4                  h766ddd1_0    anaconda
fontconfig                2.12.6               h9850fc5_0    anaconda
freetype                  2.8                  h12048fb_1    anaconda
gast                      0.2.0                     <pip>
gettext                   0.19.8.1             h15daf44_3    anaconda
glib                      2.56.1               h35bc53a_0    anaconda
graphite2                 1.3.11               h337f25e_1    anaconda
grpcio                    1.10.0                    <pip>
h5py                      2.7.1                     <pip>
h5py                      2.7.1            py36ha38d409_0    anaconda
harfbuzz                  1.7.6                h171471c_1    anaconda
hdf5                      1.8.18               h017327d_1    anaconda
html5lib                  1.0.1            py36h2f9c1c0_0    anaconda
html5lib                  0.9999999                 <pip>
icu                       58.2                 h4b95b61_1    anaconda
idna                      2.6              py36h8628d0a_1    defaults
idna                      2.6                       <pip>
imagesize                 1.0.0                    py36_0    defaults
intel-openmp              2018.0.0             h8158457_8    anaconda
ipykernel                 4.8.2                    py36_0    anaconda
ipython                   6.4.0                    py36_0    anaconda
ipython_genutils          0.2.0            py36h241746c_0    anaconda
ipywidgets                7.2.1                    py36_0    anaconda
isort                     4.3.4                    py36_0    anaconda
jasper                    1.900.1              h1f36771_4    anaconda
jedi                      0.11.1                   py36_0    anaconda
jinja2                    2.10             py36hd36f9c5_0    defaults
jpeg                      9b                   he5867d9_2    anaconda
jsonschema                2.6.0            py36hb385e00_0    anaconda
jupyter                   1.0.0                    py36_4    anaconda
jupyter_client            5.2.3                    py36_0    anaconda
jupyter_console           5.2.0            py36hccf5b1c_1    anaconda
jupyter_core              4.4.0            py36h79cf704_0    anaconda
Keras                     2.1.4                     <pip>
kiwisolver                1.0.1            py36h792292d_0    anaconda
lazy-object-proxy         1.3.1            py36h2fbbe47_0    anaconda
libcxx                    4.0.1                h579ed51_0    defaults
libcxxabi                 4.0.1                hebd6815_0    defaults
libedit                   3.1                  hb4e282d_0    defaults
libffi                    3.2.1                h475c297_4    defaults
libgfortran               3.0.1                h93005f0_2    anaconda
libiconv                  1.15                 hdd342a3_7    anaconda
libopus                   1.2.1                h169cedb_0    anaconda
libpng                    1.6.34               he12f830_0    anaconda
libprotobuf               3.4.1                h326466f_0    anaconda
libsodium                 1.0.16               h3efe00b_0    anaconda
libtiff                   4.0.9                h0dac147_0    anaconda
libvpx                    1.6.1                h057a404_0    anaconda
libxml2                   2.9.8                h2866646_0    anaconda
libxslt                   1.1.32               hb819dd2_0    anaconda
lockfile                  0.12.2                   py36_0    anaconda
luigi                     2.7.1            py36h8b82474_0    anaconda
lxml                      4.2.1            py36h7166777_0    anaconda
Markdown                  2.6.11                    <pip>
markupsafe                1.0              py36h3a1e703_1    defaults
matplotlib                2.2.2            py36ha7267d0_0    anaconda
mccabe                    0.6.1            py36hdaeb55d_0    anaconda
mistune                   0.8.3            py36h1de35cc_1    anaconda
mkl                       2018.0.2                      1    anaconda
mkl_fft                   1.0.1            py36h917ab60_0    anaconda
mkl_random                1.0.1            py36h78cc56f_0    anaconda
more-itertools            4.1.0                    py36_0    anaconda
nbconvert                 5.3.1            py36h810822e_0    anaconda
nbformat                  4.4.0            py36h827af21_0    anaconda
ncurses                   6.0                  hd04f020_2    defaults
nltk                      3.3.0                    py36_0    anaconda
notebook                  5.5.0                    py36_0    anaconda
numpy                     1.14.3           py36h9bb19eb_1    anaconda
numpy-base                1.14.3           py36h479e554_1    anaconda
olefile                   0.45.1                   py36_0    anaconda
opencv                    3.4.1            py36h40b0b35_1    anaconda
openssl                   1.0.2o               h26aff7b_0    anaconda
packaging                 17.1                     py36_0    defaults
pandas                    0.22.0           py36h0a44026_0    anaconda
pandoc                    1.19.2.1             ha5e8f32_1    anaconda
pandocfilters             1.4.2            py36h3b0b094_1    anaconda
parso                     0.1.1            py36hc90e01c_0    anaconda
patsy                     0.5.0                    py36_0    defaults
pcre                      8.42                 h378b8a2_0    anaconda
pexpect                   4.4.0                    py36_0    anaconda
pickleshare               0.7.4            py36hf512f8e_0    anaconda
pillow                    5.1.0            py36hfcce615_0    anaconda
pip                       9.0.3                    py36_0    anaconda
pixman                    0.34.0               hca0a616_3    anaconda
plaidml                   0.2.0                     <pip>
plaidml-keras             0.2.0                     <pip>
pluggy                    0.6.0            py36hb1d0581_0    anaconda
prompt_toolkit            1.0.15           py36haeda067_0    anaconda
protobuf                  3.5.1                     <pip>
ptyprocess                0.5.2            py36he6521c3_0    anaconda
py                        1.5.2            py36ha69170d_0    anaconda
pycodestyle               2.4.0                    py36_0    anaconda
pycparser                 2.18             py36h724b2fc_1    defaults
pydot                     1.2.4                     <pip>
pygments                  2.2.0            py36h240cd3f_0    anaconda
pylint                    1.8.2                    py36_0    anaconda
pyopenssl                 17.5.0           py36h51e4350_0    defaults
pyparsing                 2.2.0            py36hb281f35_0    anaconda
pyqt                      5.9.2            py36h11d3b92_0    anaconda
pysocks                   1.6.8                    py36_0    defaults
pytest                    3.5.1                    py36_0    anaconda
python                    3.6.5                hc167b69_1    anaconda
python-daemon             2.1.2                    py36_0    anaconda
python-dateutil           2.6.1            py36h86d2abb_1    anaconda
pytz                      2018.3                   py36_0    anaconda
PyYAML                    3.12                      <pip>
pyzmq                     17.0.0           py36h1de35cc_1    anaconda
qt                        5.9.5                h02808f3_0    anaconda
qtconsole                 4.3.1            py36hd96c0ff_0    anaconda
readline                  7.0                  hc1231fa_4    defaults
requests                  2.18.4           py36h4516966_1    anaconda
requests                  2.18.4                    <pip>
responses                 0.9.0                    py36_0    anaconda
scikit-learn              0.19.1           py36hffbff8c_0    anaconda
scipy                     1.0.1            py36hcaad992_0    anaconda
selenium                  3.8.0                    py36_0    conda-forge
send2trash                1.5.0                    py36_0    anaconda
setuptools                38.5.1                   py36_0    defaults
simplegeneric             0.8.1                    py36_2    anaconda
sip                       4.19.8           py36h0a44026_0    anaconda
six                       1.11.0           py36h0e22d5e_1    anaconda
snowballstemmer           1.2.1            py36h6c7b616_0    defaults
sphinx                    1.7.4                    py36_0    anaconda
sphinxcontrib             1.0              py36h9364dc8_1    defaults
sphinxcontrib-websupport  1.0.1            py36h92f4a7a_1    defaults
sqlalchemy                1.2.4            py36h1de35cc_0    defaults
sqlite                    3.23.1               hf1716c9_0    anaconda
statsmodels               0.8.0            py36h9c68fc9_0    defaults
tensorboard               1.6.0                     <pip>
tensorflow                1.6.0                     <pip>
tensorflow-tensorboard    1.5.1                     <pip>
termcolor                 1.1.0                     <pip>
terminado                 0.8.1                    py36_1    anaconda
testpath                  0.3.1            py36h625a49b_0    anaconda
tk                        8.6.7                h35a86e2_3    defaults
tornado                   4.5.3                    py36_0    anaconda
tqdm                      4.23.3                   py36_0    anaconda
traitlets                 4.3.2            py36h65bd3ce_0    anaconda
typing                    3.6.4                    py36_0    defaults
urllib3                   1.22                      <pip>
urllib3                   1.22             py36h68b9469_0    defaults
wcwidth                   0.1.7            py36h8c6ec74_0    anaconda
webencodings              0.5.1            py36h3b9701d_1    anaconda
Werkzeug                  0.14.1                    <pip>
wheel                     0.30.0           py36h5eb2c71_1    defaults
widgetsnbextension        3.2.1                    py36_0    anaconda
wrapt                     1.10.11          py36hc29e774_0    anaconda
xz                        5.2.3                h0278029_2    defaults
zeromq                    4.2.5                h378b8a2_0    anaconda
zlib                      1.2.11               hf3cbc9b_2    defaults
@mingwandroid
Copy link

This is my fault. Until I fix it you can use:

conda install py-opencv

@mingwandroid
Copy link

Fixed.

@ralexx
Copy link

ralexx commented Oct 23, 2018

defaults::opencv=3.4.2 still raises ModuleNotFoundError when calling import cv2 (atlanhq/camelot#167). @mingwandroid's workaround to

conda install py-opencv

still seems to be valid.

macOS 10.12.6
conda 4.5.11
conda base python 3.7
target env for opencv: python 3.6

@mingwandroid
Copy link

mingwandroid commented Oct 23, 2018

Edit: nope, you used defaults.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants