I have two Python libraries that I need to run within the same environment. They are pptk and torch-scatter and do not have an overlapping Python version requirement; pptk <= 3.7 and torch-scatter >= 3.8. They both make somewhat heavy use of C++ to enhance their functionality and I doubt I have the technical skills required to update/downdate them for eithers required Python version.
Given that pptk is a plotting library the only solution I see is to create a Python 3.8 environment and install torch-scatter. Then write a script to take whatever data I wish to provide to pptk to display, pickle it to NamedTemporaryFile. Finally start a new process and pass the file name to it as an argument, the process would run a Python 3.7 environment with pptk installed, load the file, and display the data.
Is there are simpler solution than the one described? Is there some support in Python to call a differently Python versioned library and perform some automagic marshalling?
If no one else provides a better solution, and someone stumbles here in the future, here is the solution I've implemented WYSIWYG.
The function
pptk_subprocesstakes in the data that I display, performs some manipulations, and writes it to aNamedTemporaryFile. The file name is then passed into thecommandsstring. This string starts up the Anaconda environment in which thepptklibrary lives and runs the current__file__in that environment. In__main__this file is loaded and the data is read to display. There is also the option to write some data back to thepptk_subprocess"context" through the sameNamedTemporaryFilebyshutil.copyfiledata into it.This solution seems to only work from the command line and not through an IDE's
runfunctionality.