0

I need to use PyVCF (python module specific for variant callers) for use within my own account on a remote server, and have been attempting to install the module. I suppose my question applies more generally to python module installation in linux rather than being specific to pyvcf.

I have gotten to the stage where I've downloaded the source code and have untarred/unzipped it. I now have a directory containing several python executables, including vcf.py, vcf_filter.py, and setup.py.

The problem I'm having is figuring out where to put these scripts so that they may be called/referenced from any working directory within my account.

user1815498
  • 1,239
  • 6
  • 20
  • 23
  • `sudo python setup.py install` – skamsie Apr 14 '14 at 17:25
  • Usually `python setup.py install`, preferably with a virtualenv activated. – Wooble Apr 14 '14 at 17:25
  • I get an error message stating "No module named setuptools." Presumably this is another package that I need to install first? – user1815498 Apr 14 '14 at 17:29
  • I would seriously consider installing PyEnv. If you give the README a good thorough read(5 minutes tops) you can install any version of python you want with `setuptools` included at exactly the correct version. Then you can just `pip install PyVCF` and any python file you run with that environment sourced will be able to use the PyVCF API stuff. – nsfyn55 Apr 14 '14 at 18:26

2 Answers2

0

If you have root you can hand move these files to the System wide python ../lib/site-packages/ or you can follow the instructions in this post. Adding module to sys.path

You are probably better off(unless you need to absolute bleeding edge) installing the package from pypi. Packages from here are typically installed using either ez_install or pip.

Its worth nothing that Python typically has two notions of where packages are installed System and virtualenv. The system package are globally available to all scripts executed when running the untainted python executable. The virtualenv libraries are available from a command line where you have sourced a virtualenv. The virtualevn may or may not have access to the System packages depending on how you have set it up. As @wooble noted your are best served by creating a virtualenv especially if you are experimenting.

As an aside...aside you can explore the pyenv and pyenv-virtualenv project. These allow you to easily manage what versions of python are installed as well as providing your with all the package management stuff setup for you. Using this method installing PyVCF is as simple as calling pip install PyVCF

Community
  • 1
  • 1
nsfyn55
  • 14,875
  • 8
  • 50
  • 77
  • 1
    I eventually did get it to work, but I had to install setuptools first. Thanks to you and the others for directing me to pyenv, I'll look into it later today. – user1815498 Apr 14 '14 at 19:37
0

I wrote a blog post, well copied a blog post about setting up virtual environments. It also contains some information about using pip as a package down loader. Pip is a great tool, a little bit of info, where if you need to install something you can just use

pip install <module>

I would recommend using virtualenvs - especially if starting out. They create a specific self contained project that houses all depedencies together and which will keep dependencies/mistakes separate from your main system.

Craicerjack
  • 6,203
  • 2
  • 31
  • 39