Installation of Glafic Library
The Glafic library is written in C and cannot be directly installed using pip install. However, the author has provided Python bindings via C-to-Python translation. Installation requires a series of steps:
Download Glafic
- Download the zip file from Glafic GitHub Repository.
- Extract the zip file to a specified directory (any location).
- Open a terminal in the corresponding folder.
Install Required Header Files (needed by Glafic library)
Open the terminal and install the necessary dependencies:
1 | sudo apt-get update |
Locate the Installation Paths for Libraries
The default location is usually /usr/lib, but sometimes the libraries might be installed in different directories. For example, the libraries may be located in /usr/lib/x86_64-linux-gnu. To find the exact location, use the following commands:
1 | sudo find / -name "libcfitsio.so" |
The results may look like:
1 | (base) usr@usr-computer:~$ sudo find / -name "libcfitsio.so" |
Modify Global Environment
Edit your global environment settings to add the library paths:
1 | nano ~/.bashrc |
Add the following line at the end of the file:
1 | export LD_LIBRARY_PATH=/usr/local/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH |
Replace /usr/local/lib/x86_64-linux-gnu with the actual path where the libraries are installed.
To save and exit the nano editor:
- Press
Ctrl + Oto save. - Press
Enterto confirm. - Press
Ctrl + Xto exit.
Update the environment:
1 | source ~/.bashrc |
Modify the Makefile
Edit the Makefile to ensure it uses the correct library paths:
1 | UNAME_S := $(shell uname -s) |
Install Python Libraries
Navigate to the directory containing setup.py and run the following command:
1 | pip install . |
Now you should be able to import and use the Glafic library in Python:
1 | import glafic |
Notes:
- This guide assumes the user is working on a Linux system, likely Ubuntu.
- The Python bindings are created via
setup.py, and users need to ensure their system is set up to compile C code and link libraries. - Ensure you replace the paths with the correct installation locations, especially for the libraries, if they are in a custom directory.