quachtina96 / pysam

Automatically exported from code.google.com/p/pysam
0 stars 0 forks source link

"ValueError: level must be >= 0" when doing "import pysam" on Python 3 #127

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,

I looked up and this was reported on list, but did not seem to have made it as 
bug report:

https://groups.google.com/forum/?fromgroups#!topic/pysam-user-group/iqmW3VVzCLM

Laurent

Original issue reported on code.google.com by lgaut...@gmail.com on 10 Jun 2013 at 12:30

GoogleCodeExporter commented 9 years ago
Hi Laurent,

thanks. I think it is related to this:

http://bugs.python.org/issue15610

Apparently, some default value of an import call changed and the original 
default not causes this error. The problem is that the .c files packaged with 
pysam are generated for python 2.7. For python 3 they need to be generated. I 
have previously been advised to include the .c files in the package.

What I will now do is for python 3: 

1. check for cython presence
2. if present, remove the .c files so that they will be recompiled.

Hopefully that will fix the problem. As a side-effect, the .c will
always be regenerated and recomputed even if the .pyx file has not changed.

Best wishes,
Andreas

Original comment by andreas....@gmail.com on 27 Jun 2013 at 3:10

GoogleCodeExporter commented 9 years ago

The side-effect seems mostly wanted, I think: should cython change/improve the 
C code it generates, the user would benefit from it without you having to make 
a new release.

Check whether the recommendation to ship C translations is still holding. It 
might just be better to make the package `pysam` depend on cython and translate 
.pyx at build time.

Original comment by lgaut...@gmail.com on 27 Jun 2013 at 7:10

GoogleCodeExporter commented 9 years ago
Hi Laurent,

I fully agree with you, yet cython says this:

http://docs.cython.org/src/userguide/source_files_and_compilation.html

"""
It is strongly recommended that you distribute the generated .c files as well 
as your Cython sources, so that users can install your module without needing 
to have Cython available.

It is also recommended that Cython compilation not be enabled by default in the 
version you distribute. Even if the user has Cython installed, he probably 
doesn’t want to use it just to install your module. Also, the version he has 
may not be the same one you used, and may not compile your sources correctly.
"""

For the time being I will have this dual option - bundle .c, but re-cythonize
under python 3.

Best wishes,
Andreas

Original comment by andreas....@gmail.com on 18 Sep 2013 at 7:10