What is the purpose of running Ocean programs within a virtualenv?
I accidentally installed the dwave-ocean-sdk package outside of a virtualenv initially. Afterwards, I realized my mistake and installed everything inside a virtualenv, and am going to be running all of my D-Wave programs inside the virtualenv, but I was just curious as to why it is necessary to have everything in a virtualenv?
Comments
Unless something has changed recently, I don't think a virtualenv is necessary. I don't use a virtualenv.
Hi Jack,
Although the virtual environment is not exactly necessary, it is recommended.
Virtual environments help to keep all of the libraries installed for a specific project compartmentalized to that project.
If another Python project is installed along with its associated libraries, it might have some libraries in common with the previously installed project.
Installing those libraries might break the first project!
As long as each project is in its own virtual environments, they can use their own libraries and library versions, and there won't be any problems.
It's also a good way to "future proof" your development environment.
It makes it very easy to start completely unrelated projects, or start a new Ocean project, without conflict.
In addition, using the virtual environment helps to automatically set up the dwave program.
That way, when you run 'dwave config create', the operating system will be able to locate the dwave binary file automatically, without additional configuration.
Please sign in to leave a comment.