1

I am working with Python on an offline Red Hat Enterprise Linux machine, mainly using Data Science and AI libraries.

As Anaconda is no more an option, I would like to install a bunch of libraries inside a virtual environment, referencing the Python operating system interpreter.

This virtual environment will probably be huge and I would like to create smaller virtual environments for every project referencing THIS huge virtual environment.

So I will have the following hierarchy:

Python system interpreter/Python standard library
|
|__ (huge) Python virtual environment including a bunch of libraries
|
|__ (small) Python virtual environment including zero or a few additional libraries

Is it a valid use case of virtual envs ? Is there a better way to achieve this ? Partially mirroring offline the official PyPI.org is not an option too.

Christophe
  • 119
  • 12
  • As far as I know, none of this is possible. At least not easily. I guess I could think of some tricks to maybe make it work somehow, but I doubt it would be any friendly. -- I am also wondering if maybe I saw a very similar question on this website before. – sinoroc Nov 14 '22 at 20:50
  • Thank you @sinoroc. I didn't find a similar question on so but maybe I missed it. I will search another solution, maybe based on multiple site-directories. As I am an absolute beginner in Python installation stuff, it can take me a while. – Christophe Nov 14 '22 at 21:10
  • Symlinking `site-packages` directories, or playing with `.pth` files, or the `PYTHONPATH` environment variable, or modifying the `sys.path` variable could all be helpful, but they all have their pros and cons (of course). Depending on your exact use case one of those might be a good fit. -- Maybe related: https://stackoverflow.com/q/50953575 – sinoroc Nov 14 '22 at 23:09

0 Answers0