I am on a Nvidia Jetson Nano with the JetPack4.5 Image from Waveshare. I installed a Virtual Environment with python3.8 and OpenCv.
When I try in my terminal there is no Problem.
(.venv) jetson@nano-4gb-jp451:~/python3.8test$ python
Python 3.8.0 (default, Dec 9 2021, 17:53:27)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
After that I added the Virtual Environment to my Jupyter Notebook.
pip install --user ipykernel
python -m ipykernel install --user --name=venv
Installed kernelspec venv in /home/jetson/.local/share/jupyter/kernels/venv
In the new venv Notebook I checked the python version, which was corrected.
from platform import python_version
print(python_version())
3.8.0
But when I try to import cv2 the Output is “No module named ‘cv2’
%matplotlib inline
from matplotlib import pyplot as plt
import cv2
image = cv2.imread('TestBild.PNG')
cv2.imwrite('TestBildOut.PNG', image)
print(image.shape)
plt.imshow(cv2.cvtColor(image, cv2.COLOR_BGR2RGB))
plt.show()
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
Cell In[3], line 4
1 get_ipython().run_line_magic('matplotlib', 'inline')
3 from matplotlib import pyplot as plt
----> 4 import cv2
6 image = cv2.imread('TestBild.PNG')
8 cv2.imwrite('TestBildOut.PNG', image)
ModuleNotFoundError: No module named 'cv2'
I was expecting that if opencv is working in the Virtual Environment, it would work too in the Notebook with the same Virtual Environment…
Is there a way to fix the Problem?
Lars Haarhus is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.