Skip to content

Commit

Permalink
Update installation guide
Browse files Browse the repository at this point in the history
  • Loading branch information
MilesCranmer committed Feb 7, 2024
1 parent fb8ee4a commit 043980c
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 55 deletions.
12 changes: 5 additions & 7 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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' }}
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/CI_Windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/CI_large_nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/CI_mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
46 changes: 10 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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 .
```
Expand All @@ -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
Expand All @@ -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

Expand Down
4 changes: 2 additions & 2 deletions pysr/test/incremental_install_simulator.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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'

0 comments on commit 043980c

Please sign in to comment.