Install
Supported Platforms
Successful installation and tests have been performed on the following platforms and Python/PyPy versions shown in the table below.
Platform |
Arch |
Python Version |
PyPy Version 1 |
Continuous Integration |
|||||
---|---|---|---|---|---|---|---|---|---|
3.9 |
3.10 |
3.11 |
3.12 |
3.8 |
3.9 |
3.10 |
|||
Linux |
X86-64 |
✔ |
✔ |
✔ |
✔ |
✔ |
✔ |
✔ |
|
AARCH-64 |
✔ |
✔ |
✔ |
✔ |
✔ |
✔ |
✔ |
||
macOS |
X86-64 |
✔ |
✔ |
✔ |
✔ |
✔ |
✔ |
✔ |
|
ARM-64 |
✔ |
✔ |
✔ |
✔ |
✔ |
✔ |
✔ |
||
Windows |
X86-64 |
✔ |
✔ |
✔ |
✔ |
✔ |
✔ |
✔ |
Python wheels for special_functions
for all supported platforms and versions in the above are available through PyPI and Anaconda Cloud. If you need special_functions
on other platforms, architectures, and Python or PyPy versions, raise an issue on GitHub and we build its Python Wheel for you.
Dependencies
At runtime: This package does not have any dependencies at runtime.
For tests: To run tests,
scipy
package is required and can be installed bypython -m pip install -r tests/requirements.txt
Install Package
Install by either through PyPi, Conda, or build locally.
Install from PyPI
The recommended installation method is through the package available at PyPi using pip
.
Ensure
pip
is installed within Python and upgrade the existingpip
bypython -m ensurepip python -m pip install --upgrade pip
If you are using PyPy instead of Python, ensure
pip
is installed and upgrade the existingpip
bypypy -m ensurepip pypy -m pip install --upgrade pip
Install this package in Python by
python -m pip install special_functions
or, in PyPy by
pypy -m pip install special_functions
Install from Anaconda Cloud
Alternatively, the package can be installed through Anaconda could.
In Linux and Windows:
conda install -c s-ameli special_functions
In macOS:
conda install -c s-ameli -c conda-forge special_functions
Build and Install from Source Code
Build dependencies: To build the package from the source code, numpy
and cython
are required. These dependencies are installed automatically during the build process and no action is needed.
Install both C and Fortran compilers as follows.
Linux: Install
gcc
, for instance, byapt
(or any other package manager on your Linux distro)sudo apt install gcc gfortran
macOS: Install
gcc
via Homebrew:sudo brew install gcc
Note
If
gcc
is already installed, but Fortran compiler is yet not available on macOS, you may resolve this issue by reinstalling:sudo brew reinstall gcc
Windows: Install both Microsoft Visual C++ compiler and Intel Fortran compiler (Intel oneAPI). Open the command prompt (where you will enter the installation commands in the next step) and load the Intel compiler variables by
C:\Program Files (x86)\Intel\oneAPI\setvars.bat
Here, we assumed the Intel Fortran compiler is installed in
C:\Program Files (x86)\Intel\oneAPI
. You may set this directory accordingly to the directory of your Intel compiler.
Clone the source code and install this package by
git clone https://github.com/ameli/special_functions.git cd special_functions python -m pip install .
Warning
After the package is built and installed from the source code, the package cannot be imported properly if the current working directory is the same as the source code directory. To properly import the package, change the current working directory to a directory anywhere else outside of the source code directory. For instance:
cd ..
python -c "import special_functions"
Install in Virtual Environment
If you do not want the installation to occupy your main python’s site-packages, you may install the package in an isolated virtual environment. Below we describe the installation procedure in two common virtual environments, namely, virtualenv and conda.
Install in virtualenv
Environment
Install
virtualenv
:python -m pip install virtualenv
Create a virtual environment and give it a name, such as
special_functions_env
python -m virtualenv special_functions_env
Activate python in the new environment
source special_functions_env/bin/activate
Install
special_functions
package with any of the above methods. For instance:python -m pip install special_functions
Then, use the package in this environment.
To exit from the environment
deactivate
Install in conda
Environment
In the following, it is assumed anaconda (or miniconda) is installed.
Initialize conda (if it was not initialized before)
conda init
You may need to close and reopen the terminal after the above command. Alternatively, instead of the above, you can do
sudo sh $(conda info --root)/etc/profile.d/conda.sh
Create a virtual environment and give it a name, such as
special_functions_env
conda create --name special_functions_env -y
The command
conda info --envs
shows the list of all environments. The current environment is marked by an asterisk in the list, which should be the default environment at this stage. In the next step, we will change the current environment to the one we created.Activate the new environment
conda activate special_functions_env
Install
special_functions
with any of the above methods. For instance:conda install -c s-ameli special_functions
Then, use the package in this environment.
To exit from the environment
conda deactivate