-
Notifications
You must be signed in to change notification settings - Fork 76
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
InVEST 64-bit workflow using conda with Python 3.8 #314
InVEST 64-bit workflow using conda with Python 3.8 #314
Conversation
removing coverage commands and putting a string around wild card omit allowed tests to pass / make to pass. Now try adding back to extra coverage commands to see which was the deal breaker.
Hey @davemfish I was just looking at this and I think it's a good avenue but will be a little tricky because of "activating" the environment depending on whether you are already in a Sorry, the tricky bit is using the |
Update other workflows to use no mkl versions of numpy and scipy as well.
Okay, thanks for looking into it @dcdenu4 . I don't mind at all if it's pushed to a new issue & PR. I'll make an issue for the broader "invest build process should meet the needs of the invest-workbench build process" issue. |
@davemfish @phargogh @emlys I just pushed a change to the |
The way the regular expression was set up, it was grabbing `dist/invest/invest.exe` and not `dist/InVEST_[fork-tag-rev]_Setup.exe`.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @dcdenu4 , I found a few very minor things to note on the workflows here. And I think I found a powershell reference that is causing the mac builds to fail at the moment. Thanks for taking a look!
I also noticed several "Restore pip cache" steps in the workflows and I wonder if those can be purged give the very light usage of pip that is left. Or maybe it's just safer & better to leave them in.
with: | ||
python-version: ${{ env.PYTHON_VERSION }} | ||
architecture: ${{ env.PYTHON_ARCH }} | ||
activate-environment: winbin-env # This is also hardcoded in Pyinstaller's invest.spec |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't the spec referring to os.environ['CONDA_PREFIX']
now? Maybe this comment is outdated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, these were leftover comments and have been removed.
uses: goanpeca/[email protected] | ||
with: | ||
activate-environment: mac-env # This is also hardcoded in Pyinstaller's invest.spec | ||
activate-environment: macbin-env # This is also hardcoded in Pyinstaller's invest.spec |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as above, I think this code comment may be outdated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed!
exclude: | ||
- os: macos-latest | ||
python-architecture: x86 | ||
numpy: "numpy=1.15" # fuzzy assertion in conda is single '=' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I never knew that!
.github/workflows/build-and-test.yml
Outdated
pip install toml twine ${{ matrix.numpy }} | ||
pip install $(python -c "import toml;print(' '.join(toml.load('pyproject.toml')['build-system']['requires']))") | ||
conda install ${{ matrix.numpy }} | ||
python -m pip install scipy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may not matter much when it's installed, but is scipy really a build dependency?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, fixed here: b66ed3b
Makefile
Outdated
$(BASHLIKE_SHELL_COMMAND) "$(PYTHON) -m pip freeze --all > $(INVEST_BINARIES_DIR)/package_versions.txt" | ||
# wrapping conda command in powershell since some windows bash shells | ||
# don't have access to conda command. | ||
powershell.exe -Command "conda list --export > $(INVEST_BINARIES_DIR)/package_versions.txt" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this powershell reference is what is causing the Mac builds to fail right now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yea, oops. Looks like the homebrew Mac bugs have been fixed though!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for spotting this. I fixed it here: fa4e458 by setting a CONDA
environment variable that calls conda
for mac/nix and conda.bat
for windows.
This is because Windows is really looking for conda.bat and from a bash shell doesn't recognize conda without the extension
Good question @davemfish . Right along with that, should we be handling a Conda cache somewhere as well? What do you think @phargogh ? I think I've answered all other questions and did fix the windows signing issue (spoiler, I was signing The link to test the Windows installer is here: |
I implemented the pip cache because it was (at the time) strongly recommended in the github actions docs. In practice, I never got the cache to work reliably such that we would actually use our previously cached items. And it took quite a while to get to that point! In our case, and given how much time caching took up to implement, I'd suggest that we pursue caching only if we know that a significant amount of runtime is spent downloading artifacts from conda or pypi, and the speedup promised from avoiding these downloads outweighs the cost of unzipping the cache. |
Hey @davemfish and @phargogh , as I mentioned on the call today, I think we should punt on any changes to caching as outside this PRs scope. I'll make an issue with some of the discussion we've had. (#326) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Latest changes look good to me!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Just had a question about possible unused RM
and RMDIR
variables
Makefile
Outdated
@@ -248,10 +252,10 @@ $(DIST_DIR)/natcap.invest%.zip: | $(DIST_DIR) | |||
# on Windows as the .exe extension is assumed. | |||
binaries: $(INVEST_BINARIES_DIR) | |||
$(INVEST_BINARIES_DIR): | $(DIST_DIR) $(BUILD_DIR) | |||
-$(RMDIR) $(BUILD_DIR)/pyi-build | |||
-$(RMDIR) $(INVEST_BINARIES_DIR) | |||
-rm -r $(BUILD_DIR)/pyi-build |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can these use the RMDIR
variable defined on lines 27/52?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed here: f8a92c7
Makefile
Outdated
@@ -269,11 +273,11 @@ $(APIDOCS_ZIP_FILE): $(APIDOCS_HTML_DIR) | |||
userguide: $(USERGUIDE_HTML_DIR) $(USERGUIDE_ZIP_FILE) | |||
$(USERGUIDE_HTML_DIR): $(GIT_UG_REPO_PATH) | $(DIST_DIR) | |||
$(MAKE) -C doc/users-guide SPHINXBUILD="$(PYTHON) -m sphinx" BUILDDIR=../../build/userguide html | |||
-$(RMDIR) $(USERGUIDE_HTML_DIR) | |||
-rm -r $(USERGUIDE_HTML_DIR) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, it looks like the RMDIR
variable is unused
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed here: f8a92c7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great to me ... thanks a ton for shepherding this build process into the future @dcdenu4 !
jenkins: | ||
$(JENKINS_BUILD_SCRIPT) | ||
|
||
jenkins_test_ui: env | ||
$(MAKE) PYTHON=$(ENV_SCRIPTS)/python test_ui | ||
|
||
jenkins_test: env $(GIT_TEST_DATA_REPO_PATH) | ||
$(MAKE) PYTHON=$(ENV_SCRIPTS)/python test | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fare thee well, jenkins.
.. note:: | ||
The ``make`` commands for InVEST require a BASH shell environment. Windows | ||
users can use Git Bash within the Git for Windows suite. More infomration | ||
can be found at https://gitforwindows.org |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, excellent. Thanks for noting this!
@dcdenu4 I just resolved the merge conflict on |
Looks like the mac issue must have been related to the github actions thing as we suspected. Looks good! I'll merge now. |
🎉 |
These changes update the build workflow to only 64-bit and add python 3.8 testing. The build workflow now uses conda almost exclusively to handle InVEST dependencies to the point that our hosted binaries from Gohlke are no longer being used. Python 3.8 binaries are not being built because Pyinstaller does not yet officially support python 3.8, though it seems to be coming in the next release.
Github workflow files
InVEST spec and hooks
spatiallib*.dll
handling for windowsPROJ
folder andproj.db
PROJ_LIB
environment variable setting to runtime hookMakefile
It would be great if people could download the installer and test models. I tested UCM since it had a
shapely
import and it ran okay.References issue #4
References issue #1