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

undefined symbol: gsl_rng_uniform_int #29

Closed
AdrianSosic opened this issue Jan 23, 2019 · 4 comments
Closed

undefined symbol: gsl_rng_uniform_int #29

AdrianSosic opened this issue Jan 23, 2019 · 4 comments

Comments

@AdrianSosic
Copy link

Hi Scott,

Thanks for sharing your code. Unfortunately, I am having problems executing it on my Linux machine. While everything works fine on macOS, I get the following error on Linux:

Traceback (letzter Anruf zuletzt):
Datei "", Zeile 1, in >.
Datei "/home/asosic/Checkouts/p3/pypolyagamma/pypolyagamma/init.py", Zeile 3, in
aus pypolyagamma.pypolyagamma Import PyRNG, PyPolyaGamma
ImportError: /home/asosic/Checkouts/p3/pypolyagamma/pypolyagamma/pypolyagamma.cpython-36m-x86_64-linux-gnu.so: undefiniertes Symbol: gsl_rng_uniform_int

The minimal code to reproduce the error is:

virtualenv -p python3 venv
source venv/bin/activate
pip install cython    
git clone https://github.com/slinderman/pypolyagamma
cd pypolyagamma
pip install -e .
cd ..
python -c "import pypolyagamma"

As I said before, the above runs perfectly fine on macOS. Do you have any clue what is going on here?

Best regards,
Adrian

@slinderman
Copy link
Owner

Hi Adrian,

Looks like it's not linking properly. Can you try rerunning the above but with pip install -v - e . and post the output? You should see a bunch of calls like gcc ... -c deps/gsl/... followed by a call to g++. I want to see if those look as expected.

I was not able to repro this on my linux machine, and the Travis builds are working properly, also on linux. I'm not sure what could be different about your setup.

Best,
Scott

@AdrianSosic
Copy link
Author

Hi Scott,

Thanks for your quick reply. Incorrect linking was my first guess, too, but unfortunately I'm not familiar enough with the Cython framework to identify the cause of the problem.

Here are the logs from both machines:
log_linux.txt
log_mac.txt

One major difference is that the code is compiled with clang on macOS whereas gcc is used on linux.

Best,
Adrian

@slinderman
Copy link
Owner

slinderman commented Jan 23, 2019

Thanks for sharing. I don't see anything particularly strange in the logs... no errors in compilation or linking reported.

Why don't you try this instead. First install GSL manually, e.g. on Ubuntu:

sudo apt-get install libgsl-dev

(You could also do this via conda install gsl if you're using Anaconda.)

Then install pypolyagamma by linking against the system-wide GSL library (rather than downloading GSL and compiling necessary source files, as the master branch does). You can do this with the condagsl branch. These steps should do it:

virtualenv -p python3 venv
source venv/bin/activate
pip install cython    
git clone https://github.com/slinderman/pypolyagamma
cd pypolyagamma
git checkout condagsl
pip install -v -e .
cd ..
python pypolyagamma/test/test_basics.py

In the future, I'd like to move PyPolyaGamma to this installation approach, but I'm not yet convinced it will work (more) reliably for everyone.

@AdrianSosic
Copy link
Author

Hi Scott,

good news: it's running -- yet, I still don't know what the problem was. It turned out that everything works fine if I run the code in a conda environment. Apparently, the linking problem does not occur there. However, I used had to use the master branch (or, alternatively, simply "pip install pypolygamma") since the proposed condagsl approach didn't work either.

By the way, while testing, I also noticed that the pip installation only works with Python 3.6 but not with 3.7. The error looks pretty much like the one described here:
https://github.com/rkern/line_profiler/issues/132](url)
which seems to be related to some precompiled files.

Anyway, thanks a lot for your help!

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