Portable Python/IPython

Question:

I am currently starting a business where I will be providing support to clients directly on their business offices. I need to be able to go to different computers and be able to run custom python scripts, my question is if there’s a way to make my python environment portable?

Asked By: Adam Chua

||

Answers:

Assuming that your users are running Windows, I see two options here.

  1. If you have already defined which scripts you will be running, compile them into exe files using py2exe, that way you can just plug a USB and run them as needed. (the caveat is that some antivirus will automatically block the unsigned executables)
  2. The other option is to use WinPython, that is a full python environment with a lot of packages already preinstalled that ives in it’s own directory. In case you need to install a new package, just use the Powershell or CMD that comes with it and use the preinstalled "pip".

I found something interesting here Portable Python. I use that method to create portable Python 3.9 and 3.10 and everything works so have a look.

Answered By: Sebs Answers

conda-pack would be a solution – https://conda.github.io/conda-pack/.

conda-pack is a command line tool for creating archives of conda environments that can be installed on other systems and locations. This is useful for deploying code in a consistent environment—potentially where python and/or conda isn’t already installed.

It will not only package the dependencies, but also won’t rely on presence of python on target machine. Conda-unpack is quite fast and you will only need to run it when your environment changes, not when your scripts do.

Answered By: proggeo
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.