3 ms·
Rubyist here; how does one install the BeautifulSoup module here (Macbook Pro with Mountain Lion)? ./ghrabber.py "path:.bash_history" File "./ghrabber.py",
by tibbon 14y ago
Rubyist here; how does one install the BeautifulSoup module here (Macbook Pro with Mountain Lion)?
./ghrabber.py "path:.bash_history"
File "./ghrabber.py", line 3, in <module>
import BeautifulSoup
ImportError: No module named BeautifulSoup
I tried easy_install beautifulsoup but it gave a permissions error, so I ran it as sudo and that worked, but when I re-run the script it still throws the same error.
Does python lack 'bundle install'-like functionality?
- alecdbrooks 14y agoTry using pip. You can install it with "easy_install pip" and then run "pip install beautifulsoup".
- kmfrk 14y agopip install beautifulsoup You might have to install pip with easy_install
- tibbon 14y agoThanks! With Python, do you have to manually install each module and keep track of the versions?
- pplante 14y agoIf you are using pip you can type "pip freeze" and it will spit out a list of all modules and the version currently installed. Most write this out to a file called "requirements.txt" in their project root. You can then use this list to install modules via "pip install -r requirements.txt" Same functionality as bundle install, just pythonic.
- kmfrk 14y agoWhat s/he said. Although keeping track of new updates is a bit of a pain, since there isn't a service like the one Rubyists have to get information about new gem versions. Pythonistas will have to use something like pip-tools < https://github.com/nvie/pip-tools https://github.com/nvie/pip-tools >, as far as I can tell.
- e12e 14y agoNice, I hadn't seen pip-tools before. There is also yolk (pip install yolk) that will list available updates.
- e12e 14y agoI'm not very familiar with Ruby, but I know there are some similar pain-points wrt packages/dependencies and maintaining "pristine" (aka "actually working") project trees (it's not specific to python/ruby either - hence package managers like apt/yum, build tools like apache maven etc). What I usually do, is I have a system python for packages managed with apt (There are a lot of these, try): aptitude search '?and(?depends(python),?installed)' - and a system installed virtualenv. I then have a local python virtulalenv for installing misc packages (eg: a more recent mercurial than the one distributed in apt on older Debian distros): virtualenv ~/opt/python-misc ln -s ~/opt/python-misc/bin ~/pybin # In .bashrc: if [ -d "~/opt/pybin" ] then PATH="~/opt/pybin:${PATH}" fi; export PATH Note my "local" python virtualenv is before system in path, so any casual pip install "shiny-package-that-migh-break-system" just (at worst) means I have to recreate the virtualenv (or pip uninstall it). But for projects -- I highly recommend looking at buildout. A nice summary I stumbled across here: http://www.marmelune.net/en/python/buildout/from-virtualenv-to-buildout/ http://www.marmelune.net/en/python/buildout/from-virtualenv-... edit: formatting