Spaces:
Sleeping
Sleeping
MilesCranmer
commited on
Commit
•
0ef4d05
1
Parent(s):
490251d
Try quieting all Pkg commands
Browse files- pysr/sr.py +9 -8
pysr/sr.py
CHANGED
@@ -29,7 +29,7 @@ def install(julia_project=None, quiet=False): # pragma: no cover
|
|
29 |
julia_project = _get_julia_project(julia_project)
|
30 |
|
31 |
Main = init_julia()
|
32 |
-
|
33 |
|
34 |
if quiet:
|
35 |
# Point IO to /dev/null
|
@@ -41,7 +41,7 @@ def install(julia_project=None, quiet=False): # pragma: no cover
|
|
41 |
# use Main.eval:
|
42 |
Main.eval(f'Pkg.activate("{_escape_filename(julia_project)}", io={io})')
|
43 |
try:
|
44 |
-
Pkg.update()
|
45 |
except RuntimeError as e:
|
46 |
raise ModuleNotFoundError(
|
47 |
"Could not update Julia project. "
|
@@ -49,12 +49,13 @@ def install(julia_project=None, quiet=False): # pragma: no cover
|
|
49 |
"To switch to an always-updated registry, "
|
50 |
"see the solution in https://github.com/MilesCranmer/PySR/issues/27."
|
51 |
) from e
|
52 |
-
Pkg.instantiate()
|
53 |
-
Pkg.precompile()
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
|
|
58 |
|
59 |
|
60 |
def import_error_string(julia_project=None):
|
|
|
29 |
julia_project = _get_julia_project(julia_project)
|
30 |
|
31 |
Main = init_julia()
|
32 |
+
Main.eval("using Pkg")
|
33 |
|
34 |
if quiet:
|
35 |
# Point IO to /dev/null
|
|
|
41 |
# use Main.eval:
|
42 |
Main.eval(f'Pkg.activate("{_escape_filename(julia_project)}", io={io})')
|
43 |
try:
|
44 |
+
Main.eval(f"Pkg.update(io={io})")
|
45 |
except RuntimeError as e:
|
46 |
raise ModuleNotFoundError(
|
47 |
"Could not update Julia project. "
|
|
|
49 |
"To switch to an always-updated registry, "
|
50 |
"see the solution in https://github.com/MilesCranmer/PySR/issues/27."
|
51 |
) from e
|
52 |
+
Main.eval(f"Pkg.instantiate(io={io})")
|
53 |
+
Main.eval(f"Pkg.precompile(io={io})")
|
54 |
+
if not quiet:
|
55 |
+
warnings.warn(
|
56 |
+
"It is recommended to restart Python after installing PySR's dependencies,"
|
57 |
+
" so that the Julia environment is properly initialized."
|
58 |
+
)
|
59 |
|
60 |
|
61 |
def import_error_string(julia_project=None):
|