Unexpected Error in Ungraded Lab - CI/CD pipelines with GitHub Actions

Hello Learners,

I am new to GitHub actions. I followed the instruction to test with Github Actions. I am getting following error. I wonder if someone can guide how to fix it? The error is in the below part of the screenshot.

Happy Learning!

Hello @abdirayimovs
Would you provide us with more detailed logs/error messages?

In the meantime, you can try to update your Node.js Version as the warning message suggests! You can try running this commands:

nvm install 16
nvm use 16

Regards Isaak

@Isaak_Kamau Hello, I have the same problem, it looks like there is a problem of incompatible dtype between models:

Could you give me some directions?

Run cd app/

8

8============================= test session starts ==============================

9platform linux – Python 3.11.0, pytest-7.4.0, pluggy-1.3.0

10rootdir: /home/runner/work/machine-learning-engineering-for-production-public/machine-learning-engineering-for-production-public/course4/week3-ungraded-labs/C4_W3_Lab_4_Github_Actions/app

11plugins: anyio-4.0.0

12collected 0 items / 1 error

13==================================== ERRORS ====================================

14_________________________ ERROR collecting test_clf.py _________________________

15/opt/hostedtoolcache/Python/3.11.0/x64/lib/python3.11/site-packages/_pytest/runner.py:341: in from_call

16 result: Optional[TResult] = func()

17/opt/hostedtoolcache/Python/3.11.0/x64/lib/python3.11/site-packages/_pytest/runner.py:372: in

18 call = CallInfo.from_call(lambda: list(collector.collect()), “collect”)

19/opt/hostedtoolcache/Python/3.11.0/x64/lib/python3.11/site-packages/_pytest/python.py:531: in collect

20 self._inject_setup_module_fixture()

21/opt/hostedtoolcache/Python/3.11.0/x64/lib/python3.11/site-packages/_pytest/python.py:545: in _inject_setup_module_fixture

22 self.obj, (“setUpModule”, “setup_module”)

23/opt/hostedtoolcache/Python/3.11.0/x64/lib/python3.11/site-packages/_pytest/python.py:310: in obj

24 self._obj = obj = self._getobj()

25/opt/hostedtoolcache/Python/3.11.0/x64/lib/python3.11/site-packages/_pytest/python.py:528: in _getobj

26 return self._importtestmodule()

27/opt/hostedtoolcache/Python/3.11.0/x64/lib/python3.11/site-packages/_pytest/python.py:617: in _importtestmodule

28 mod = import_path(self.path, mode=importmode, root=self.config.rootpath)

29/opt/hostedtoolcache/Python/3.11.0/x64/lib/python3.11/site-packages/_pytest/pathlib.py:565: in import_path

30 importlib.import_module(module_name)

31/opt/hostedtoolcache/Python/3.11.0/x64/lib/python3.11/importlib/init.py:126: in import_module

32 return _bootstrap._gcd_import(name[level:], package, level)

33:1206: in _gcd_import

34 ???

35:1178: in _find_and_load

36 ???

37:1149: in _find_and_load_unlocked

38 ???

39:690: in _load_unlocked

40 ???

41/opt/hostedtoolcache/Python/3.11.0/x64/lib/python3.11/site-packages/_pytest/assertion/rewrite.py:178: in exec_module

42 exec(co, module.dict)

43test_clf.py:4: in

44 from main import clf

45main.py:13: in

46 clf = pickle.load(file)

47sklearn/tree/_tree.pyx:714: in sklearn.tree._tree.Tree.setstate

48 ???

49sklearn/tree/_tree.pyx:1418: in sklearn.tree._tree._check_node_ndarray

50 ???

51E ValueError: node array from the pickle has an incompatible dtype:

52E - expected: {‘names’: [‘left_child’, ‘right_child’, ‘feature’, ‘threshold’, ‘impurity’, ‘n_node_samples’, ‘weighted_n_node_samples’, ‘missing_go_to_left’], ‘formats’: [‘<i8’, ‘<i8’, ‘<i8’, ‘<f8’, ‘<f8’, ‘<i8’, ‘<f8’, ‘u1’], ‘offsets’: [0, 8, 16, 24, 32, 40, 48, 56], ‘itemsize’: 64}

53E - got : [(‘left_child’, ‘<i8’), (‘right_child’, ‘<i8’), (‘feature’, ‘<i8’), (‘threshold’, ‘<f8’), (‘impurity’, ‘<f8’), (‘n_node_samples’, ‘<i8’), (‘weighted_n_node_samples’, ‘<f8’)]

54=============================== warnings summary ===============================

55…/…/…/…/…/…/…/…/…/opt/hostedtoolcache/Python/3.11.0/x64/lib/python3.11/site-packages/sklearn/base.py:347

56 /opt/hostedtoolcache/Python/3.11.0/x64/lib/python3.11/site-packages/sklearn/base.py:347: InconsistentVersionWarning: Trying to unpickle estimator StandardScaler from version 0.24.2 when using version 1.3.0. This might lead to breaking code or invalid results. Use at your own risk. For more info please refer to:

57 9. Model persistence — scikit-learn 1.3.0 documentation

