cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Machine Learning
Dive into the world of machine learning on the Databricks platform. Explore discussions on algorithms, model training, deployment, and more. Connect with ML enthusiasts and experts.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Installing opencv-python on DBX

drii_cavalcanti
New Contributor III

Hi everyone,

I was wondering how I can install such a basic Python package on Databricks without running into conflict issues or downgrading to a runtime version lower than 15.

Specs:
The worker type is g4dn.xlarge [T4].
The runtime is 16.4 LTS (includes Apache Spark 3.5.2, Scala 2.13).

1 ACCEPTED SOLUTION

Accepted Solutions

szymon_dybczak
Esteemed Contributor III

Hi @drii_cavalcanti ,

You encountered this issue because opencv-python depends on packages that still require numpy in version lower than 2. 
You need to reinstall numpy to supported version and then try once again installing library. You can do it using following command:

 

%pip install opencv-python numpy==1.26.4 --force-reinstall

I've tested it on the same DBR and cluster as your and as you can see below, it worked:

szymon_dybczak_0-1754982305226.png

 

 

View solution in original post

2 REPLIES 2

szymon_dybczak
Esteemed Contributor III

Hi @drii_cavalcanti ,

You encountered this issue because opencv-python depends on packages that still require numpy in version lower than 2. 
You need to reinstall numpy to supported version and then try once again installing library. You can do it using following command:

 

%pip install opencv-python numpy==1.26.4 --force-reinstall

I've tested it on the same DBR and cluster as your and as you can see below, it worked:

szymon_dybczak_0-1754982305226.png

 

 

Hi @drii_cavalcanti ,

If the answer was helpful to you, please consider marking it as accepted solution. This way we help others with similar question/issue find the correct answer.