gopy: Can't setup gopy to work
I can’t get gopy works even with python console, bash or docker. Tried all examples from README
go version go1.13.1 linux/amd64 ubuntu 16.04 Python 3.6.8
- gopy build + console
$ python
Python 3.6.8 |Anaconda, Inc.| (default, Dec 30 2018, 01:22:34)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import hi
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/kistler/go-sdk/out/hi.py", line 15, in <module>
import _hi
ImportError: hi_go.so: cannot open shared object file: No such file or directory
>>>
- python console
Python 3.6.8 |Anaconda, Inc.| (default, Dec 30 2018, 01:22:34)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import gopy
>>> gopy.load()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'gopy' has no attribute 'load'
>>>
- docker
docker build --network=host -t go-python/gopy .
Sending build context to Docker daemon 4.836MB
Step 1/3 : FROM golang:onbuild
# Executing 3 build triggers
---> Using cache
---> Running in 921b4192dcac
+ exec go get -v -d
github.com/go-python/gopy (download)
github.com/pkg/errors (download)
github.com/gonuts/commander (download)
github.com/gonuts/flag (download)
Fetching https://golang.org/x/tools/go/packages?go-get=1
Parsing meta tags from https://golang.org/x/tools/go/packages?go-get=1 (status code 200)
get "golang.org/x/tools/go/packages": found meta tag main.metaImport{Prefix:"golang.org/x/tools", VCS:"git", RepoRoot:"https://go.googlesource.com/tools"} at https://golang.org/x/tools/go/packages?go-get=1
get "golang.org/x/tools/go/packages": verifying non-authoritative meta tag
Fetching https://golang.org/x/tools?go-get=1
Parsing meta tags from https://golang.org/x/tools?go-get=1 (status code 200)
golang.org/x/tools (download)
Removing intermediate container 921b4192dcac
---> Running in 1cac7d2530d9
+ exec go install -v
github.com/pkg/errors
golang.org/x/tools/go/internal/gcimporter
github.com/gonuts/flag
golang.org/x/tools/go/internal/packagesdriver
golang.org/x/tools/internal/fastwalk
golang.org/x/tools/internal/semver
golang.org/x/tools/internal/span
golang.org/x/tools/internal/gopathwalk
# golang.org/x/tools/go/internal/packagesdriver
../golang.org/x/tools/go/internal/packagesdriver/sizes.go:107: undefined: types.SizesFor
github.com/go-python/gopy/bind
# golang.org/x/tools/go/internal/gcimporter
../golang.org/x/tools/go/internal/gcimporter/bexport.go:212: obj.IsAlias undefined (type *types.TypeName has no field or method IsAlias)
../golang.org/x/tools/go/internal/gcimporter/iexport.go:234: obj.IsAlias undefined (type *types.TypeName has no field or method IsAlias)
github.com/gonuts/commander
# github.com/go-python/gopy/bind
../github.com/go-python/gopy/bind/symbols.go:134: f.Embedded undefined (type *types.Var has no field or method Embedded)
../github.com/go-python/gopy/bind/symbols.go:1001: f.Embedded undefined (type *types.Var has no field or method Embedded)
../github.com/go-python/gopy/bind/types.go:133: f.Embedded undefined (type *types.Var has no field or method Embedded)
The command '/bin/sh -c go-wrapper install' returned a non-zero code: 2
I will appreciate any help!
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 3
- Comments: 17 (6 by maintainers)
Sorry for not being able to look at this – from what I can tell, the underlying issue is the linker not being able to find the .so files. This has to be solved by adding the proper path to LD_LIBRARY_PATH at some level, and by finding exactly where the .so files are, this should be solvable, at least at a workaround level.
I will try to boot up my linux system at some point soon and see if I can provide some further insight. I haven’t really run gopy on anything other than my mac at this point… Sorry very busy this quarter.
@robooo @HuiiBuh I am unsure of the exact reason, but I was helping a friend with a similar issue as in 1. For him, it was something with the LD path. Maybe it could be an issue with not looking locally or some python configuration issue. I am unsure.
The following should be a hack to make it work. Try this and see if it helps.
@rcoreilly @sbinet When you have time, please have a look at this issue.
I am also trying to figure out how the tests are running and passing in the CI. Tried this (on both Debian Buster + Python3.7 and Ubuntu Xenial + Python3.5).
If I just copy the
madeingo_go.soorhi_go.soin our main example to the right path (/usr/lib), the system can find the right shared library file. But, otherwise it can not. Any help on this will be really helpful.