So I managed upgrading Ubuntu from 12.04 to 14.04 and somehow even fixed some issues with tex by typing obscure commands in my shell.
Now I wanted to install zipline for which I need conda for which I need pip, the python package manager.
Well, seems the upgrade to 14.04 broke pip. Any command line switches I have tried lead to
ImportError: cannot import name IncompleteRead.
The guys with the funny names on the internet recommended to do a
sudo easy_install pip which basically convinces another python package manager to install pip.
This is of course stupid, since Ubuntu is package-based and so my aptitude would get confused if i install stuff into the global /usr/local/lib/python2.7/
I did a
easy_install --user pip which installed pip into .local/bin/pip I think I can live with that.
Finally, I wanted to have anaconda. Anaconda is a virtual environment for python, like virtualenv, but it can also cope with non-python library dependencies.
Stupid machine. Y u no installing?
So i tried the broken global pip from /usr/bin/ which now magically worked again and did not throw ImportErrors.
./.local/bin/pip install --user conda worked.
Don’t ask me why.
Arguing with Conda
Now, on to zipline. At least that was my thought process.
Damn, I did it the wrong way, via pip. FYI, miniconda cannot be found with aptitude.
So I made my own environment:
conda create -n myenv python which fetched some packages and put them somewhere in $HOME/envs/myenv
Activating this environment should be straightforward with
source activate myenv.
After creating myenv this conda stuff even said to me:
Oh, how wrong I was:
After googling I found out that the problem apparently was that conda could not handle local installations.
And /usr/bin/activate did not exist.
I decided to remove all that damn conda-stuff and install zipline via pip.
pip uninstall conda worked like a charm.
So according to the zipline docs I needed to do
Of course I quickly added the
--user switches, and indeed it worked.
I do not know why, because
which pip gave me /usr/bin/pip which was broken at the beginning of this post and the correct one should have been in ~/.local/bin/pip.
python ~/.local/bin/run_algo.py -f dual_mavg.py --symbols AAPL --start 2011-1-1 --end 2012-1-1 -o dma.pickle according to the zipline docs which wrote a dma.pickle file.
It would be nice to set a path for python, so it looks into ~/.local/bin/ and i can just write
python run_algo.py -f dual_mavg.py blablabla but I have not found out how this works.
The python ecosystem sucks. I have two package managers, easy_install and pip, which can repair each other.
I mean, what is the point of having a package manager bundled with the operating system when you cannot use it and are doomed to update your python-packages manually like some Windows-user?
There is virtualenv and anaconda, which mostly do the same thing. I have not tested virtualenv and do not intend to do so, but anaconda or conda or miniconda or whichever part of that stuff I have used feels like being stuck in haskells cabal hell.
And don’t get me even started on python 3 and those python notebooks.