MilesCranmer commited on
Commit
2c4d7e9
2 Parent(s): e74b8ad 61ddc76

Merge pull request #363 from MilesCranmer/pycall-install-help

Browse files
.github/workflows/CI.yml CHANGED
@@ -78,6 +78,15 @@ jobs:
78
  COVERALLS_PARALLEL: true
79
  run: coveralls --service=github
80
 
 
 
 
 
 
 
 
 
 
81
  conda_test:
82
  runs-on: ${{ matrix.os }}
83
  defaults:
 
78
  COVERALLS_PARALLEL: true
79
  run: coveralls --service=github
80
 
81
+ incremental_install:
82
+ runs-on: ubuntu-latest
83
+ steps:
84
+ - uses: actions/checkout@v2
85
+ - name: "Build incremental install"
86
+ run: docker build -t pysr -f pysr/test/incremental_install_simulator.dockerfile .
87
+ - name: "Test incremental install"
88
+ run: docker run --rm pysr /bin/bash -l -c 'python3 -m pysr.test main && python3 -m pysr.test env'
89
+
90
  conda_test:
91
  runs-on: ${{ matrix.os }}
92
  defaults:
pysr/julia_helpers.py CHANGED
@@ -81,7 +81,20 @@ def install(julia_project=None, quiet=False, precompile=None): # pragma: no cov
81
  if precompile == False:
82
  os.environ["JULIA_PKG_PRECOMPILE_AUTO"] = "0"
83
 
84
- julia.install(quiet=quiet)
 
 
 
 
 
 
 
 
 
 
 
 
 
85
  Main, init_log = init_julia(julia_project, quiet=quiet, return_aux=True)
86
  io_arg = _get_io_arg(quiet)
87
 
 
81
  if precompile == False:
82
  os.environ["JULIA_PKG_PRECOMPILE_AUTO"] = "0"
83
 
84
+ try:
85
+ julia.install(quiet=quiet)
86
+ except julia.tools.PyCallInstallError:
87
+ # Attempt to reset PyCall.jl's build:
88
+ subprocess.run(
89
+ [
90
+ "julia",
91
+ "-e",
92
+ f'ENV["PYTHON"] = "{sys.executable}"; import Pkg; Pkg.build("PyCall")',
93
+ ],
94
+ )
95
+ # Try installing again:
96
+ julia.install(quiet=quiet)
97
+
98
  Main, init_log = init_julia(julia_project, quiet=quiet, return_aux=True)
99
  io_arg = _get_io_arg(quiet)
100
 
pysr/test/incremental_install_simulator.dockerfile ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This dockerfile simulates a user installation that first
2
+ # builds PySR for Python 3.9, and then upgrades to Python 3.10.
3
+ # Normally this would cause an error when installing PyCall, so we want to
4
+ # ensure that PySR can automatically patch things.
5
+ FROM debian:bullseye-slim
6
+
7
+ ENV DEBIAN_FRONTEND=noninteractive
8
+
9
+ # Install juliaup and pyenv:
10
+ RUN apt-get update && apt-get install -y curl git build-essential \
11
+ libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev \
12
+ libncurses5-dev libncursesw5-dev xz-utils libffi-dev liblzma-dev && \
13
+ apt-get clean && \
14
+ rm -rf /var/lib/apt/lists/*
15
+
16
+ # Install juliaup:
17
+ RUN curl -fsSL https://install.julialang.org | sh -s -- -y
18
+
19
+ # Install pyenv:
20
+ RUN curl -fsSL curl https://pyenv.run | sh && \
21
+ echo 'export PATH="/root/.pyenv/bin:$PATH"' >> ~/.bashrc && \
22
+ echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc && \
23
+ echo 'eval "$(pyenv init -)"' >> ~/.bashrc && \
24
+ echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bashrc
25
+
26
+ # Default to using bash -l:
27
+ SHELL ["/bin/bash", "-l", "-c"]
28
+
29
+ RUN juliaup add 1.8 && juliaup default 1.8
30
+ RUN pyenv install 3.9.2 && pyenv global 3.9.2
31
+ RUN python3 -m pip install --upgrade pip
32
+
33
+ # Get PySR source:
34
+ WORKDIR /pysr
35
+ ADD ./requirements.txt /pysr/requirements.txt
36
+ RUN python3 -m pip install -r /pysr/requirements.txt
37
+
38
+ ADD ./setup.py /pysr/setup.py
39
+ ADD ./pysr/ /pysr/pysr/
40
+
41
+ # First install of PySR:
42
+ RUN python3 -m pip install .
43
+ RUN python3 -m pysr install
44
+
45
+ # Change Python version:
46
+ RUN pyenv install 3.10 && pyenv global 3.10 && pyenv uninstall -f 3.9.2
47
+ RUN python3 -m pip install --upgrade pip
48
+
49
+ # Second install of PySR:
50
+ RUN python3 -m pip install .
51
+ RUN rm -r ~/.julia/environments/pysr-*
52
+ RUN python3 -m pysr install
pysr/version.py CHANGED
@@ -1,2 +1,2 @@
1
- __version__ = "0.14.2"
2
  __symbolic_regression_jl_version__ = "0.19.1"
 
1
+ __version__ = "0.14.3"
2
  __symbolic_regression_jl_version__ = "0.19.1"