Siromanec commited on
Commit
8aec4b7
1 Parent(s): 426153d

updated script

Browse files
Files changed (1) hide show
  1. script.py +22 -20
script.py CHANGED
@@ -32,35 +32,37 @@
32
  # install_package_from_local_file('hoho')
33
 
34
  import hoho; hoho.setup() # YOU MUST CALL hoho.setup() BEFORE ANYTHING ELSE
35
- # import subprocess
36
- # import importlib
37
- # from pathlib import Path
38
- # import subprocess
39
 
40
 
41
- # ### The function below is useful for installing additional python wheels.
42
- # def install_package_from_local_file(package_name, folder='packages'):
43
- # """
44
- # Installs a package from a local .whl file or a directory containing .whl files using pip.
45
 
46
- # Parameters:
47
- # path_to_file_or_directory (str): The path to the .whl file or the directory containing .whl files.
48
- # """
49
- # try:
50
- # pth = str(Path(folder) / package_name)
51
- # subprocess.check_call([subprocess.sys.executable, "-m", "pip", "install",
52
- # "--no-index", # Do not use package index
53
- # "--find-links", pth, # Look for packages in the specified directory or at the file
54
- # package_name]) # Specify the package to install
55
- # print(f"Package installed successfully from {pth}")
56
- # except subprocess.CalledProcessError as e:
57
- # print(f"Failed to install package from {pth}. Error: {e}")
58
 
59
 
60
  # pip download webdataset -d packages/webdataset --platform manylinux1_x86_64 --python-version 38 --only-binary=:all:
61
  # install_package_from_local_file('webdataset')
62
  # install_package_from_local_file('tqdm')
63
 
 
 
64
  ### Here you can import any library or module you want.
65
  ### The code below is used to read and parse the input dataset.
66
  ### Please, do not modify it.
 
32
  # install_package_from_local_file('hoho')
33
 
34
  import hoho; hoho.setup() # YOU MUST CALL hoho.setup() BEFORE ANYTHING ELSE
35
+ import subprocess
36
+ import importlib
37
+ from pathlib import Path
38
+ import subprocess
39
 
40
 
41
+ ### The function below is useful for installing additional python wheels.
42
+ def install_package_from_local_file(package_name, folder='packages'):
43
+ """
44
+ Installs a package from a local .whl file or a directory containing .whl files using pip.
45
 
46
+ Parameters:
47
+ path_to_file_or_directory (str): The path to the .whl file or the directory containing .whl files.
48
+ """
49
+ try:
50
+ pth = str(Path(folder) / package_name)
51
+ subprocess.check_call([subprocess.sys.executable, "-m", "pip", "install",
52
+ "--no-index", # Do not use package index
53
+ "--find-links", pth, # Look for packages in the specified directory or at the file
54
+ package_name]) # Specify the package to install
55
+ print(f"Package installed successfully from {pth}")
56
+ except subprocess.CalledProcessError as e:
57
+ print(f"Failed to install package from {pth}. Error: {e}")
58
 
59
 
60
  # pip download webdataset -d packages/webdataset --platform manylinux1_x86_64 --python-version 38 --only-binary=:all:
61
  # install_package_from_local_file('webdataset')
62
  # install_package_from_local_file('tqdm')
63
 
64
+ install_package_from_local_file('scikit-learn')
65
+
66
  ### Here you can import any library or module you want.
67
  ### The code below is used to read and parse the input dataset.
68
  ### Please, do not modify it.