From 043980c338be654cac0fdef677d929588310369b Mon Sep 17 00:00:00 2001 From: MilesCranmer Date: Wed, 7 Feb 2024 18:06:44 +0000 Subject: [PATCH] Update installation guide --- .github/workflows/CI.yml | 12 ++--- .github/workflows/CI_Windows.yml | 5 +- .github/workflows/CI_large_nightly.yml | 5 +- .github/workflows/CI_mac.yml | 5 +- Dockerfile | 2 +- README.md | 46 ++++--------------- .../incremental_install_simulator.dockerfile | 4 +- 7 files changed, 24 insertions(+), 55 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 167ae73d7..dc71aa81b 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -58,9 +58,8 @@ jobs: - name: "Install PySR" run: | python -m pip install --upgrade pip - pip install -r requirements.txt - python setup.py install - python -m pysr install + pip install . + python -c 'import pysr' - name: "Install Coverage tool" run: pip install coverage coveralls - name: "Run tests" @@ -133,7 +132,7 @@ jobs: - name: "Install PySR" run: | python3 -m pip install . - python3 -m pysr install + python3 -c 'import pysr' - name: "Run tests" run: cd /tmp && python -m pysr test main @@ -177,9 +176,8 @@ jobs: - name: "Install PySR and all dependencies" run: | python -m pip install --upgrade pip - python -m pip install -r requirements.txt - python -m pip install mypy - python -m pip install . + pip install . + pip install mypy - name: "Install additional dependencies" run: python -m pip install jax jaxlib torch if: ${{ matrix.python-version != '3.7' }} diff --git a/.github/workflows/CI_Windows.yml b/.github/workflows/CI_Windows.yml index b0da93fca..8f8adc421 100644 --- a/.github/workflows/CI_Windows.yml +++ b/.github/workflows/CI_Windows.yml @@ -52,9 +52,8 @@ jobs: - name: "Install PySR" run: | python -m pip install --upgrade pip - pip install -r requirements.txt - python setup.py install - python -m pysr install + pip install . + python -c 'import pysr' - name: "Run tests" run: | python -m pysr test main diff --git a/.github/workflows/CI_large_nightly.yml b/.github/workflows/CI_large_nightly.yml index 827bb7b2f..3f71957d1 100644 --- a/.github/workflows/CI_large_nightly.yml +++ b/.github/workflows/CI_large_nightly.yml @@ -40,9 +40,8 @@ jobs: - name: "Install PySR" run: | python -m pip install --upgrade pip - pip install -r requirements.txt - python setup.py install - python -m pysr install + pip install . + python -c 'import pysr' - name: "Run tests" run: | python -m pysr test main diff --git a/.github/workflows/CI_mac.yml b/.github/workflows/CI_mac.yml index 8287bfddf..395217973 100644 --- a/.github/workflows/CI_mac.yml +++ b/.github/workflows/CI_mac.yml @@ -52,9 +52,8 @@ jobs: - name: "Install PySR" run: | python -m pip install --upgrade pip - pip install -r requirements.txt - python setup.py install - python -m pysr install + pip install . + python -c 'import pysr' - name: "Run tests" run: | python -m pysr test main diff --git a/Dockerfile b/Dockerfile index 86824e8d7..fcbd8e66c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,7 +28,7 @@ ADD ./pysr/ /pysr/pysr/ RUN pip3 install . # Install Julia pre-requisites: -RUN python3 -m pysr install +RUN python3 -c 'import pysr' # metainformation LABEL org.opencontainers.image.authors = "Miles Cranmer" diff --git a/README.md b/README.md index d6f541a12..5aa949c00 100644 --- a/README.md +++ b/README.md @@ -27,10 +27,6 @@ If you've finished a project with PySR, please submit a PR to showcase your work - [Contributors](#contributors-) - [Why PySR?](#why-pysr) - [Installation](#installation) - - [pip](#pip) - - [conda](#conda) - - [docker](#docker-build) - - [Troubleshooting](#troubleshooting) - [Quickstart](#quickstart) - [→ Documentation](https://astroautomata.com/PySR) @@ -129,48 +125,31 @@ an explicit and powerful way to interpret deep neural networks. ## Installation -| [pip](#pip) | [conda](#conda) | [docker](#docker-build) | -|:---:|:---:|:---:| -| Everywhere (recommended) | Linux and Intel-based macOS | Everywhere (if all else fails) | +### Pip ---- - -### pip +You can install PySR with pip: -1. [Install Julia](https://julialang.org/downloads/) - - Alternatively, my personal preference is to use [juliaup](https://github.com/JuliaLang/juliaup#installation), which performs this automatically. -2. Then, run: ```bash -pip3 install -U pysr +pip install pysr ``` -3. Finally, to install Julia dependencies: -```bash -python3 -m pysr install -``` -> (Alternatively, from within Python, you can call `import pysr; pysr.install()`) ---- +Julia dependencies will be installed at first import. -### conda +### Conda -The PySR build in conda includes all required dependencies, so you can install it by simply running: +Similarly, with conda: ```bash conda install -c conda-forge pysr ``` -from within your target conda environment. -However, note that the conda install does not support precompilation of Julia libraries, so the -start time may be slightly slower as the JIT-compilation will be running. -(Once the compilation finishes, there will not be a performance difference though.) - ---- +### Docker -### docker build +You can also use the `Dockerfile` to install PySR in a docker container 1. Clone this repo. -2. In the repo, run the build command with: +2. Within the repo's directory, build the docker container: ```bash docker build -t pysr . ``` @@ -185,11 +164,7 @@ For more details, see the [docker section](#docker). ### Troubleshooting -Common issues tend to be related to Python not finding Julia. -To debug this, try running `python3 -c 'import os; print(os.environ["PATH"])'`. -If none of these folders contain your Julia binary, then you need to add Julia's `bin` folder to your `PATH` environment variable. - -Another issue you might run into can result in a hard crash at import with +One issue you might run into can result in a hard crash at import with a message like "`GLIBCXX_...` not found". This is due to another one of the Python dependencies loading an incorrect `libstdc++` library. To fix this, you should modify your `LD_LIBRARY_PATH` variable to reference the Julia libraries. For example, if the Julia @@ -202,7 +177,6 @@ export LD_LIBRARY_PATH=$HOME/.julia/juliaup/julia-1.10.0+0.x64.linux.gnu/lib/jul to your `.bashrc` or `.zshrc` file. -**Running PySR on macOS with an M1 processor:** you should use the pip version, and make sure to get the Julia binary for ARM/M-series processors. ## Quickstart diff --git a/pysr/test/incremental_install_simulator.dockerfile b/pysr/test/incremental_install_simulator.dockerfile index 62811e8c3..039981174 100644 --- a/pysr/test/incremental_install_simulator.dockerfile +++ b/pysr/test/incremental_install_simulator.dockerfile @@ -40,7 +40,7 @@ ADD ./pysr/ /pysr/pysr/ # First install of PySR: RUN python3 -m pip install . -RUN python3 -m pysr install +RUN python3 -c 'import pysr' # Change Python version: RUN pyenv install 3.10 && pyenv global 3.10 && pyenv uninstall -f 3.9.2 @@ -49,4 +49,4 @@ RUN python3 -m pip install --upgrade pip # Second install of PySR: RUN python3 -m pip install . RUN rm -r ~/.julia/environments/pysr-* -RUN python3 -m pysr install +RUN python3 -c 'import pysr'