Cannot retrieve the version information of OpenCV
vmirly opened this issue · 8 comments
I can import cv2 package in my jupyter notebook, but watermark cannot find the proper information for this package:
DistributionNotFound: The 'cv2' distribution was not found and is required by the application
Hey, Vahid,
hm, that's weird. Can you import the 'cv2' package in your current jupyter session via
__import__('cv2')
?
Sebastian,
Yes, importing via this command works in jupyter notebook:
__import__('cv2')
<module 'cv2' from '/home/vahid/.virtualenvs/cv/lib/python3.4/site-packages/cv2.so'>
Also, the version can be seen via
cv2.__version__
3.1.0'
Hm, what watermark version are you using then? If you are using a version < v. 1.3.2
you may have to use the install name ("opencv") instead of the import package name.
PS: you can get the watermark version via %watermark -w
Something is not right. I successfully installed the latest version (1.3.4)
Found existing installation: watermark 1.3.4
Uninstalling watermark-1.3.4:
Successfully uninstalled watermark-1.3.4
Running setup.py develop for watermark
Successfully installed watermark
but in jupyter I still get the old version:
import watermark
%watermark -w
watermark v. 1.2.3
Hm, this sounds more like a general issue related to where/how you installed packages -- maybe sth related to your virtual environments? Maybe you installed a second version of the package in an env, and your jupyter comes from another environment? Maybe just upgrade the package just from Jupyter notebook directly like
%%sh pip install watermark --upgrade
PS: it looks like you ran python setup.py develop
? This does not install the package but it will create an .egg-link in the deployment directory back to the project source code directory.
Now it seems that the problem is resolved, and %watermark -v -p cv2
gives the OpenCV version.
I had tried pip install watermark --upgrade
as well, but for some reasons, it was not working.
Hm, I suspect there was something weird about the virtual env that you upgraded and the virtual env that loaded the notebook. However, I am glad that it's sorted out now :)