bgslibrary icon indicating copy to clipboard operation
bgslibrary copied to clipboard

Python: ImportError: No module named libbgs

Open Insaf-Setitra opened this issue 7 years ago • 8 comments

Hello,

I have compiled the library using:

git clone https://github.com/andrewssobral/bgslibrary.git cd build cmake -D BGS_PYTHON_SUPPORT=ON .. make

no errors in making, added to the python path:

`>>> import sys

from pprint import pprint as pp pp(sys.path) ['', '/home/user/bgslibrary/build/libbgs.so', '/home/user/bgslibrary', '/usr/lib/python27.zip', '/usr/lib64/python2.7', '/usr/lib64/python2.7/plat-linux2', '/usr/lib64/python2.7/lib-tk', '/usr/lib64/python2.7/lib-old', '/usr/lib64/python2.7/lib-dynload', '/usr/lib64/python2.7/site-packages', '/usr/lib/python2.7/site-packages']`

I tried many adds into the path: 'libbgs.so', '/home/user/bgslibrary/build/libbgs.so', '/home/user/bgslibrary',

But still have the error : [user@localhost bgslibrary]$ python Demo.py Traceback (most recent call last): File "Demo.py", line 3, in import libbgs ImportError: No module named libbgs

OS: Fedora 25

Any suggestions?

Thanks,

Insaf-Setitra avatar Feb 27 '18 10:02 Insaf-Setitra

I have the same problem, have you solved it? @fasni

jzyztzn avatar Apr 14 '18 18:04 jzyztzn

@fasni You need to point to the build directory where you made the bgslibrary software:

export PYTHONPATH="${PYTHONPATH}:$HOME/myapps/bgslibrary/build"

kaisark avatar Apr 29 '18 20:04 kaisark

Same problem. Sometimes it works, but most of the time I can't import module

zuenko avatar Jun 05 '18 08:06 zuenko

import sys sys.path.append('/home/denis/bgslibrary/build')

Pointing doesn't work fine for me, but this lane into your code help me to execute it anywhere.

zuenko avatar Jun 07 '18 14:06 zuenko

Now with the migration to pybind11 I think this issue was solved

andrewssobral avatar Sep 10 '18 22:09 andrewssobral

It's works.
Add this at the top of script.

import os
import sys
sys.path.append(os.getcwd() + '/build')

potoo0 avatar Mar 13 '19 10:03 potoo0

Same here even i tried all the above solutions. Which file from build folder is needed ?

miltosc avatar Dec 23 '19 13:12 miltosc

Same here even i tried all the above solutions. Which file from build folder is needed ?

Well, you can backup the original folder and delete some files for testing. According to my tests, following files are required:

bgs.cp36-win_amd64.pyd
bgs.exp
bgs.lib
bgslibrary_core.dll
bgslibrary_core.exp
bgslibrary_core.lib

And, .vs is a hidden folder under the bulid folder, which takes up quite a bit of disk.

potoo0 avatar Dec 24 '19 08:12 potoo0