-
Notifications
You must be signed in to change notification settings - Fork 24
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
Investigate and resolve Python 3.8 METplus interdependencies #2260
Comments
I have a similar but slightly different situation. I have MET compile with a 3.9 version of Python installed via conda that has all the required packages installed along with it. If I then run python embedding without using PYTHON_EXE, the user environment will use a generic, system installed python 3.9 that does not contain required packages. My solution, which worked for MET but messed up the users environment for other python tools, was to use a LD_LIBRARY_PATH pointing to the conda python environment. |
Recommend that @jprestop take the lead on this issue with @JohnHalleyGotway and @georgemccabe providing support. |
I performed the steps listed in the issue and was able to recreate the problem. @JohnHalleyGotway, thank you for the detailed, clear instructions and the information on what the problem is. Tagging @georgemccabe in case you're interested in the update here too. Setting the environment variable PYTHONHOME resolves this problem on seneca (see below), but does not resolve this problem in Docker. I'm still working on that. Putting notes below from testing on seneca in case I need to reference it later. PATH is set such that /home/met_test/.conda/envs/metplus_base.v5/bin is before the version of Python that MET was compiled with (/usr/local/met-python3/bin):
PYTHONHOME is not set:
Run the code and receive the expected error:
Set PYTHONHOME:
and rerun, getting a successful result:
Despite PYTHONHOME being set, the Python version in the PATH is still used first as expected:
As noted above, more work is needed to get this to work in Docker. |
@jprestop , finding a function call in either the Python C++ library or the relevant Python script called by MET to set the same setting that occurs by setting PYTHONHOME may be a good solution to ensure that this happens only in that environment. Setting PYTHONHOME in the environment may introduce other issues. |
I'm going through some GitHub Issues. @JohnHalleyGotway and @georgemccabe Now that we are using Python 3.10 and it is working, is this still an issue that needs to be worked on? |
If I understand this issue correctly, I believe this was resolved with PR #2407 |
This may be a duplicate of #2388 |
FYI @jprestop @JohnHalleyGotway: @georgemccabe and myself reviewed this issue and #2388, which was closed via #2407. We agreed that those two items addressed the problem outlined in this issue, and that this issue can be closed. |
Describe the Task
During the MET-11.0.0-beta3 development cycle, issue #2196 updated the version of python used in the MET Dockerfiles from 3.6 to 3.8.6. This was intended as an improvement to have MET use the same python version as what's used for automated testing in the METplus GHA. However this change had unintended consequences and caused some METplus use cases that leverage Python embedding to fail. A significant amount of time and debugging did not reveal an obvious solution. Prior to the met-11.0.0-beta3 development release, we rolled back to python version 3.6 by switching to base image dtcenter/met-base:v1.0.
This issue is to further investigate and hopefully resolve the downstream METplus Python embedding use case failures. If that is successful, update the MET python version to 3.8 in the following spots:
Dockerfile
andDockerfile.copy
, switch to dtcenter/met-base:v1.1.development.docker
, switch libraries from 3.6 to 3.8.jobs/set_job_controls.sh
, switch tomet_base_tag=v1.1
.build_docker_and_trigger_metplus.yml
, switch toMET_BASE_TAG: v1.1
.Also consider whether we could define the MET base image version in fewer spots.
Here are several things to consider:
Placing a bad (i.e. without required numpy and netcdf4 packages) python version in the path causes the python embedding to fail. We'd assumed that the python embedding version was defined at compilation time and were surprised that the bad python in the path triggered this error.
Perhaps this situation has existed for a long time but was just being masked? Python 3.6 links to libraries that include 3.6 in their names while 3.8 has libraries with 3.8 in their names. So a bad METplus python 3.8 instance and it's 3.8 libraries wouldn't interfere with MET linking to libraries named 3.6.
Recommend looking at the actual MET code (src/libcode/vx_data2d_python/python_dataplane.cc) to understand how python is being invoked. In particular, the "sys.path" lines should be examined. Recommend printing out the contents of the system path that the GlobalPython instance is using. See if/how it differs between the successful and unsuccessful runs in 1.
Time Estimate
Unknown
Sub-Issues
Consider breaking the task down into sub-issues.
Likely no sub-issues needed.
Relevant Deadlines
List relevant project deadlines here or state NONE.
Funding Source
2792541
Define the Metadata
Assignee
Labels
Projects and Milestone
Define Related Issue(s)
Consider the impact to the other METplus components.
Task Checklist
See the METplus Workflow for details.
Branch name:
feature_<Issue Number>_<Description>
Pull request:
feature <Issue Number> <Description>
Select: Reviewer(s) and Linked issues
Select: Repository level development cycle Project for the next official release
Select: Milestone as the next official version
The text was updated successfully, but these errors were encountered: