jamescasbon / PyVCF

A Variant Call Format reader for Python.
http://pyvcf.readthedocs.org/en/latest/index.html
Other
396 stars 201 forks source link

PyPI 0.4.0 installation issues via setuptools #32

Closed arq5x closed 12 years ago

arq5x commented 12 years ago

This is likely owing to my naivete, but I am working on another tool that depends upon PyVcf. As such, in my setup.py I have:

install_requires=['numpy', 'pyparsing', 'pysam', 'pyvcf>=0.4.0'],

When running setup.py develop/install, this causes the script to search PyPI for the latest version of PyPI. It succeeds in finding it, but when trying to install it, I get the following error. I am really, really new to setuptools, so I don't have many ideas here, but it looks like there is a problem compiling the pysam or tabix Extension module. Any ideas?

The same error occurs with (upgrading from 0.4.0pre to 0.4.0):

easy_install -U pyvcf

The error:

Processing dependencies for pop==0.1.0
Searching for pyvcf>=0.4.0
Reading http://pypi.python.org/simple/pyvcf/
Reading https://github.com/jamescasbon/PyVCF
Best match: PyVCF 0.4.0
Downloading http://pypi.python.org/packages/source/P/PyVCF/PyVCF-0.4.0.tar.gz#md5=165224e91a38f5a6c0fa3d63b8258b58
Processing PyVCF-0.4.0.tar.gz
Running PyVCF-0.4.0/setup.py -q bdist_egg --dist-dir /var/folders/tO/tOq24FDAF-WH1NXQLRXlhk+++TM/-Tmp-/easy_install-kE7hJH/PyVCF-0.4.0/egg-dist-tmp-1zQvoE
Traceback (most recent call last):
  File "setup.py", line 45, in <module>
    'Topic :: Scientific/Engineering :: Bio-Informatics']
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 152, in setup
    dist.run_commands()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "build/bdist.linux-i686/egg/setuptools/command/develop.py", line 27, in run
  File "build/bdist.linux-i686/egg/setuptools/command/develop.py", line 102, in install_for_development
  File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 519, in process_distribution
  File "build/bdist.linux-i686/egg/pkg_resources.py", line 563, in resolve
  File "build/bdist.linux-i686/egg/pkg_resources.py", line 799, in best_match
  File "build/bdist.linux-i686/egg/pkg_resources.py", line 811, in obtain
  File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 446, in easy_install
  File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 476, in install_item
  File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 655, in install_eggs
  File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 930, in build_and_install
  File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 919, in run_setup
  File "build/bdist.linux-i686/egg/setuptools/sandbox.py", line 62, in run_setup
  File "build/bdist.linux-i686/egg/setuptools/sandbox.py", line 105, in run
  File "build/bdist.linux-i686/egg/setuptools/sandbox.py", line 64, in <lambda>
  File "setup.py", line 12, in <module>
    m.Extension.__dict__ = m._Extension.__dict__
  File "/var/folders/tO/tOq24FDAF-WH1NXQLRXlhk+++TM/-Tmp-/easy_install-kE7hJH/PyVCF-0.4.0/vcf/__init__.py", line 166, in <module>
  File "/var/folders/tO/tOq24FDAF-WH1NXQLRXlhk+++TM/-Tmp-/easy_install-kE7hJH/PyVCF-0.4.0/vcf/parser.py", line 10, in <module>
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pysam-0.6-py2.7-macosx-10.6-intel.egg/pysam/__init__.py", line 1, in <module>
    from csamtools import *
  File "csamtools.pxd", line 60, in init csamtools (pysam/csamtools.c:32571)
TypeError: __builtin__.file is not a type object
martijnvermaat commented 12 years ago

I assume python2.7 -c 'import pysam' is successful on your system?

jamescasbon commented 12 years ago

Ooh, sorry about that!

What happens if you 'pip install pyvcf'? Do you get the same error?

The only obvious thing is that I do a try/import pysam/except/pysam=None. If pysam is in some semi installed state, this could cause problems.

