stfbnc/fathon

Difficulty installing fathon on Linux

ali-ramadhan opened this issue · 9 comments

I installed gsl through pacman but ran into a few issues.

The command given in step 3 of the README seems incorrect.

$ python setup.py build_ext -- =/usr/include/gsl/ -- =/usr/lib/ --inplace
zsh: /usr/include/gsl/ not found

so I changed it to

$ python setup.py build_ext -- /usr/include/gsl/* -- /usr/lib/ --inplace
Traceback (most recent call last):
  File "setup.py", line 2, in <module>
    from Cython.Build import cythonize
ModuleNotFoundError: No module named 'Cython'

so apparently I had to install install Cython. Googling brought me to CellProfiler/centrosome#78 so it was simple to fix and now I think I got it to start compiling but I ran into another issue

$ python setup.py build_ext -- /usr/include/gsl/* -- /usr/lib/ --inplace
Compiling src/dfa.pyx because it changed.
Compiling src/dcca.pyx because it changed.
Compiling src/mfdfa.pyx because it changed.
Compiling src/ht.pyx because it changed.
[1/4] Cythonizing src/dcca.pyx
[2/4] Cythonizing src/dfa.pyx
[3/4] Cythonizing src/ht.pyx
[4/4] Cythonizing src/mfdfa.pyx
invalid command name '/usr/include/gsl/gsl_blas.h'

Apologies if I'm just doing something stupid. Just hoping to install fathon and try playing around with it.

Thanks so much!

There was an error in the README, try python setup.py build_ext --include-dirs=/path/to/GSL/includes --rpath=/path/to/GSL/libs --inplace

In your specific case, python setup.py build_ext --include-dirs=/usr/include/ --rpath=/usr/lib/ --inplace

@ali-ramadhan I have now changed the installation guidelines in the README.md, and GSL is no more required.

Let me know if you still have problems with the installation.

Hi @stfbnc, I should point out the instructions are not sufficient. Could be improved with the following suggestions:

  • As a first step, specify build requirements such as cython, numpy in requirements.txt file, with versions if necessary. Followed by
pip install -r requirements.txt

Better solutions to specify build requirements as pyproject.toml may be explored in the future.

  • Do not rely on shell commands via subprocess. Especially, use of shell=True is not recommended in the official documentation. Atleast use shutil and os.path / pathlib. An even better option be to use MANIFEST.IN which would copy LICENSE, README etc. while packaging with python setup.py sdist
  • Consider renaming directories ./src to ./fathon and move __init__.py. Set target for built extensions inside ./fathon. I believe that is the standard way. This would assist distuils to run python setup.py install and copy the code to site-packages.

I followed your installation instructions in Ubuntu as it is now. But I get:

❯ python -c 'import fathon'          
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/avmo/src/sandbox/venv-fathon/lib/python3.8/site-packages/fathon/__init__.py", line 19, in <module>
    from .dfa import DFA
ImportError: libgsl.so.25: cannot open shared object file: No such file or directory

I had to run:

❯ LD_LIBRARY_PATH="../venv-fathon/lib/python3.8/site-packages/fathon/fathonGSL/lib/" python -c 'import fathon'

to make it work. Note that I am using a virtual environment.

@ali-ramadhan @ashwinvis fathon is now available via pip and the user can choose to install GSL by themselves or let pip download and install it.
See the README.md for the installation guidelines.

@ashwinvis I have followed your suggestions. In the readme there are now also instructions for fathon installation in a virtual environment.

Thank you so much! It looks much better now. I really appreciate the effort you took to improve the installation.

@ali-ramadhan @ashwinvis Any news with the installation?

@stfbnc I was able to install fathon on Arch Linux, thank you!

A small hiccup with GSL that I mention in #2 but I'll close this issue as @ashwinvis also seems happy with the installation process.