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

importing OpenCV2 (cv2) in local Python environment vs Jupyter Environment #58

Open
gpullela opened this issue Nov 13, 2023 · 1 comment

Comments

@gpullela
Copy link

Hi,

I am using your Ubuntu 20.04 image and it's great! I am confused about one thing though - it says that I have OpenCV 4.8.0 on my jetson nano (using jtop and verified through Python 3.8.10 shell), but when I try to import and check its version on jupyter lab, it says version "4.5.3".

Can you help me figure out how to use the correct OpenCV package?

Thank you!

@Qengineering
Copy link
Owner

When you check the version of OpenCV in jtop or the Python 3.8.10 shell, you are likely seeing the version that is installed globally on the system. However, when you import OpenCV in Jupyter Lab, you are importing a different version that is installed in Jupyter Lab's virtual environment.

To confirm this, you can try activating the virtual environment that Jupyter Lab is using and then checking the version of OpenCV. To activate the virtual environment, run the following command in the Jupyter Lab terminal:

source activate jupyter

Once the virtual environment is activated, you can check the version of OpenCV using the following command:

python -c "import cv2; print(cv2.__version__)"

If the version of OpenCV that is reported in the Jupyter Lab terminal is different from the version that is reported in jtop or the Python 3.8.10 shell, then this confirms that you have multiple versions of OpenCV installed.

There are a few possible reasons why you might have multiple versions of OpenCV installed. One possibility is that you installed OpenCV manually from source, and then later installed a pre-built package of OpenCV using a package manager like apt or pip. Another possibility is that you are using a third-party library that depends on a different version of OpenCV than the one that is installed globally on the system.

If you are not sure why you have multiple versions of OpenCV installed, or if you are having problems using OpenCV in Jupyter Lab, you may want to try uninstalling the version of OpenCV that is installed in Jupyter Lab's virtual environment and then reinstalling OpenCV from source.

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

2 participants