Virtual Environments In Python
In one of my last posts I installed python packages with pip and the --user
switch.
This worked, but sucked.
I was too stupid to manage packages with conda and would not even
advise my enemies to do so.
But I found a better way.
There is a tool called vitualenv
which can set up virtual Python
instances.
It works in userspace and so does not interfere with my
package manager.
This may sound like an obvious thing to you, and perhaps I am noobish
for mentioning it, but I hope it helps someone.
Remember, I wanted to install
zipline.
So I did a
which set up a new virtual environment in ~/venv/zipline
.
Note that zipline is not only the name of the package I want to
install, but also the name of my virtual environment.
Then I switched to the new environment with
and my prompt was prepended with (zipline)
, because I am now in my
new
virtual environment where I can install packages like a lunatic.
Now it is compiling and throwing some warnings, but finally it finishes. At least in my case.
Then I tested everything according to the zipline docs
And it worked!
Note that I have to write ~/venv/zipline/bin/run_algo.py
, since I
have not found out how to set a path in python, as in one of my
last posts.
But at least I am able to install packages without arguing with
aptitude.