Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install instructions for ARM-based Macs #16

Merged
merged 4 commits into from
Nov 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,22 @@ OG-ZAF is an overlapping-generations (OG) model that allows for dynamic general

## Using and contributing to OG-ZAF

* Install the [Anaconda distribution](https://www.anaconda.com/distribution/) of Python
* If you are installing on a Mac computer, install XCode Tools. In Terminal: `xcode-select —install`
* Download and install the appropriate [Anaconda distribution](https://www.anaconda.com/products/distribution#Downloads) of Python. Select the correct version for you platform (Windows, Intel Mac, or M1 Mac).
* In Terminal:
* Make sure the `conda` package manager is up-to-date: `conda update conda`.
* Make sure the Anaconda distribution of Python is up-to-date: `conda update anaconda`.
* Fork this repository and clone your fork of this repository to a directory on your computer.
* From the terminal (or Anaconda command prompt), navigate to the directory to which you cloned this repository and run `conda env create -f environment.yml`. The process of creating the `ogzaf-dev` conda environment should not take more than five minutes.
* Then, `conda activate ogzaf-dev`
* Then install by `pip install -e .`
* **If you are installing this on a M1/M2 Mac (ARM):**
* From the terminal (or Anaconda command prompt), navigate to the directory to which you cloned this repository and run `conda env create -f environment-M1.yml`. The process of creating the `ogzaf-dev` conda environment should not take more than five minutes.
* Then, `conda activate ogzaf-dev`
* Then, `pip install --no-dependencies ogcore`
SeaCelo marked this conversation as resolved.
Show resolved Hide resolved
* Then install by `pip install -e .`
* **If you are installing this on a Windows or Intel Mac:**
* From the terminal (or Anaconda command prompt), navigate to the directory to which you cloned this repository and run `conda env create -f environment.yml`. The process of creating the `ogzaf-dev` conda environment should not take more than five minutes.
* Then, `conda activate ogzaf-dev`
* Then install by `pip install -e .`
### Run an example of the model
* Navigate to `./examples`
* Run the model with an example reform from terminal/command prompt by typing `python run_og_zaf.py`
* You can adjust the `./examples/run_og_zaf.py` by modifying model parameters specified in the dictionary passed to the `p.update_specifications()` calls.
Expand All @@ -32,7 +41,7 @@ OG-ZAF is an overlapping-generations (OG) model that allows for dynamic general
* See [`ogcore.TPI.py`](https://github.com/PSLmodels/OG-Core/blob/master/ogcore/TPI.py) for what is in the dictionary object in this pickle file
* An analogous set of files in the `./examples/OUTPUT_REFORM` directory, which represent objects from the simulation of the reform policy

Note that, depending on your machine, a full model run (solving for the full time path equilibrium for the baseline and reform policies) can take more than two hours of compute time.
Note that, depending on your machine, a full model run (solving for the full time path equilibrium for the baseline and reform policies) can take from 35 minutes to more than two hours of compute time.

If you run into errors running the example script, please open a new issue in the OG-ZAF repo with a description of the issue and any relevant tracebacks you receive.

Expand Down
34 changes: 34 additions & 0 deletions environment-M1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: ogzaf-dev
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
name: ogzaf-dev
name: ogzaf-M1-dev

channels:
- conda-forge
dependencies:
- python>=3.7.7, <=3.9.12 # This restriction can be removed as soon as these packages support Python 3.10
#- mkl>=2020.2 ## this fails on M1 Mac: "ResolvePackageNotFound: - mkl[version='>=2020.2']"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#- mkl>=2020.2 ## this fails on M1 Mac: "ResolvePackageNotFound: - mkl[version='>=2020.2']"
#- openssl=1.1.1 #to ensure compatibility with the UN Population API

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To address an incompatibility with openssl version 3
Discussion here

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SeaCelo. Let's update the name of the environment-M1.yml in line 1 to ogzaf-M1-dev.

- numpy<=1.21.2 # This restriction can be removed as soon as Numba supports NumPy 1.22
- psutil
- scipy>=1.5.0
- pandas>=1.2.5
- matplotlib
- dask>=2.30.0
- dask-core>=2.30.0
- distributed>=2.30.1
- paramtools>=0.15.0
- sphinx>=3.5.4
- sphinx-book-theme>=0.1.3
- pip
- pytest>=6.0
- pytest-pep8
- pytest-xdist
- pycodestyle
- pylint
- coverage
- requests
- xlwt
- openpyxl
- statsmodels
- linearmodels
- black
- pip:
- jupyter-book>=0.9.1
- pandas-datareader
#- ogcore
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ channels:
- conda-forge
dependencies:
- python>=3.7.7, <=3.9.12 # This restriction can be removed as soon as these packages support Python 3.10
- mkl>=2020.2
- mkl>=2020.2
- numpy<=1.21.2 # This restriction can be removed as soon as Numba supports NumPy 1.22
Comment on lines +6 to 7
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- mkl>=2020.2
- numpy<=1.21.2 # This restriction can be removed as soon as Numba supports NumPy 1.22
- mkl>=2020.2
- openssl=1.1.1 # To ensure compatibility with the UN Population API
- numpy<=1.21.2 # This restriction can be removed as soon as Numba supports NumPy 1.22

- psutil
- scipy>=1.5.0
Expand Down