Problem
How to create two separate Python environment to to develop and test Python Openstack nova python-novaclient
Solution
We can use a Python package called virtualenv.
To create our two separate and isolated Python environments we need to execute these commands below (the logs are from powershell).
PS C:\Users\radoslaw\workspace> virtualenv.exe nova-git New python executable in nova-git\Scripts\python.exe Installing setuptools................done. Installing pip...................done. PS C:\Users\radoslaw\workspace> virtualenv.exe nova-stable New python executable in nova-stable\Scripts\python.exe Installing setuptools................done. Installing pip...................done.
Once the env are created we have to enabled and switch to them. It is important to enable an environment before trying to run any pip commands. If you forget the requested changes are going to be performed on your default system configuration.
In every env we will install different version of the python-novaclient package. In first we are going to use the version from official Python PyPI repository. In seconds we use the latest source code from github.
PS C:\Users\radoslaw\workspace> cd .\nova-stable PS C:\Users\radoslaw\workspace\nova-stable> cd .\Scripts PS C:\Users\radoslaw\workspace\nova-stable\Scripts> .\activate.ps1 (nova-stable) PS C:\Users\radoslaw\workspace\nova-stable\Scripts> (nova-stable) PS C:\Users\radoslaw\workspace\nova-stable\Scripts> (nova-stable) PS C:\Users\radoslaw\workspace\nova-stable\Scripts> pip install python-novaclient Downloading/unpacking python-novaclient
To install the version directly from github under the second environment.
(nova-stable) PS C:\Users\radoslaw\workspace\nova-stable> deactivate PS C:\Users\radoslaw\workspace> cd .\nova-git PS C:\Users\radoslaw\workspace\nova-git> .\Scripts\activate.ps1 (nova-git) PS C:\Users\radoslaw\workspace\nova-git> pip install -e git+https://https://github.com/openstack/python-novaclient.git#egg= python-novaclient
To list installed versions
(nova-stable) PS C:\Users\radoslaw\workspace\nova-stable> pip list iso8601 (0.1.4) prettytable (0.7.1) python-novaclient (2.13.0) requests (1.2.0) simplejson (3.1.2) (nova-git) PS C:\Users\radoslaw\workspace\nova-git> pip list iso8601 (0.1.4) prettytable (0.7.1) python-novaclient (2.13.0.4.g0fc4e12, c:\users\radoslaw\workspace\nova-git\src\python-novaclient) requests (1.2.0) simplejson (3.1.2)
To upgrade the packages in the environments
(nova-stable) PS C:\Users\radoslaw\workspace\nova-stable> pip install -U python-novaclient (nova-git) PS C:\Users\radoslaw\workspace\nova-git> pip install -U python-novaclient
References
NICE BLOG!!! Your blog is very informative for us. I would really like to come back again right here for likewise good articles or blog posts. Thanks for sharing a nice information.
ReplyDeletebangalore university distance education