58 warnings.warn(

59…/…/…/…/…/…/…/…/…/opt/hostedtoolcache/Python/3.11.0/x64/lib/python3.11/site-packages/sklearn/base.py:347

60 /opt/hostedtoolcache/Python/3.11.0/x64/lib/python3.11/site-packages/sklearn/base.py:347: InconsistentVersionWarning: Trying to unpickle estimator DecisionTreeClassifier from version 0.24.2 when using version 1.3.0. This might lead to breaking code or invalid results. Use at your own risk. For more info please refer to:

61 9. Model persistence — scikit-learn 1.3.0 documentation

62 warnings.warn(

63– Docs: How to capture warnings — pytest documentation

64=========================== short test summary info ============================

65ERROR test_clf.py - ValueError: node array from the pickle has an incompatible dtype:

66- expected: {‘names’: [‘left_child’, ‘right_child’, ‘feature’, ‘threshold’, ‘impurity’, ‘n_node_samples’, ‘weighted_n_node_samples’, ‘missing_go_to_left’], ‘formats’: [‘<i8’, ‘<i8’, ‘<i8’, ‘<f8’, ‘<f8’, ‘<i8’, ‘<f8’, ‘u1’], ‘offsets’: [0, 8, 16, 24, 32, 40, 48, 56], ‘itemsize’: 64}

67- got : [(‘left_child’, ‘<i8’), (‘right_child’, ‘<i8’), (‘feature’, ‘<i8’), (‘threshold’, ‘<f8’), (‘impurity’, ‘<f8’), (‘n_node_samples’, ‘<i8’), (‘weighted_n_node_samples’, ‘<f8’)]

68!!! Interrupted: 1 error during collection !!!

69========================= 2 warnings, 1 error in 1.72s =========================

73Error: Process completed with exit code 2.

Hello @memoros77
Sorry, I’m just seeing this now.
It seems the model was saved with an older version of sci-kit-learn, Could you give it a try to downgrade your scikit-learn version in your GitHub Actions workflow?

  name: Install scikit-learn
  run: pip install scikit-learn==0.24.2

Let me know if it works. Thank yo

You can also try out this:

@Isaak_Kamau i tried both suggestions. this is in my requirements.txt
fastapi
uvicorn
scikit-learn==0.24.2
pytest

But now its showing another error.

Hello @Waliur_Rahman
Great, if you sorted with the first error!
Could you please provide me with more details on the error you’re encountering? Typically is because one of the steps in your workflow has failed, Look for the step that has a red “x” icon next to it and check the logs associated with it for more info on what’s causing the issue

Regards
Isaak

Hi, I’m also experiencing the same (original) issue. I have attempted to install scikit_learn==0.24.2, however the install step fails due to (what appears to be) compatibility issues. I also tried to override the original install in the requirements.txt file
install-scikit_learn.pdf (207.0 KB)

I have attached a PDF log for your reference (it wouldn’t allow me to send txt or a zip).

Hello @TimJ
I didn’t have such an error on my end and it’s hard to point out what the cause but it is probably incompatible versions/ missing dependencies /build issues. Also, consider the Python version you are using and such…

The ‘X’ icon is beside install dependencies. here is the screenshot

@Isaak_Kamau sorry for mentioning you again. would really appreciate your help.

@Waliur_Rahman
No problem!
Would you please send me those entire log messages you’re getting as a .txt file (not a picture)?

Hi @Isaak_Kamau, I am facing the similar problem as the others. The workflow broke at installing scikit-learn==0.24.2.
I attached the following txt files for your review and much appreciate your advice as my assignment deadline is due in 3 days.
(1) Errors captured from Github’s Action
(2) course4-week3-lab.yml
(3) requirements.txt
(4) main.py
(5) test_clf.py

Github Action failed Log.txt.py (93.4 KB)
course4-week3-lab.yml.py (1.4 KB)
requirements.txt.py (26 Bytes)
main.py (578 Bytes)
test_clf.py (354 Bytes)

Dear MLOps Mentors, not sure if @Isaak_Kamau is available… can anyone of you help me so that I can progress my course on time. Much appreciate it.

Dear all,
I have good news to share. I managed troubleshoot the root cause of the problem - versions compatibility for the following modules: python, fastapi, scikit-learn and pytest. After changing the respective version, all works according to the lab instructions.

My detailed changes as follows:
(1) I deleted my fork from the failed test and restarted everything from scratch.
(2) Amended the course4-week3-lab.yml in the hidden directory of .github/workflows/ (see changes unlined in red)


(3) Amended requirements.txt in the directory of /machine-learning-engineering-for-production-public/course4/week3-ungraded-labs/C4_W3_Lab_4_Github_Actions (see changes in red underlined)

(4) The rest, I just followed the lab instruction as in machine-learning-engineering-for-production-public/course4/week3-ungraded-labs/C4_W3_Lab_4_Github_Actions/README.md. and they worked beautifully! With this mod, I wish you a successful lab with Github Actions.

3 Likes

Hello @BHTan
Thank you so much for sharing your solution and apologies for the delayed response from my side
Happy Learning:confetti_ball:

No worries. Thanks.