Can you try installing pysam and then rerunning python setup.py develop/install. I would guess that would be a workaround.

Given the mess that is python packaging, a 'python setup install' could be doing several things. Which setup function are you importing and running?

On Wed, Mar 14, 2012 at 2:31 AM, Aaron Quinlan reply@reply.github.com wrote:

This is likely owing to my naivete, but I am working on another tool that depends upon PyVcf.  As such, in my setup.py I have:

   install_requires=['numpy', 'pyparsing', 'pysam', 'pyvcf>=0.4.0'],

When running setup.py develop/install, this causes the script to search PyPI for the latest version of PyPI.  It succeeds in finding it, but when trying to install it, I get the following error.  I am really, really new to setuptools, so I don't have many ideas here, but it looks like there is a problem compiling the pysam or tabix Extension module.  Any ideas?

   Processing dependencies for pop==0.1.0    Searching for pyvcf>=0.4.0    Reading http://pypi.python.org/simple/pyvcf/    Reading https://github.com/jamescasbon/PyVCF    Best match: PyVCF 0.4.0    Downloading http://pypi.python.org/packages/source/P/PyVCF/PyVCF-0.4.0.tar.gz#md5=165224e91a38f5a6c0fa3d63b8258b58    Processing PyVCF-0.4.0.tar.gz    Running PyVCF-0.4.0/setup.py -q bdist_egg --dist-dir /var/folders/tO/tOq24FDAF-WH1NXQLRXlhk+++TM/-Tmp-/easy_install-kE7hJH/PyVCF-0.4.0/egg-dist-tmp-1zQvoE    Traceback (most recent call last):      File "setup.py", line 45, in        'Topic :: Scientific/Engineering :: Bio-Informatics']      File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 152, in setup        dist.run_commands()      File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands        self.run_command(cmd)      File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command        cmd_obj.run()      File "build/bdist.linux-i686/egg/setuptools/command/develop.py", line 27, in run      File "build/bdist.linux-i686/egg/setuptools/command/develop.py", line 102, in install_for_development      File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 519, in process_distribution      File "build/bdist.linux-i686/egg/pkg_resources.py", line 563, in resolve      File "build/bdist.linux-i686/egg/pkg_resources.py", line 799, in best_match      File "build/bdist.linux-i686/egg/pkg_resources.py", line 811, in obtain      File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 446, in easy_install      File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 476, in install_item      File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 655, in install_eggs      File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 930, in build_and_install      File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 919, in run_setup      File "build/bdist.linux-i686/egg/setuptools/sandbox.py", line 62, in run_setup      File "build/bdist.linux-i686/egg/setuptools/sandbox.py", line 105, in run      File "build/bdist.linux-i686/egg/setuptools/sandbox.py", line 64, in      File "setup.py", line 12, in        m.Extension.dict = m._Extension.dict      File "/var/folders/tO/tOq24FDAF-WH1NXQLRXlhk+++TM/-Tmp-/easy_install-kE7hJH/PyVCF-0.4.0/vcf/init.py", line 166, in      File "/var/folders/tO/tOq24FDAF-WH1NXQLRXlhk+++TM/-Tmp-/easy_install-kE7hJH/PyVCF-0.4.0/vcf/parser.py", line 10, in      File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pysam-0.6-py2.7-macosx-10.6-intel.egg/pysam/init.py", line 1, in        from csamtools import *      File "csamtools.pxd", line 60, in init csamtools (pysam/csamtools.c:32571)    TypeError: builtin.file is not a type object


Reply to this email directly or view it on GitHub: https://github.com/jamescasbon/PyVCF/issues/32

James Casbon

Population Genetics - http://www.populationgenetics.com/ james.casbon@populationgenetics.com +44 (0)1223 497353

arq5x commented 12 years ago

I already have pysam installed, so:

@martijnvermaat python2.7 -c 'import pysam' is successful, yes.

