File tree 1 file changed +24
-4
lines changed
1 file changed +24
-4
lines changed Original file line number Diff line number Diff line change 18
18
import re
19
19
import sys
20
20
import warnings
21
+ import platform
22
+ import subprocess
23
+ from distutils .version import LooseVersion
21
24
from setuptools import find_packages , setup
22
25
from setuptools .command .test import test as test_command
23
26
from setuptools .command .install import install as install_command
@@ -45,6 +48,19 @@ def read(*path):
45
48
with version_file .open () as file :
46
49
return file .read ()
47
50
51
+ def check_and_update_numpy (min_acceptable = '1.15' ):
52
+ try :
53
+ import numpy as np
54
+ update_required = LooseVersion (np .__version__ ) < LooseVersion (min_acceptable )
55
+ except ImportError :
56
+ update_required = True
57
+ if update_required :
58
+ subprocess .call (['pip3' , 'install' , 'numpy>={}' .format (min_acceptable )])
59
+
60
+
61
+ class CoreInstall (install_command ):
62
+ pass
63
+
48
64
49
65
class CoreInstall (install_command ):
50
66
pass
@@ -67,10 +83,14 @@ def find_version(*path):
67
83
try :
68
84
importlib .import_module ('cv2' )
69
85
except ImportError as opencv_import_error :
70
- warnings .warn (
71
- "Problem with cv2 import: \n {}\n opencv-python will be added to requirements" .format (opencv_import_error )
72
- )
73
- requirements .append ('opencv-python' )
86
+ if platform .processor () != 'aarch64' :
87
+ warnings .warn (
88
+ "Problem with cv2 import: \n {}\n opencv-python will be added to requirements" .format (opencv_import_error )
89
+ )
90
+ requirements .append ('opencv-python' )
91
+ else :
92
+ warnings .warn ("Problem with cv2 import: \n {}.\n Probably due to unsuitable numpy version, will be updated" .format (opencv_import_error ))
93
+ check_and_update_numpy ()
74
94
75
95
setup (
76
96
name = "accuracy_checker" ,
You can’t perform that action at this time.
0 commit comments