Closed jbedo closed 5 years ago
Which version of python and were you using pip
or python setup.py install
? For example, under python 3.6 and 3.7 foo
is a bytes
object.
Python 3.7.2, not using pip executed with python setup.py install.
Should mention it's python setup.py install
via the Nix build system (i.e., I didn't execute it directly).
I'll look into whether this changed in python 3.7.2, since it works as intended in 3.7.1. For what it's worth, this seems like a nice argument for "use conda for package management".
This seems to be an issue with Nix, because I just installed python 3.7.2 and ran python setup.py install --user
with it without error. This is unsurprising since the aforementioned foo
object is still a bytes
object:
$ python
Python 3.7.2 | packaged by conda-forge | (default, Mar 20 2019, 01:46:52)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import subprocess
>>> foo, _ = subprocess.Popen(['curl-config', '--libs'], stdout=subprocess.PIPE).communicate()
>>> type(foo)
<class 'bytes'>
>>> foo
b'-lcurl\n'
>>> foo.decode().strip().split()
['-lcurl']
Well, I use Nix not conda and consider it far superior :).
Package manager wars aside, that little test you did is interesting:
Python 3.7.2 (default, Dec 24 2018, 03:41:55)
[GCC 7.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import subprocess
>>> foo, _ = subprocess.Popen(['curl-config', '--libs'], stdout=subprocess.PIPE).communicate()
>>> type(foo)
<class 'bytes'>
>>> foo.decode().strip().split()
['-L/nix/store/mlnv0gkwszwc995b52ffnn57ig5cabpj-curl-7.64.0/lib', '-lcurl']
>>>
So you're right.
The problem actually seems to be that I didn't have curl-config exposed (i.e., the build fails without curl). I've verified that pyBigWig compiles fine with curl, and fails with the "no decode" error without.
It also does correctly detect there's no curl-config, just fails anyway directly aftewards:
Either libcurl isn't installed, it didn't come with curl-config, or curl-config isn't in your $PATH. pyBigWig will be installed without support for remote files.
Traceback (most recent call last):
File "nix_run_setup", line 8, in <module>
exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\\r\\n', '\\n'), __file__, 'exec'))
File "setup.py", line 43, in <module>
foo = foo.decode().strip().split()
AttributeError: 'str' object has no attribute 'decode'
builder for '/nix/store/r9zxfh6sr6spd4m17naz4nryrscyl4d4-python3.7-pyBigWig-0.3.13.drv' failed with exit code 1
error: build of '/nix/store/r9zxfh6sr6spd4m17naz4nryrscyl4d4-python3.7-pyBigWig-0.3.13.drv' failed
Ah, that's the bug we're looking for then, thanks!
I'm pushing out version 0.3.14, which should fix this.
This should now be available in pypi.
Confirmed resolved in 0.3.14, thanks!
Building release 0.3.13 using python 3 fails due to a bug in setup.py:
Under python 3 there is no need to decode UTF-8 strings. Modifying the offending line to
foo = foo.strip().split()
resolves the problem.