PyCall.jl icon indicating copy to clipboard operation
PyCall.jl copied to clipboard

Portable Installation of `PyCall`, `Conda` and `PyPlot`

Open RoyiAvital opened this issue 4 years ago • 7 comments

On its installation PyCall, Conda and PyPlot creates many files which embed absolute paths. See https://github.com/JuliaPy/PyCall.jl/issues/767, https://github.com/JuliaPy/Conda.jl/issues/179, etc... Also the file qt.conf on the Conda folder (Relates to PyPlot).

I wonder if:

  1. The files will be written using relative paths instead of absolute paths.
  2. In case (1) isn't achievable, could a function be added to PyCall, Conda and PyPlot to regenerate the files with the updated path?

Currently, the only option is to remove all of them, delete the folders (Including Conda), remove the precompilations files and reinstall.

RoyiAvital avatar Mar 26 '21 22:03 RoyiAvital

I think we could use relative paths for things in .julia at least?

stevengj avatar Mar 26 '21 22:03 stevengj

@stevengj , That would be great. Will make things Portable.

In the meanwhile, any way to force regeneration of the files? Like a forced build() or something like that?

RoyiAvital avatar Mar 26 '21 23:03 RoyiAvital

You can certainly re-run build for each package…it should re-generate the files if they have changed.

stevengj avatar Mar 27 '21 02:03 stevengj

Will build() also update qt.conf and Conda related settings files?

RoyiAvital avatar Mar 27 '21 09:03 RoyiAvital

OK, Moving the .julia folder and rerunning Pkg.build("PyCall"), Pkg.build("Conda") and Pkg.build("PyPlot") didn't regenerate the configuration files with the updated paths.

So I think this also should be taken care of, that build() will make sure all configuration is regenerated.

RoyiAvital avatar Mar 27 '21 10:03 RoyiAvital

How can one force PyPlot() to run what it is running on first use again? It seems that's the procedure which configures Qt.

RoyiAvital avatar Mar 27 '21 10:03 RoyiAvital

At Juliawin we make some changes to the environment before running any of the underlying binaries. Currently it's a bit of a game of whack-a-mole to keep Julia portable, but in summary this is what we have done to achieve some level of portability:

  • check whether the path has changed between runs, if so continue next bullet points
  • overwrite conda\qt.conf with current paths
  • delete .julia\compiled, .julia\conda, .julia\\prefs\IJulia
  • do Pkg.build on PyCall, Conda, and IJulia

Here is the full script (in Windows batch unfortunately): https://github.com/heetbeet/juliawin/blob/main/bin/activate-juliawin-portability.bat

These requirements change over time as Anaconda and PyCall+friends grow in complexity. Some of the portability issues comes from Anaconda directly, so that would be quite difficult to address that from the PyCall side.

From the perspective of Juliawin, it would already be quite the help if PyCall has the option of having relative file-paths after compilation. Rebuilding all the packages is the more expensive part of the portability optimization.

heetbeet avatar Mar 28 '21 11:03 heetbeet