Spaces:
Running
Running
MilesCranmer
commited on
Commit
•
e0d0dc1
1
Parent(s):
773f98b
Get dockerfile working with PyJulia
Browse files- Dockerfile +23 -9
- pysr/sr.py +1 -1
Dockerfile
CHANGED
@@ -1,30 +1,44 @@
|
|
1 |
# This builds a dockerfile containing a working copy of PySR
|
2 |
# with all pre-requisites installed.
|
3 |
|
4 |
-
|
5 |
ARG VERSION=latest
|
|
|
6 |
FROM julia:$VERSION
|
7 |
|
8 |
RUN apt-get update && apt-get upgrade -y && apt-get install -y \
|
9 |
-
build-essential
|
10 |
-
|
|
|
|
|
11 |
&& apt-get clean \
|
12 |
&& rm -rf /var/lib/apt/lists/*
|
13 |
|
14 |
WORKDIR /pysr
|
15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
# Caches install (https://stackoverflow.com/questions/25305788/how-to-avoid-reinstalling-packages-when-building-docker-image-for-python-project)
|
17 |
ADD ./requirements.txt /pysr/requirements.txt
|
18 |
RUN pip3 install -r /pysr/requirements.txt
|
19 |
|
20 |
# Install PySR:
|
21 |
-
|
|
|
|
|
|
|
|
|
22 |
RUN pip3 install .
|
23 |
|
24 |
# Install Julia pre-requisites:
|
25 |
-
RUN
|
26 |
-
|
27 |
-
# Install IPython and other useful libraries:
|
28 |
-
RUN pip3 install ipython jupyter matplotlib
|
29 |
|
30 |
-
CMD ["bash"]
|
|
|
1 |
# This builds a dockerfile containing a working copy of PySR
|
2 |
# with all pre-requisites installed.
|
3 |
|
|
|
4 |
ARG VERSION=latest
|
5 |
+
|
6 |
FROM julia:$VERSION
|
7 |
|
8 |
RUN apt-get update && apt-get upgrade -y && apt-get install -y \
|
9 |
+
make build-essential libssl-dev zlib1g-dev \
|
10 |
+
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \
|
11 |
+
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev \
|
12 |
+
vim git \
|
13 |
&& apt-get clean \
|
14 |
&& rm -rf /var/lib/apt/lists/*
|
15 |
|
16 |
WORKDIR /pysr
|
17 |
|
18 |
+
# Install PyEnv to switch Python to dynamically linked version:
|
19 |
+
RUN curl https://pyenv.run | bash
|
20 |
+
ENV PATH="/root/.pyenv/bin:$PATH"
|
21 |
+
|
22 |
+
ENV PYTHON_VERSION="3.9.10"
|
23 |
+
RUN PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install ${PYTHON_VERSION}
|
24 |
+
ENV PATH="/root/.pyenv/versions/${PYTHON_VERSION}/bin:$PATH"
|
25 |
+
|
26 |
+
# Install IPython and other useful libraries:
|
27 |
+
RUN pip install ipython jupyter matplotlib
|
28 |
+
|
29 |
# Caches install (https://stackoverflow.com/questions/25305788/how-to-avoid-reinstalling-packages-when-building-docker-image-for-python-project)
|
30 |
ADD ./requirements.txt /pysr/requirements.txt
|
31 |
RUN pip3 install -r /pysr/requirements.txt
|
32 |
|
33 |
# Install PySR:
|
34 |
+
# We do a minimal copy so it doesn't need to rerun at every file change:
|
35 |
+
ADD ./setup.py /pysr/setup.py
|
36 |
+
ADD ./README.md /pysr/README.md
|
37 |
+
Add ./Project.toml /pysr/Project.toml
|
38 |
+
ADD ./pysr/ /pysr/pysr/
|
39 |
RUN pip3 install .
|
40 |
|
41 |
# Install Julia pre-requisites:
|
42 |
+
RUN python3 -c 'import pysr; pysr.install()'
|
|
|
|
|
|
|
43 |
|
44 |
+
CMD ["bash"]
|
pysr/sr.py
CHANGED
@@ -23,8 +23,8 @@ def install(julia_project=None):
|
|
23 |
from julia import Pkg
|
24 |
|
25 |
Pkg.activate(f"{_escape_filename(julia_project)}")
|
26 |
-
Pkg.instantiate()
|
27 |
Pkg.update()
|
|
|
28 |
Pkg.precompile()
|
29 |
|
30 |
|
|
|
23 |
from julia import Pkg
|
24 |
|
25 |
Pkg.activate(f"{_escape_filename(julia_project)}")
|
|
|
26 |
Pkg.update()
|
27 |
+
Pkg.instantiate()
|
28 |
Pkg.precompile()
|
29 |
|
30 |
|