Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not compile without curl #81

Closed
jbedo opened this issue Apr 10, 2019 · 11 comments
Closed

Does not compile without curl #81

jbedo opened this issue Apr 10, 2019 · 11 comments

Comments

@jbedo
Copy link

jbedo commented Apr 10, 2019

Building release 0.3.13 using python 3 fails due to a bug in setup.py:

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'

Under python 3 there is no need to decode UTF-8 strings. Modifying the offending line to foo = foo.strip().split() resolves the problem.

@dpryan79
Copy link
Collaborator

dpryan79 commented Apr 10, 2019

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.

@jbedo
Copy link
Author

jbedo commented Apr 10, 2019

Python 3.7.2, not using pip executed with python setup.py install.

@jbedo
Copy link
Author

jbedo commented Apr 11, 2019

Should mention it's python setup.py install via the Nix build system (i.e., I didn't execute it directly).

@dpryan79
Copy link
Collaborator

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".

@dpryan79
Copy link
Collaborator

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']

@jbedo
Copy link
Author

jbedo commented Apr 11, 2019

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.

@jbedo jbedo changed the title Does not compile with Python 3 Does not compile without curl Apr 11, 2019
@jbedo
Copy link
Author

jbedo commented Apr 11, 2019

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

@dpryan79
Copy link
Collaborator

Ah, that's the bug we're looking for then, thanks!

@dpryan79
Copy link
Collaborator

I'm pushing out version 0.3.14, which should fix this.

@dpryan79
Copy link
Collaborator

This should now be available in pypi.

@jbedo
Copy link
Author

jbedo commented Apr 11, 2019

Confirmed resolved in 0.3.14, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants