0

New python3 environment created with

conda create -n py3CVCaffe python=3.7

caffe installed with

conda install caffe-gpu=1.0=py37hdc87d0a_5

among the many packages installed are these two

libopencv-3.4.2            |       hb342d67_1        40.4 MB
py-opencv-3.4.2            |   py37hb342d67_1         1.2 MB

both packages are installed and seem to be functional

$ python
Python 3.7.3 (default, Mar 27 2019, 22:11:17) 
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import caffe
>>> import cv2
>>> 

However certain video functions are absent as the openCV which is provided has not been compiled

cv2.error: OpenCV(3.4.2) /tmp/build/80754af9/opencv-suite_1535558553474/work/modules/highgui/src/window.cpp:632: error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function 'cvShowImage'

This is a well known problem as discussed here

So I need to install an openCV that has been compiled with these libraries. Before I do that I have to remove the openCV that was pulled in with caffe. Unfortunately, conda does not want to-it also wants to remove caffe!

$conda uninstall py-opencv
Collecting package metadata: done
Solving environment: done

## Package Plan ##

  environment location: /home/stefan/miniconda3/envs/p37cu9CfeG

  removed specs:
    - py-opencv


The following packages will be REMOVED:

  caffe-gpu-1.0-py37hdc87d0a_5
  py-opencv-3.4.2-py37hb342d67_1


Proceed ([y]/n)? 
aquagremlin
  • 3,515
  • 2
  • 29
  • 51

1 Answers1

1

If you only want to remove py-opencv and not any of its reverse dependencies, then use the --force flag. From the conda remove --help:

--force-remove, --force
Forces removal of a package without removing packages that depend on it. Using this option will usually leave your environment in a broken and inconsistent state.

which should be read as "do so at your own risk".

merv
  • 67,214
  • 13
  • 180
  • 245