0

Pyenv generates env in user's home folder, which is a problem for sharing environment

  1. I do not want to install NLP and ML packages for each user
  2. I do not want to have more than single point of truth when running a project

I am familiar of separate virtualenv package (and that would be my last resort) but wondering if there is a well-known pyenv strategy on that?

mPrinC
  • 9,147
  • 2
  • 32
  • 31
  • you should be saving your dependencies in a requirement.txt file or an environment.yaml file (or Pipfile) or really any other lock file in version control. – asosnovsky Nov 09 '20 at 00:09
  • Are you using `pyenv` for a specific reason, or did you just pick it as 'any' package environment manager. In that case, you're probably better off using `virtualenv`. And installing packages for all users system-wide is not a recommended practice and can cause all sorts of admin and development nightmares, are you sure this is what you absolutely need? – Grismar Nov 09 '20 at 01:22
  • Thanks @asosnovsky we do that, but that doesn't help, I am talking about shared dev server where more than to people are working on the SAME folder (not just project), and we do not want constantly sync, we are even parallel-programming with skype at the same time, and the workflow where we have the same folder with the project but still separate environments is really meaningless – mPrinC Nov 10 '20 at 11:14
  • Hi @Grismar, I use pyenv for easy management of various python version. What I understand `pyenv` is using properly `virtualenv` as I run: `pyenv virtualenv 3.8.6 python3.8.6_env` but the problem is that it ends up in user space, and we need shared virtualenv folder that more co-devs can start – mPrinC Nov 10 '20 at 11:17

1 Answers1

2

Just set PYENV_ROOT for each user: export PYENV_ROOT="/usr/bin/.pyenv" This will make pyenv store environments in /usr/bin/.pyenv and look for existing environments there. If then user needs to restore default pyenv root they can just unset PYENV_ROOT.

tempname
  • 36
  • 1
  • 3
  • perhaps worth adding that this is usually set in the users `.profile` or the like (or `.bashrc` if you want it to apply only to bash, etc). – 2e0byo Dec 03 '21 at 19:20