Skip to content

Commit

Permalink
updates for numpy2 issues
Browse files Browse the repository at this point in the history
  • Loading branch information
icfaust committed Jul 24, 2024
1 parent a46f359 commit 2ff802b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
15 changes: 13 additions & 2 deletions .ci/scripts/get_compatible_scipy_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,21 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# ===============================================================================
from sys import exit, stderr
from sys import argv, exit, stderr
from sys import version_info as python_version

from daal4py.sklearn._utils import sklearn_check_version
if len(argv) == 1:
from daal4py.sklearn._utils import sklearn_check_version
else:
# This is necessary to prevent import errors from sklearnex and by extension
# sklearn caused by initial scipy and/or numpy versions that are installed.
# It is written in a way to be `packaging` independent. This branch occurs
# when a sklearn version is given to the script externally.
def sklearn_check_version(ver):
ver = [int(i) if i != "" else 0 for i in ver.split(".")]
sk_ver = [int(i) if i != "" else 0 for i in str(argv[1]).split(".")]
return sk_ver[0] > ver[0] or (sk_ver[0] == ver[0] and sk_ver[1] >= ver[1])


if sklearn_check_version("1.4"):
print("Scipy version is not specified for this sklearn/python version.", file=stderr)
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ jobs:
source .github/scripts/activate_components.sh
bash .ci/scripts/setup_sklearn.sh ${{ matrix.SKLEARN_VERSION }}
pip install --upgrade -r requirements-test.txt
pip install $(python .ci/scripts/get_compatible_scipy_version.py) pyyaml
pip install $(python .ci/scripts/get_compatible_scipy_version.py ${{ matrix.SKLEARN_VERSION }}) pyyaml
if [ "${{ steps.set-env.outputs.DPCFLAG }}" == "" ]; then pip install dpctl==${{ env.DPCTL_VERSION }} dpnp==${{ env.DPNP_VERSION }}; fi
pip list
- name: Sklearnex testing
Expand Down Expand Up @@ -222,7 +222,7 @@ jobs:
call .\.github\scripts\activate_components.bat ${{ env.DPCPP_VERSION }} ${{ env.TBB_VERSION }} ${{ steps.set-env.outputs.DPCFLAG }}
bash .ci/scripts/setup_sklearn.sh ${{ matrix.SKLEARN_VERSION }}
pip install --upgrade -r requirements-test.txt
for /f "delims=" %%c in ('python .ci\scripts\get_compatible_scipy_version.py') do set SCIPY_VERSION=%%c
for /f "delims=" %%c in ('python .ci\scripts\get_compatible_scipy_version.py ${{ matrix.SKLEARN_VERSION }}') do set SCIPY_VERSION=%%c
pip install %SCIPY_VERSION%
if "${{ steps.set-env.outputs.DPCFLAG }}"=="" pip install dpctl==${{ env.DPCTL_VERSION }} dpnp==${{ env.DPNP_VERSION }}
pip list
Expand Down

0 comments on commit 2ff802b

Please sign in to comment.