Skip to content

Ensure you have your Python development headers installed. #9

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

Closed
Givemeyourgits opened this issue Dec 6, 2016 · 24 comments
Closed

Comments

@Givemeyourgits
Copy link

I am trying to install Universe from OpenAI and go-vncdriver is giving me problems.

I get a message I should make sure I have python development headers installed (which I do) but I also tried under Anaconda (which is recommended by Universe and does not have a python-dev package, but it is said to already include headers) and I get same error.

The full output is:

read |0: interrupted system call

Build failed. HINT:

  • Ensure you have your Python development headers installed. (On Ubuntu,

    this is just 'sudo apt-get install python-dev'.

make: *** [build] Error 1

Could not build go_vncdriver: Command '['make', 'build']' returned non-zero exit status 2

Traceback (most recent call last):

File "", line 1, in

File "/tmp/pip_build_root/go-vncdriver/setup.py", line 79, in

setup_requires=['numpy'],

File "/usr/lib/python2.7/distutils/core.py", line 151, in setup

dist.run_commands()

File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands

self.run_command(cmd)

File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command

cmd_obj.run()

File "/usr/lib/python2.7/dist-packages/setuptools/command/install.py", line 53, in run

return _install.run(self)

File "/usr/lib/python2.7/distutils/command/install.py", line 601, in run

self.run_command('build')

File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command

self.distribution.run_command(command)

File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command

cmd_obj.run()

File "/tmp/pip_build_root/go-vncdriver/setup.py", line 25, in run

self.build()

File "/tmp/pip_build_root/go-vncdriver/setup.py", line 64, in build

subprocess.check_call(cmd, cwd=here())
@jeremyschlatter
Copy link
Contributor

Sorry, the error message we print is misleading here. The real issue is the first line:

read |0: interrupted system call

A quick search for this error turns up two results from Bash on Windows:

microsoft/WSL#349
microsoft/WSL#1038

Are you using Bash on Windows?

Looking at links from there, it seems like there have been multiple problems with building Go apps on Bash on Windows, and it's not clear whether they are all fixed yet.

The one that caused the "interrupted system call" message seems to have been fixed in Windows 10 Insiders build 14905: https://wpdev.uservoice.com/forums/266908-command-prompt-console-bash-on-ubuntu-on-windo/suggestions/14046789-add-support-for-restartable-system-calls-i-e-sa

And another issue was fixed in a more recent build: microsoft/WSL#638

@Givemeyourgits
Copy link
Author

I get the issue on Debian 8 and Windows 10 Pro Bash

@jeremyschlatter
Copy link
Contributor

Interesting. You get the read |0: interrupted system call message on Debian 8? I'll see if I can reproduce it.

@Givemeyourgits
Copy link
Author

I get the same error about Python-dev but not sure what the previous errors were. I will check in a few minutes on Debian. They looked like same error.

@jeremyschlatter
Copy link
Contributor

I'm guessing they are different issues. We just print the Python-dev message for any build failure because it's a common problem. But it's misleading in cases like this. We might be better off removing it.

@Givemeyourgits
Copy link
Author

Is there way to get more details on error?

@jeremyschlatter
Copy link
Contributor

Running ./build.sh in the top-level go-vncdriver directory might give more output.

@sksq96
Copy link

sksq96 commented Dec 7, 2016

I am running ./build.sh in the top-level go-vncdriver, with the following error:

Env info:

export GOPATH=/home/shubham/Downloads/go-vncdriver/.build
export CGO_LDFLAGS=/usr/lib/x86_64-linux-gnu/libjpeg.so -L/home/shubham/.anaconda3/lib -lpython3.5m
export CGO_CFLAGS=-I/home/shubham/.pyenv/versions/anaconda3-4.1.1/lib/python3.5/site-packages/numpy/core/include -I/home/shubham/.anaconda3/include/python3.5m
export GO15VENDOREXPERIMENT=1

Running build with OpenGL rendering.
Building with OpenGL: GOPATH=/home/shubham/Downloads/go-vncdriver/.build go build -buildmode=c-shared -o go_vncdriver.so github.com/openai/go-vncdriver. (Set GO_VNCDRIVER_NOGL to build without OpenGL.)
# github.com/openai/go-vncdriver
.build/src/github.com/openai/go-vncdriver/main.go:5:20: fatal error: Python.h: No such file or directory
 #include <Python.h>
                    ^
compilation terminated.

Note: could not build with OpenGL rendering (cf https://github.com/openai/go-vncdriver). This is expected on most servers. Going to try building without OpenGL.
Building without OpenGL: GOPATH=/home/shubham/Downloads/go-vncdriver/.build go build -tags no_gl -buildmode=c-shared -o go_vncdriver.so github.com/openai/go-vncdriver
# github.com/openai/go-vncdriver
.build/src/github.com/openai/go-vncdriver/main.go:5:20: fatal error: Python.h: No such file or directory
 #include <Python.h>
                    ^
compilation terminated.

Build failed. HINT:

- Ensure you have your Python development headers installed. (On Ubuntu,
  this is just 'sudo apt-get install python-dev'.

PS: I am running this on Ubuntu 16.04

@jeremyschlatter
Copy link
Contributor

@sksq9 This time our error message is on target :) You need the Python development headers:

sudo apt-get install python-dev

@sksq96
Copy link

sksq96 commented Dec 7, 2016

I already tried that, but nothing. I am running anaconda3.5 with pyenv as python version manager, I suspect this might be the culprit.

@jeremyschlatter
Copy link
Contributor

Hmm. It's checking for headers in /home/shubham/.anaconda3/include/python3.5m. Is there anything actually in that directory?

@sksq96
Copy link

sksq96 commented Dec 7, 2016

No it's not the correct directory for my anaconda installation. This /home/shubham/.anaconda3/include/python3.5m does not exist.

@jeremyschlatter
Copy link
Contributor

Interesting. Some sanity checking -- what is the output of these commands?

which python
pyenv which python
python -V
python -c 'import sys; print(sys.executable)'
/usr/bin/env python -V
/usr/bin/env python -c 'import sys; print(sys.executable)'

@sksq96
Copy link

sksq96 commented Dec 7, 2016

➜  ~ which python
/home/shubham/.pyenv/shims/python
➜  ~ pyenv which python
/home/shubham/.pyenv/versions/anaconda3-4.1.1/bin/python
➜  ~ python -V
Python 3.5.2 :: Anaconda custom (64-bit)
➜  ~ python -c 'import sys; print(sys.executable)'
/home/shubham/.pyenv/versions/anaconda3-4.1.1/bin/python
➜  ~ /usr/bin/env python -V
Python 3.5.2 :: Anaconda custom (64-bit)
➜  ~ /usr/bin/env python -c 'import sys; print(sys.executable)'
/home/shubham/.pyenv/versions/anaconda3-4.1.1/bin/python

@jeremyschlatter
Copy link
Contributor

That all looks reasonable. I'm guessing the headers are actually under /home/shubham/.pyenv/versions/anaconda3-4.1.1/include/python3.5m. Is that right?

@sksq96
Copy link

sksq96 commented Dec 7, 2016

Yes. I checked, all headers are under the directory you mentioned. It's looking in the wrong place.

@jeremyschlatter
Copy link
Contributor

Ok. I wonder why that is. We look up header location from the sysconfig package, which seems to be giving the wrong answer here. To double check, can you run this?

python -c "import sysconfig; print(sysconfig.get_config_var('INCLUDEPY'))"

It should print out the wrong location. If so, we need to figure out why or figure out something better to check.

@sksq96
Copy link

sksq96 commented Dec 7, 2016

Indeed, it's printing out the wrong location.

➜  ~ python -c "import sysconfig; print(sysconfig.get_config_var('INCLUDEPY'))"
/home/shubham/.anaconda3/include/python3.5m

@sksq96
Copy link

sksq96 commented Dec 7, 2016

On a side note, I copied the headers to the directory it is looking into, it worked perfectly fine.

@sksq96
Copy link

sksq96 commented Dec 7, 2016

Maybe this will work better.

➜  ~ python -c "import sysconfig; print(sysconfig.get_path('include'))" 
/home/shubham/.pyenv/versions/anaconda3-4.1.1/include/python3.5m

I am still not sure, why INCLUDEPY points to the old anaconda installation.

@jeremyschlatter
Copy link
Contributor

distutils uses get_python_inc. What does that return for you?

python -c "from distutils import sysconfig; print(sysconfig.get_python_inc()); print (sysconfig.get_python_inc(plat_specific=1))"

I think this is what pure C extensions (as opposed to C + Go or whatever else) use, so I'm inclined to use the same thing if it works in your case.

@sksq96
Copy link

sksq96 commented Dec 7, 2016

Yes. They they return the correct path.

➜  ~ python -c "from distutils import sysconfig; print(sysconfig.get_python_inc()); print (sysconfig.get_python_inc(plat_specific=1))"
/home/shubham/.pyenv/versions/anaconda3-4.1.1/include/python3.5m
/home/shubham/.pyenv/versions/anaconda3-4.1.1/include/python3.5m

jeremyschlatter added a commit that referenced this issue Dec 13, 2016
The strategy we were using produced the wrong location for someone: #9.
There are several possibilities here, and I haven't found a clear
recommendation in the Python docs for what to do. I'm opting to use the
approach that distutils uses to build C extensions, since that is the
implementation that most extensions likely use. See the distutils code
here:

https://github.com/python/cpython/blob/c30098c8c6014f3340a369a31df9c74bdbacc269/Lib/distutils/command/build_ext.py#L150-L151
@jeremyschlatter
Copy link
Contributor

Include path fixed in 0.4.19: a768e8b.

@wahyubram82
Copy link

please open again, still error event the header / include directory already fixed.
the file is:
Python.h
the folder is correct, mine is in ../usr/include/python3.7m

but still return error in the same result, ask to install python header by sudo apt-get install python-dev

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

4 participants