Issues installing Opencv
Hello. I'm trying to install opencv on my compute target. The will run if i'm not installing opencv, but when i add it I get the following error: File "train.py", line 7, in <module> from cv2 import add File "/azureml-envs/azureml_2b8741335a5c3198578051301af43a5b/lib/python3.6/site-packages/cv2/init.py", line 3, in <module> from .cv2 import * ImportError: libgthread-2.0.so.0: cannot open shared object file: No such file or directory
I use the following estimator:
estimator= TensorFlow(source_directory=project_folder, compute_target=compute_target, script_params=script_params, entry_script='train.py', pip_packages=['keras==2.1.2','h5py','scipy','opencv-python'], node_count=2, process_count_per_node=1, distributed_backend='mpi', use_gpu=True)
Any ideas to what I should do?
Document details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: 467fb465-3db5-bdec-c15a-4b42ba598324
- Version Independent ID: 08f6b327-dc9e-911d-adc8-535499c58ba3
- Content: azureml.train.dnn.TensorFlow class - Azure Machine Learning Python
- Content Source: AzureML/docs-ref-autogen/azureml-train-core/azureml.train.dnn.TensorFlow.yml
- Service: machine-learning
- GitHub Login: @j-martens
- Microsoft Alias: jmartens
Opencv requires mesa's GL library. Use conda_packages=['mesa-libgl-cos6-x86_64']
i think this is not solving the issue. I am using below estimator but i m getting same error.
est = TensorFlow(source_directory='maskrcnn-train', script_params=script_params, compute_target=compute_target, pip_packages=['Cython','keras', 'opencv-python','matplotlib','scikit-image','scipy','h5py','imgaug','IPython[all]','numpy','Pillow'], entry_script='training.py', conda_packages=['mesa-libgl-cos6-x86_64'], use_gpu=True, use_docker=True, inputs=[ds.as_mount()])
File "/azureml-envs/azureml_0fbacf49bc84b9af7157d336ed1fc6bb/lib/python3.6/site-packages/imgaug/init.py", line 2, in
Can you please try with installing opencv through conda_packages?
est = TensorFlow(source_directory='maskrcnn-train', script_params=script_params, compute_target=compute_target, pip_packages=['Cython','keras', 'matplotlib','scikit-image','scipy','h5py','imgaug','IPython[all]','numpy','Pillow'], entry_script='training.py', conda_packages=['mesa-libgl-cos6-x86_64', ‘opencv=3.4.2'], use_gpu=True, use_docker=True, inputs=[ds.as_mount()])
From: amardeepjaiman [email protected] Sent: Monday, April 15, 2019 3:20 AM To: Azure/MachineLearningNotebooks [email protected] Cc: Billy Hu [email protected]; Comment [email protected] Subject: Re: [Azure/MachineLearningNotebooks] Issues installing Opencv (#252)
i think this is not solving the issue. I am using below estimator but i m getting same error.
est = TensorFlow(source_directory='maskrcnn-train', script_params=script_params, compute_target=compute_target, pip_packages=['Cython','keras', 'opencv-python','matplotlib','scikit-image','scipy','h5py','imgaug','IPython[all]','numpy','Pillow'], entry_script='training.py', conda_packages=['mesa-libgl-cos6-x86_64'], use_gpu=True, use_docker=True, inputs=[ds.as_mount()])
File "/azureml-envs/azureml_0fbacf49bc84b9af7157d336ed1fc6bb/lib/python3.6/site-packages/imgaug/init.py", line 2, in from imgaug.imgaug import * File "/azureml-envs/azureml_0fbacf49bc84b9af7157d336ed1fc6bb/lib/python3.6/site-packages/imgaug/imgaug.py", line 13, in import cv2 File "/azureml-envs/azureml_0fbacf49bc84b9af7157d336ed1fc6bb/lib/python3.6/site-packages/cv2/init.py", line 3, in from .cv2 import * ImportError: libgthread-2.0.so.0: cannot open shared object file: No such file or directory
— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FAzure%2FMachineLearningNotebooks%2Fissues%2F252%23issuecomment-483194702&data=02%7C01%7Cninhu%40microsoft.com%7Ca9e12a8ec42b4a421db308d6c18be99c%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636909203993694111&sdata=QcdGytSNXj%2B%2BgjJkRLITJM8Th0eYp78jTaK9kCMDB9Y%3D&reserved=0, or mute the threadhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAKp3VQ5az45ocl4rUx0UA2cDQTpTvppCks5vhFJOgaJpZM4b2XfV&data=02%7C01%7Cninhu%40microsoft.com%7Ca9e12a8ec42b4a421db308d6c18be99c%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636909203993704105&sdata=SPv5Zw3oKiJ0tuuj4JrYr5LS8eLN4LkXEL0Wqf29JRQ%3D&reserved=0.
Thanks, I tried to install opencv using conda package. but this time it does not find another shared library. please find the error below :
File "/azureml-envs/azureml_3ec0ba3f30b4357edd78d07bd8af8197/lib/python3.6/runpy.py", line 96, in _run_module_code
mod_name, mod_spec, pkg_name, script_name)
File "/azureml-envs/azureml_3ec0ba3f30b4357edd78d07bd8af8197/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "training.py", line 151, in
I have used following estimator : est = TensorFlow(source_directory='maskrcnn-train', script_params=script_params, compute_target=compute_target, pip_packages=['Cython','keras','matplotlib','scikit-image','scipy','h5py','imgaug','IPython[all]','numpy','Pillow'], entry_script='training.py', conda_packages=['mesa-libgl-cos6-x86_64','opencv=3.4.2'], use_gpu=True, use_docker=True, inputs=[ds.as_mount()])
any other conda package also need to be installed for this ?
It seems to be related to the issue discussed here: https://stackoverflow.com/questions/47113029/importerror-libsm-so-6-cannot-open-shared-object-file-no-such-file-or-directo
- Try to include “opencv-python-headless” in the pip_packages and see it works.
- If not, you can build a custom docker image on top of AML base images(i.e. mcr.microsoft.com/azureml/base-gpu:0.2.4) and include the libsm and other libraries mentioned in the thread. And use that image in estimator to submit your training job.
From: amardeepjaiman [email protected] Sent: Monday, April 15, 2019 11:17 PM To: Azure/MachineLearningNotebooks [email protected] Cc: Billy Hu [email protected]; Comment [email protected] Subject: Re: [Azure/MachineLearningNotebooks] Issues installing Opencv (#252)
Thanks, I tried to install opencv using conda package. but this time it does not find another shared library. please find the error below :
File "/azureml-envs/azureml_3ec0ba3f30b4357edd78d07bd8af8197/lib/python3.6/runpy.py", line 96, in _run_module_code mod_name, mod_spec, pkg_name, script_name) File "/azureml-envs/azureml_3ec0ba3f30b4357edd78d07bd8af8197/lib/python3.6/runpy.py", line 85, in _run_code exec(code, run_globals) File "training.py", line 151, in train(args.dataset) File "training.py", line 50, in train import imgaug File "/azureml-envs/azureml_3ec0ba3f30b4357edd78d07bd8af8197/lib/python3.6/site-packages/imgaug/init.py", line 2, in from imgaug.imgaug import * File "/azureml-envs/azureml_3ec0ba3f30b4357edd78d07bd8af8197/lib/python3.6/site-packages/imgaug/imgaug.py", line 13, in import cv2 File "/azureml-envs/azureml_3ec0ba3f30b4357edd78d07bd8af8197/lib/python3.6/site-packages/cv2/init.py", line 3, in from .cv2 import * ImportError: libSM.so.6: cannot open shared object file: No such file or directory
I have used following estimator : est = TensorFlow(source_directory='maskrcnn-train', script_params=script_params, compute_target=compute_target, pip_packages=['Cython','keras','matplotlib','scikit-image','scipy','h5py','imgaug','IPython[all]','numpy','Pillow'], entry_script='training.py', conda_packages=['mesa-libgl-cos6-x86_64','opencv=3.4.2'], use_gpu=True, use_docker=True, inputs=[ds.as_mount()])
any other conda package also need to be installed for this ?
— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FAzure%2FMachineLearningNotebooks%2Fissues%2F252%23issuecomment-483525963&data=02%7C01%7Cninhu%40microsoft.com%7C8c2be29d15f7444ddf8a08d6c2332e96%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636909922412900081&sdata=9kyRVR7oZ6aB3Xx1Mf%2Fy5%2F3t%2BFaoMARUge2toXcv96Y%3D&reserved=0, or mute the threadhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAKp3VbbtbgBGS4qCpJJEadYNFhL2Nbrvks5vhWrvgaJpZM4b2XfV&data=02%7C01%7Cninhu%40microsoft.com%7C8c2be29d15f7444ddf8a08d6c2332e96%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636909922412910075&sdata=jsX0uj6U8e95ODM%2BJh5hJoL80y3IUcCOsi%2B%2FI0au6U4%3D&reserved=0.
Closing issue per Ninghu
I had the same issue and got it to work with these exact packages (newer versions caused problems): est = TensorFlow(source_directory=script_folder, compute_target=compute_target, pip_packages=['keras'], conda_packages=['mesa-libgl-cos6-x86_64','opencv=3.4.2','numpy=1.14.5'], entry_script='resnet50.py', use_gpu=True)
Thank you Derek this is very helpful
From: Darek-S [email protected] Sent: Wednesday, June 12, 2019 5:49 AM To: Azure/MachineLearningNotebooks [email protected] Cc: Ken Kadota (Harvey Nash) [email protected]; State change [email protected] Subject: Re: [Azure/MachineLearningNotebooks] Issues installing Opencv (#252)
I had the same issue and got it to work with these exact packages (newer versions caused problems): est = TensorFlow(source_directory=script_folder, compute_target=compute_target, pip_packages=['keras'], conda_packages=['mesa-libgl-cos6-x86_64','opencv=3.4.2','numpy=1.14.5'], entry_script='resnet50.py', use_gpu=True)
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHubhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FAzure%2FMachineLearningNotebooks%2Fissues%2F252%3Femail_source%3Dnotifications%26email_token%3DAL5NQAXQYQX3J4KLJV4CMYDP2DWE7A5CNFSM4G6ZO7K2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXQJGRQ%23issuecomment-501257030&data=02%7C01%7Cv-kevk%40microsoft.com%7C702edd522d34481f62ff08d6ef346370%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636959405610750438&sdata=TKE03mwuVXCFEvuWJjUbIU0KCa4f9O0fqxAqz%2BJHvx0%3D&reserved=0, or mute the threadhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAL5NQAXSILCV2KMQYS7Q2Y3P2DWE7ANCNFSM4G6ZO7KQ&data=02%7C01%7Cv-kevk%40microsoft.com%7C702edd522d34481f62ff08d6ef346370%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636959405610750438&sdata=L%2F5E0gJYZ1DgrN4BDeGj3QTqRuyRvqMuf5nUdXNeDdo%3D&reserved=0.