Intel® DevCloud
Help for those needing help starting or connecting to the Intel® DevCloud
1642 Discussions

Open CV2 Import Error

Wendo__Brian
Beginner
1,334 Views

Hi guys,

I am stuck in Part 1 of the Intel AI course. I keep getting the import error for opencv. If i use pip to install, I am denied access. I used conda install to install opencv. If I do conda list . I can see that opencv is installed. If import same error. This is the second time I am posting this question no answers so far.

I have followed the following procedures as per the following Open cv2 solution

It has not worked. I still cannot import. Please could a root user just install the opencv globally just for the assignment. You have made the assignment very unenjoyable since everything is timed. 4hrs access per day.

My approach:

Step 1: Activate tf_training

Step 2: which python : /glob/intel-python/python3/bin//python

Step 3: export PATH="/home/u*****/.conda/envs/tf_training/bin":$PATH

Step 4:  which python : /glob/intel-python/python3/bin//python

Step 5: start python and import cv2:

ImportError: libprotobuf.so.12: cannot open shared object file: No such file or directory

0 Kudos
5 Replies
AthiraM_Intel
Moderator
1,334 Views

Hi,

Thanks for reaching out to us.

Kindly follow the below instructions:

To fix the issue in your Jupyter notebook:

> open jupyter terminal  and give

cd /home/u*****/.local/share/jupyter/kernels/tf_training

> Open kernel.json and check if the python path referenced is /glob python or path to your tf_training. If it is /glob python, change the path to /home/u*****/.conda/envs/tf_training/bin/python

> Open the terminal and activate tf_training.

source activate tf_training

> Check the path of Python by giving the following command: which python. If it references /glob python path, update the PATH by exporting the conda python path.

i.e. export PATH="/home/u*****/.conda/envs/tf_training/bin":$PATH

> On checking which python, it should show the updated python PATH.

Please verify and let us know if the solution provided worked. If the issue still persists, share the steps you have followed with the corresponding screenshots.  

Note: Change u***** to your user id

0 Kudos
Wendo__Brian
Beginner
1,334 Views

Yes it worked. Hurray. I can now import opencv but now I am getting a permission denied error when accessing the Datasets folder.

PermissionError: [Errno 13] Permission denied: '../Dataset'

I manually uploaded it because I am using the cloud and there was no way of accessing it from my local computer. I am trying to change the permissions to see if it is resolved.

0 Kudos
Wendo__Brian
Beginner
1,334 Views

Changing the permissions did not work. The problem is with the dataset folders. I uploaded it the Dataset folder using jupyter notebook. For the stolen cars directory I created the folder because it wasn't created beforehand.  The key confusion comes from the paths to the datasets since they have been uploaded to the base env rather than the training_tf env. It could be the reason why I can't access the folders. How do I solve this?

0 Kudos
Wendo__Brian
Beginner
1,334 Views

Changed the datasets path to and it worked:

full_dataset_path = "/home/u*****/Dataset/SubsetVMMR"
stolen_cars_path = "/home/u*****/Dataset/Most_Stolen_Cars"

0 Kudos
AthiraM_Intel
Moderator
1,334 Views

Glad to know that your issue got resolved. We are closing this thread. Feel free to open a new thread if you face any further issues.

0 Kudos
Reply