0

I am Working on a project which uses opencv-python. Due to few specifications I had to make few code changes in the opencv code( Received from open source). Now I want the opencv-python to use the custom opencv I created ( i have stored it in bitbucket). I am installing opencv-python using

pip install git+bitbucketurl

I have stored the opencv-python source code in my private bitbucket.

Things that i have tried are

  1. Delete the opencv submodule from opencv-python source code and add my private opencv repo as a submodule ( have added the username and password in bitbucket link itself)
  2. recursively clone the opencv-python and replace the default opencv folder with my custom opencv ( with same name)
  3. Doing both step 1 and step 2
  4. Deleting the other submodules that comes with opencv-python ( multibuild , opencv-extra , opencv-contrib)

but none of the above methods worked. Somehow when i do pip install even after changing the submodule it downloads the opensource opencv instead of custom one stored at bitbucket whose link i added while creating submodule.

I used this to delete the submodule : https://stackoverflow.com/a/1260982/7545777

to add the submodule i used git submodule add customopencvurl

crazysra
  • 111
  • 10
  • why do you remove only submodules? I would remove all `opencv` and install custom `opencv` – furas May 07 '22 at 12:39
  • I am new to submodules so can you please explain what do you mean when you say install opencv ? Doesn't pip install git+customopencv-pythonurl install all the submodules along with the parent – crazysra May 07 '22 at 13:11
  • 1
    if you didn't uninstall old version then it will NOT install new one and it may needs to add option `--update` (or shorter upper `-U`) `pip install --update git+bitbucketurl` – furas May 07 '22 at 13:16
  • 1
    maybe it would be simpler to download module manually and replace it in python folder. Or add folder with new version to `sys.path.insert(0, folder_with_new_version)` before `import` and it will search module first in folder `folder_with_new_version` – furas May 07 '22 at 13:18
  • 1
    maybe first you should test if you can install local code using `python setup.py install` (`setup.py` is in folder with `opencv`) – furas May 07 '22 at 13:22
  • @furas thank you for your help .. I Was missing the rebuiliding of wheel part which can be done by pip wheel . --verbose – crazysra May 10 '22 at 06:43

1 Answers1

0

The step that I missed was building the wheel. So after making the necessary changes i.e replacing the submodule we have to build the wheel, which is used when you do pip install. Command used to rebuild the wheel is

pip wheel . --verbose
crazysra
  • 111
  • 10