1

I have a Python program that has dependencies on other Python libraries. I have used virtualenv and pip to get requirements.txt for all the libs needed to run the app, and thus keeping the environment clean of unnecessary libs. Things work great and I can make progress in developing the app.

This works on my machine, but the issue is that I need to package the app and deploy/distribute to an environment where the requirements.txt and pip cannot be used to simply download the dependencies. The target environment needs a fully functional application.

I'm a bit confused with all these tools offered by Python, such as setuptools and distutils, since none of them seem to offer this (at least easily).

I'm used to Java way, with Maven/Gradle etc. where one simply states dependencies and they are added to the distributable jar/war, unless explicitly stated otherwise.

The dependencies are install inside my virtual environment, under scripts/dir. Is there some easy way to get the dependencies bundled within my app with standard tools, or do I need to roll my own for this?

jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
kaskelotti
  • 4,709
  • 9
  • 45
  • 72
  • What *is* the target environment? If you want to create an executable version, google for that; there are existing questions covering the various options. – jonrsharpe Nov 19 '16 at 20:14
  • @jonrsharpe The target environment shouldn't matter. It has Python installed, that should be enough. For clarity, I **don't** want an exe file. – kaskelotti Nov 19 '16 at 20:18
  • ...but that isn't enough, as you also have dependencies. An executable doesn't necessarily mean a `.exe`. Could you provide some more context? – jonrsharpe Nov 19 '16 at 20:20
  • Changes are that I'm not on the same page with you, probably due to my lack of knowledge in Python development. Anyway, I have an application which is pure Python code. All the libs that are in use are also pure Python. No C extensions, Java, .Net et cetera. Now, I've been under the impression that having a Python runtime installed on the target machine would be enough to run the application, as long as all the required libs are available as well. – kaskelotti Nov 19 '16 at 20:27
  • That's true then, but you have to get them there. Virtual environments aren't designed to be distributable. Wheels don't include dependencies. There are various questions on the other options - see e.g. http://stackoverflow.com/q/28237312/3001761, http://stackoverflow.com/q/106725/3001761, http://stackoverflow.com/q/26019920/3001761. If you cannot find an answer, please be specific about your problem and how the existing resources fail to solve it. – jonrsharpe Nov 19 '16 at 20:32
  • @jonrsharpe, Thanks for the links. I read though the questions. If I understood correctly, all of the solutions (pip+wheel, conda) seems to require the build tool to be installed on the target environment as well, in order to unpackage the distributable. Thus requiring more than plain Python installation. Installing tools such as pip and wheel, might be an option, but I'd really like to avoid it if possible. – kaskelotti Nov 21 '16 at 10:07

0 Answers0