Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It may be appropriate to provide some information on how to use python virtualenv #380

Open
gwarf opened this issue Jan 11, 2022 · 4 comments

Comments

@gwarf
Copy link
Member

gwarf commented Jan 11, 2022

If people blindly follow the instructions on https://docs.egi.eu/users/cloud-compute/openstack/ using python may be confusing, leading to doing system-wide install, and may not always work as expected.

As python3 natively supports virtualenvs with just a couple of commands it may be helpful to provide some short info like on how to setup and use a virtualenv to do things cleanly:

mkdir ~/.virtualenvs
# or python depending on the name of your python 3 binary
python3 -m venv ~/.virtualenvs/fedcloud
# This command will have to be run to enable the fedcloud virtualenv and access the fedcloud commands
source  ~/.virtualenvs/fedcloud/bin/activate
@sebastian-luna-valero
Copy link
Member

I would even go a step further:

# one-off install at the beginning:
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh -b -p egifedcloud
source egifedcloud/etc/profile.d/conda.sh 
conda create -n openstack python-openstackclient -c conda-forge --yes
conda activate openstack
openstack --help

# activation everytime you want to use it aftewards:
source egifedcloud/etc/profile.d/conda.sh 
conda activate openstack
openstack --help

The only change to work on OSX would be wget command with the relevant link to Miniconda from:
https://docs.conda.io/en/latest/miniconda.html

Best regards,
Sebastian

@EGI-ILM
Copy link
Contributor

EGI-ILM commented Mar 17, 2022

(And perhaps consider to mention the deactivate to clean things up)

@gwarf
Copy link
Member Author

gwarf commented Mar 18, 2022

I would even go a step further:

# one-off install at the beginning:
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh -b -p egifedcloud
source egifedcloud/etc/profile.d/conda.sh 
conda create -n openstack python-openstackclient -c conda-forge --yes
conda activate openstack
openstack --help

# activation everytime you want to use it aftewards:
source egifedcloud/etc/profile.d/conda.sh 
conda activate openstack
openstack --help

The only change to work on OSX would be wget command with the relevant link to Miniconda from: https://docs.conda.io/en/latest/miniconda.html

Best regards, Sebastian

This is more elaborated stuff to be added, and adding other stuff like conda usage (that I've never used) may add some complexity and more possible problems, and would need to document more third parties things.
I'm usually more for trying to promote using only basic stuff, like the native python3 venv, without relying on much additional components that may cause other unexpected issues.

That said it's on my current personal feeling.

@EGI-ILM
Copy link
Contributor

EGI-ILM commented Mar 18, 2022

Windows is slightly different because it calls a BAT file, but I am not sure if Windows has to be considered

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants