aschein / prgds

Poisson-Randomized Gamma Dynamical Systems

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

fatal error: gsl/gsl_rng.h: No such file or directory

xnfei opened this issue · comments

commented

Could anyone help? When I tried to run this project in Ubuntu 18.04, I faced this problem:

./apf/base/allocate.c:632:10: fatal error: gsl/gsl_rng.h: No such file or directory
#include "gsl/gsl_rng.h"
^~~~~~~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
Makefile:2: recipe for target 'all' failed
make: *** [all] Error 1

Hi Bill,

I don’t understand your message. Have you installed GSL and successfully compiled the code?

commented
commented

I think I have installed GSL, but I don't know how to check if it's installed successfully.
I did as below, following this reference:https://coral.ise.lehigh.edu/jild13/2016/07/11/hello/

wget ftp://ftp.gnu.org/gnu/gsl/gsl-*.*.tar.gz
tar -zxvf gsl-..tar.gz
cd gsl-1.7
mkdir /home/yourname/gsl
./configure --prefix=/home/yourname/gsl
make
make check
make install

Hi Bill,

There are tests and experiment scripts in the src directory. But, I am happy to write a Jupyter Notebook that shows how to use the model; I can do that this weekend.

In the meantime, can you type "Make" into the terminal and copy-and-paste the output?

Best,
Aaron

