demiangomez / Parallel.GAMIT

Python wrapper to parallelize GAMIT executions
BSD 3-Clause "New" or "Revised" License
37 stars 20 forks source link

Python Environmental file [merge] #89

Closed espg closed 1 month ago

espg commented 2 months ago

This PR adds an environment.yml file for ParallelGamit. This file can be used by both pip for automating the install (i.e., future hosting of the ParallelGamit library on the pypi repository), and interactively by the developers and users to create reproducible production/development environments.

Use of this file is generally achieved by mamba and/or conda. For unity, mamba is available as a module which also includes a conda install.

To setup a fresh environment for the first time

mamba env create -f environment.yml
conda activate pg

To update an existing environment after modifying environment.yml

# make changes to environment.yml
conda deactivate # drop out of activated python env
mamba env update -n pg --file environment.yml
conda activate pg

To do

Besides the first couple of items below, many of these will (likely) be separate pull requests in the future, but adding them here now for awareness:

eckendrick commented 2 months ago

I tested the new environment.yml with 3 different python scripts (StationInfoEdit, PlotETM, and ScanArchive -ppp) on u111 and all work normally. I just tested with pyParallelGamit.py and I get this error message ImportError: cannot import name '_fit_context' from 'sklearn.base' (/home/kendrick.42/.conda/envs/pg/lib/python3.10/site-packages/sklearn/base.py) conda list shows my scikit-learn is version 1.1.3

espg commented 2 months ago

@demiangomez this can probably be merged as is; items 4 and 5 are definitely separate PR's... items 2 and 3 could be added as part of those two PR's too...

demiangomez commented 2 months ago

@espg: can you please modify the readme also to add the instructions about installing and activating the environment?

mamba env create -f environment.yml conda activate pgamit

etc

I'll then merge this PR to main. Thanks

espg commented 2 months ago

@demiangomez this should be ready to merge now.

I updated INSTALL.md with instructions for installing the prerequisites-- I'll add more to that file after I setup and test the version releases in a separate PR.

Note that I removed the instructions for the proj dependency, since we aren't including that python package for the transforms... I also don't see any C code that would need the library path. (I also think that fiona / shapely / cartopy pull that base library and manage it internally already)