openai / go-vncdriver

Fast VNC driver
MIT License
123 stars 59 forks source link

Ensure you have your Python development headers installed. #9

Closed Givemeyourgits closed 7 years ago

Givemeyourgits commented 7 years ago

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:

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 commented 7 years ago

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:

https://github.com/Microsoft/BashOnWindows/issues/349 https://github.com/Microsoft/BashOnWindows/issues/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: https://github.com/Microsoft/BashOnWindows/issues/638

Givemeyourgits commented 7 years ago

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

jeremyschlatter commented 7 years ago

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

Givemeyourgits commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

Is there way to get more details on error?

jeremyschlatter commented 7 years ago

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

sksq96 commented 7 years ago

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 commented 7 years ago

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

sudo apt-get install python-dev
sksq96 commented 7 years ago

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 commented 7 years ago

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

sksq96 commented 7 years ago

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

jeremyschlatter commented 7 years ago

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 commented 7 years ago
➜  ~ 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 commented 7 years ago

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 commented 7 years ago

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

jeremyschlatter commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

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

sksq96 commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

Include path fixed in 0.4.19: a768e8bb5f1663c8b4fbb9d36e340887c550b0e0.

wahyubram82 commented 5 years ago

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