3

I am making a custom Python distribution for Windows. The basic idea is that I collect the packages together on my PC and then generate an executable installer which I distribute, and when run it copies the distribution to an install location on the host PC.

It works fine for most libraries but I have found that for libraries with standalone executables, most notably IPython, the 'secondary' executables end up looking for the primary Python executable in the wrong place - specifically, on the path where the distribution was created, rather than where it was subsequently installed.

For example, suppose I create the distribution in C:\Dev\ and install to C:\Python\ (on a different PC). Then I get an error like:

C:\Python\Scripts\ipython.exe
Fatal error in launcher: Unable to create process using "C:\Dev\python.exe" "C:\Python\Scripts\ipython.exe"

On the other hand, executing Ipython via imports with C:\Python\python.exe -m IPython works fine.

Peering into the ipython.exe file I see that the original path "C:\Dev\python.exe" has been hard-coded inside it, presumably when it was installed by pip.

Is there a way to specify the (eventual) install path of python.exe instead the dev path when using pip? Or is there another way to solve this problem?

5
  • Run pip after installing on the different PC? Commented Aug 7, 2014 at 16:51
  • portablepython.com aims to address exactly this issue. It seems to have solved it for IPython among others. Have you tried building up your custom distro based on a minimal Portable Python installation? Commented Aug 7, 2014 at 19:02
  • @RossRidge Not an option unfortunately, it needs to "just work" Commented Aug 7, 2014 at 21:25
  • @jez Yes, WinPython also seems to have managed it somehow. I may have to go source-diving. Commented Aug 7, 2014 at 21:27
  • Duplicate of stackoverflow.com/questions/23371712/… ? Commented Feb 16, 2016 at 8:44

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.