@jamescasbon yes, pip install --upgrade pyvcf works.

@jamescasbon I am new to this so I am just learning how messy this is. Here is my setup.py: https://gist.github.com/2035775

Thanks for the help all!t

chapmanb commented 12 years ago

As an additional datapoint, I can replicate this with:

easy_install -U pyvcf

with pysam-0.6 installed on Ubuntu 11.10. pip does work cleanly.

The Biopython setup avoids doing an import to get the version, presumably for this reason, and just parses it out:

https://github.com/biopython/biopython/blob/master/setup.py#L397

jamescasbon commented 12 years ago

Thanks, @chapmanb for the tip.

I just released 0.4.1 on pypi which avoids import during setup. Can you good people try installing that and see if it is fixed?

arq5x commented 12 years ago

@jamescasbon it finds 0.4.1 just fine but I get the following error when running either develop or build. This might this be specific to me...

Searching for pyvcf>=0.4.1
Reading http://pypi.python.org/simple/pyvcf/
Reading https://github.com/jamescasbon/PyVCF
Best match: PyVCF 0.4.1
Downloading http://pypi.python.org/packages/source/P/PyVCF/PyVCF-0.4.1.tar.gz#md5=48cb5f4c9821d7e573f0377ae5d1c7b2
Processing PyVCF-0.4.1.tar.gz
Running PyVCF-0.4.1/setup.py -q bdist_egg --dist-dir /var/folders/tO/tOq24FDAF-WH1NXQLRXlhk+++TM/-Tmp-/easy_install-2BBNI6/PyVCF-0.4.1/egg-dist-tmp-nrk278
error: SandboxViolation: file('/tmp/ds', 'w') {}

The package setup script has attempted to modify files on your system
that are not within the EasyInstall build area, and has been aborted.

This package cannot be safely installed by EasyInstall, and may not
support alternate installation locations even if you run its setup
script by hand.  Please inform the package's author and the EasyInstall
maintainers to find out if a fix or workaround is available.
jamescasbon commented 12 years ago

I'm an idiot and left in debugging statement 0.4.2 should fix that, just released.

Apologies all for doing this via releases, I couldn't replicate the problem here.

On Wed, Mar 14, 2012 at 1:35 PM, Aaron Quinlan reply@reply.github.com wrote:

@jamescasbon it finds 0.4.1 just fine but I get the following error when running either develop or build.  This might this be specific to me...

   Searching for pyvcf>=0.4.1    Reading http://pypi.python.org/simple/pyvcf/    Reading https://github.com/jamescasbon/PyVCF    Best match: PyVCF 0.4.1    Downloading http://pypi.python.org/packages/source/P/PyVCF/PyVCF-0.4.1.tar.gz#md5=48cb5f4c9821d7e573f0377ae5d1c7b2    Processing PyVCF-0.4.1.tar.gz    Running PyVCF-0.4.1/setup.py -q bdist_egg --dist-dir /var/folders/tO/tOq24FDAF-WH1NXQLRXlhk+++TM/-Tmp-/easy_install-2BBNI6/PyVCF-0.4.1/egg-dist-tmp-nrk278    error: SandboxViolation: file('/tmp/ds', 'w') {}

   The package setup script has attempted to modify files on your system    that are not within the EasyInstall build area, and has been aborted.

   This package cannot be safely installed by EasyInstall, and may not    support alternate installation locations even if you run its setup    script by hand.  Please inform the package's author and the EasyInstall    maintainers to find out if a fix or workaround is available.


Reply to this email directly or view it on GitHub: https://github.com/jamescasbon/PyVCF/issues/32#issuecomment-4498071

James Casbon

Population Genetics - http://www.populationgenetics.com/ james.casbon@populationgenetics.com +44 (0)1223 497353

arq5x commented 12 years ago

Works like a charm! Thanks for working with me on this all.

No back to fixing a list of 20-odd bugs...

chapmanb commented 12 years ago

James; Awesome, thanks. 0.4.2 works cleanly for me.