Your messages appear to be corrupted. Can you log-in to Github from a browser and double-check that your messages are written as intended? I am seeing lots of HTML (which I don't think is the output of Make).

commented

It shows:
xiaoning@DESKTOP-DMOUKTE:$ make
make: *** No targets specified and no makefile found. Stop.
xiaoning@DESKTOP-DMOUKTE:
$ cd venv/prgds-master/src/
xiaoning@DESKTOP-DMOUKTE:/venv/prgds-master/src$ make
python3 setup.py build_ext -i
running build_ext
xiaoning@DESKTOP-DMOUKTE:
/venv/prgds-master/src$

In the src directory, please try typing

python tests/test_prgds.py

and tell me what happens.

commented

I tried both python and python3.

xiaoning@DESKTOP-DMOUKTE:~/venv/prgds-master/src$ python3 tests/test_prgds.py
Traceback (most recent call last):
File "tests/test_prgds.py", line 4, in
from apf.models.prgds import PRGDS
ImportError: /usr/lib/x86_64-linux-gnu/libgsl.so.23: undefined symbol: cblas_ctrmv

xiaoning@DESKTOP-DMOUKTE:~/venv/prgds-master/src$ python tests/test_prgds.py
Traceback (most recent call last):
File "tests/test_prgds.py", line 4, in
from apf.models.prgds import PRGDS
ImportError: No module named prgds

Looks like it didn't compile properly. Can you switch to the src directory and remove the build
rm -rf build
and then type Make again and paste the first few lines.

commented

well, it shows the same:

xiaoning@DESKTOP-DMOUKTE:/venv/prgds-master/src$ rm -rf build
xiaoning@DESKTOP-DMOUKTE:
/venv/prgds-master/src$ make
python3 setup.py build_ext -i
running build_ext
xiaoning@DESKTOP-DMOUKTE:~/venv/prgds-master/src$

commented

Any advice, sir?

Hi Bill,

I just tried cloning the repo on a Linux machine and compiling. Here's the output I got:

python setup.py build_ext -i
Compiling ./apf/base/allocate.pyx because it changed.
Compiling ./apf/base/apf.pyx because it changed.
Compiling ./apf/base/bessel.pyx because it changed.
Compiling ./apf/base/conf_hypergeom.pyx because it changed.
Compiling ./apf/base/cyutils.pyx because it changed.
Compiling ./apf/base/mcmc_model_parallel.pyx because it changed.
Compiling ./apf/base/sample.pyx because it changed.
Compiling ./apf/base/sbch.pyx because it changed.
Compiling ./apf/models/gpdptf.pyx because it changed.
Compiling ./apf/models/pgds.pyx because it changed.
Compiling ./apf/models/prgds.pyx because it changed.
[ 1/11] Cythonizing ./apf/base/allocate.pyx
[ 2/11] Cythonizing ./apf/base/apf.pyx
[ 3/11] Cythonizing ./apf/base/bessel.pyx
[ 4/11] Cythonizing ./apf/base/conf_hypergeom.pyx
[ 5/11] Cythonizing ./apf/base/cyutils.pyx
[ 6/11] Cythonizing ./apf/base/mcmc_model_parallel.pyx
[ 7/11] Cythonizing ./apf/base/sample.pyx
[ 8/11] Cythonizing ./apf/base/sbch.pyx
[ 9/11] Cythonizing ./apf/models/gpdptf.pyx
[10/11] Cythonizing ./apf/models/pgds.pyx
[11/11] Cythonizing ./apf/models/prgds.pyx
running build_ext

I'm not sure why you're not seeing the same thing. Perhaps you haven't installed Cython?

commented

I already got this [ 1/11] Cythonizing stuff.
I guess after the first time compling , I would simply see

python3 setup.py build_ext -i
running build_ext

what i really want to know is what to do next

commented

for example, is there any result i can see?

OK then please do what I asked before:

cd into src and type:
python tests/test_prgds.py

And, as I stated above, I will push a Jupyter Notebook this weekend that gives a simple example of how to run the model on a data set.

commented

I cloned the project and ran it again, now i have something new:

xiaoning@DESKTOP-DMOUKTE:~/venv/New folder/prgds-master/src$ python3 tests/test_prgds.py
Traceback (most recent call last):
File "tests/test_prgds.py", line 4, in
from apf.models.prgds import PRGDS
ImportError: /usr/lib/x86_64-linux-gnu/libgsl.so.23: undefined symbol: cblas_ctrmv

commented

I tried again from the very first step.
Finally, I got this error:
ModuleNotFoundError: No module named 'apf.models.prgds'

xiaoning@DESKTOP-DMOUKTE:~/venv/case1/prgds-master/src$ python3 setup.py
Compiling ./apf/base/allocate.pyx because it changed.
Compiling ./apf/base/apf.pyx because it changed.
Compiling ./apf/base/bessel.pyx because it changed.
Compiling ./apf/base/conf_hypergeom.pyx because it changed.
Compiling ./apf/base/cyutils.pyx because it changed.
Compiling ./apf/base/mcmc_model_parallel.pyx because it changed.
Compiling ./apf/base/sample.pyx because it changed.
Compiling ./apf/base/sbch.pyx because it changed.
Compiling ./apf/models/gpdptf.pyx because it changed.
Compiling ./apf/models/pgds.pyx because it changed.
Compiling ./apf/models/prgds.pyx because it changed.
[ 1/11] Cythonizing ./apf/base/allocate.pyx
[ 2/11] Cythonizing ./apf/base/apf.pyx
[ 3/11] Cythonizing ./apf/base/bessel.pyx
[ 4/11] Cythonizing ./apf/base/conf_hypergeom.pyx
[ 5/11] Cythonizing ./apf/base/cyutils.pyx
[ 6/11] Cythonizing ./apf/base/mcmc_model_parallel.pyx
[ 7/11] Cythonizing ./apf/base/sample.pyx
[ 8/11] Cythonizing ./apf/base/sbch.pyx
[ 9/11] Cythonizing ./apf/models/gpdptf.pyx
[10/11] Cythonizing ./apf/models/pgds.pyx
[11/11] Cythonizing ./apf/models/prgds.pyx
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help

error: no commands supplied
xiaoning@DESKTOP-DMOUKTE:/venv/case1/prgds-master/src$ python3 tests/test_prgds.py
Traceback (most recent call last):
File "tests/test_prgds.py", line 4, in
from apf.models.prgds import PRGDS
ModuleNotFoundError: No module named 'apf.models.prgds'
xiaoning@DESKTOP-DMOUKTE:
/venv/case1/prgds-master/src$

It looks like you typed python setup.py and then got an error. You need to type python setup.py build_ext -i. You can also use the Makefile provided in the src/ directory and type Make, which will do the same thing.

After you do that, please also show me the last lines of output to confirm that it has completed compiling successfully.

commented

x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fwrapv -O2 -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.8/./apf/models/prgds.o -L/usr/local/lib/ -lgsl -o /home/xiaoning/venv/demo/prgds-master/src/apf/models/prgds.cpython-38-x86_64-linux-gnu.so -fopenmp
xiaoning@DESKTOP-DMOUKTE:~/venv/demo/prgds-master/src$

Looks good. Now what happens when you cd to the src directory and type python tests/test_prgds.py?

commented

it shows this:
xiaoning@DESKTOP-DMOUKTE:~/venv/demo/prgds-master/src$ python3 tests/test_prgds.py
Traceback (most recent call last):
File "tests/test_prgds.py", line 4, in
from apf.models.prgds import PRGDS
ImportError: /usr/lib/x86_64-linux-gnu/libgsl.so.23: undefined symbol: cblas_ctrmv

This suggests there's some problem finding the header files for your installation of GSL. Are you using Anaconda?

There are instructions at the bottom of the ReadMe for how to use Anaconda to install GCC and GSL. If you install GCC/GSL a different way, you may have to troubleshoot linking those libraries/headers.

commented

No, in Ubuntu, I directly installed python

You can install Anaconda on Ubuntu. Please try that.

commented

okay , let me try.

commented

I have a lecture from1:30 to 4:15p.m.
please allow me to reponse later

No rush!

commented

Yeah! It seems I could successfully run this command : python tests/test_prgds.py
But I also got this Error. May I ask what does this mean?

Traceback (most recent call last):
File "apf/base/apf.pyx", line 217, in apf.base.apf.APF.reconstruct
return tl.kruskal_to_tensor(mtxs, weights=self.core_Q)[subs]
TypeError: kruskal_to_tensor() got an unexpected keyword argument 'weights'
Exception ignored in: 'apf.base.apf.APF._update_Y_PQ'
Traceback (most recent call last):
File "apf/base/apf.pyx", line 217, in apf.base.apf.APF.reconstruct
return tl.kruskal_to_tensor(mtxs, weights=self.core_Q)[subs]
TypeError: kruskal_to_tensor() got an unexpected keyword argument 'weights'

commented

When I tried to run python tests/test_pgds.py
It returned:

Exception ignored in: 'apf.base.apf.APF._update_Y_PQ'
Traceback (most recent call last):
File "/home/xiaoning/anaconda3/lib/python3.7/site-packages/numpy/ma/core.py", line 2863, in new
raise MaskError(msg % (nd, nm))
numpy.ma.core.MaskError: Mask and data not compatible: data size is 1, mask size is 36.

OK, this is progress.

It looks like the Python library Tensorly updated since I wrote this code. The old version of
tensorly.kruskal_to_tensor
used to take a weights argument. The new version does not. That is annoying. I will update the code to be consistent with the latest version of Tensorly.

In the meantime, if you are in a rush, you will need to install an older version of Tensorly (0.4.2). You can do that with Anaconda by typing:

conda install -c conda-forge tensorly=0.4.2

Also, please pull. I fixed a naming inconsistency between the model files and the test scripts.

commented

I used your new scripts, but it returned the same.
so I reinstall the tensorly. Finally!

(base) xiaoning@DESKTOP-DMOUKTE:~/venv/demo/prgds-master/src$ python tests/test_prgds.py
Using numpy backend.
seed: 8496
30% missing
0
500
1000
1500
2000
2500
3000
3500
4000
4500
0
500
1000
1500
2000