Spaces:
Sleeping
Sleeping
MilesCranmer
commited on
Commit
•
3c09196
1
Parent(s):
1049889
Try to install Julia within app
Browse files- gui/app.py +12 -11
- gui/requirements.txt +0 -3
gui/app.py
CHANGED
@@ -38,21 +38,24 @@ def greet(
|
|
38 |
"Please upload a CSV file!",
|
39 |
)
|
40 |
niterations = int(niterations)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
# Need to install PySR in separate python instance:
|
42 |
os.system(
|
43 |
-
"""if [ ! -d "$HOME/.julia/environments/pysr-0.9.3" ]
|
44 |
-
|
45 |
python -c 'import pysr; pysr.install()'
|
46 |
fi"""
|
47 |
)
|
48 |
|
49 |
-
# Check if /usr/bin/julia exists:
|
50 |
-
if not os.path.isfile("/usr/bin/julia"):
|
51 |
-
return (
|
52 |
-
empty_df,
|
53 |
-
"Julia is not installed! (assuming '/usr/bin/julia')",
|
54 |
-
)
|
55 |
-
|
56 |
import pysr
|
57 |
try:
|
58 |
from julia.api import JuliaInfo
|
@@ -65,8 +68,6 @@ def greet(
|
|
65 |
empty_df,
|
66 |
error_message,
|
67 |
)
|
68 |
-
|
69 |
-
|
70 |
from pysr import PySRRegressor
|
71 |
|
72 |
df = pd.read_csv(file_obj.name)
|
|
|
38 |
"Please upload a CSV file!",
|
39 |
)
|
40 |
niterations = int(niterations)
|
41 |
+
|
42 |
+
# Install Julia:
|
43 |
+
os.system(
|
44 |
+
"""if [ ! -d "~/julia" ]; then
|
45 |
+
wget https://julialang-s3.julialang.org/bin/linux/x64/1.7/julia-1.7.3-linux-x86_64.tar.gz
|
46 |
+
tar zxvf julia-1.7.3-linux-x86_64.tar.gz
|
47 |
+
mkdir ~/julia
|
48 |
+
mv julia-1.7.3-linux/* ~/julia/
|
49 |
+
fi""")
|
50 |
+
os.environ["PATH"] += ":~/julia/bin/"
|
51 |
# Need to install PySR in separate python instance:
|
52 |
os.system(
|
53 |
+
"""if [ ! -d "$HOME/.julia/environments/pysr-0.9.3" ]; then
|
54 |
+
export PATH="$PATH:$HOME/julia/bin/"
|
55 |
python -c 'import pysr; pysr.install()'
|
56 |
fi"""
|
57 |
)
|
58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
import pysr
|
60 |
try:
|
61 |
from julia.api import JuliaInfo
|
|
|
68 |
empty_df,
|
69 |
error_message,
|
70 |
)
|
|
|
|
|
71 |
from pysr import PySRRegressor
|
72 |
|
73 |
df = pd.read_csv(file_obj.name)
|
gui/requirements.txt
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
pysr==0.9.3
|
2 |
-
numpy
|
3 |
-
pandas
|
|
|
|
|
|
|
|