Skip to content

Instantly share code, notes, and snippets.

@wesselb
Last active January 20, 2024 10:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wesselb/4b44bf87f3789425f96e26c4308d0adc to your computer and use it in GitHub Desktop.
Save wesselb/4b44bf87f3789425f96e26c4308d0adc to your computer and use it in GitHub Desktop.
Generic Installation Instructions

Generic Installation Instructions

General Requirements

  • Python 3.8 or higher.
  • TensorFlow 2 if TensorFlow is used.

Instructions for macOS

The OS X Command Line Tools are required. These can be be installed with xcode-select --install. If you would like to update the Command Line Tools, delete /Library/Developer/CommandLineTools/ and run xcode-select --install.

Then install gcc and gfortran. Both are provided by brew's gcc:

brew install gcc

If you are using Anaconda, make and activate a new Anaconda environment:

conda create -n nameofenvironment python=3.8
conda activate nameofenvironment

Make sure that pip and related packages are up to date:

pip install --upgrade pip setuptools Cython numpy

If you are not using Anaconda, make and activate a new virtual environment:

pip install virtualenv
virtualenv -p python3 venv
source venv/bin/activate

Finally, install the package:

pip install package

NOTE: It is highly discouraged to use macOS's system python. If you are not using Anaconda, please use a python installed with brew.

Error: Error #15: Initializing libiomp5.dylib, but found libomp5.dylib already initialized.

Your Conda environment likely links an additional OpenMP, which is not necessary. You might be able to fix this with conda install nomkl, but obviously that might not be desired.

Instructions for Linux

Install the Python headers. Replace in the following X with your minor version number.

sudo apt-get install python3.X-dev

Install gfortran.

sudo apt-get install gfortran

If you do not have sudo rights, you can download gfortran locally and set the environment variables LAB_GFORTRAN and LAB_LIBGFORTRAN:

mkdir _cache
for LIB in gfortran-7 libgfortran4;
do
    apt-get download $LIB
    mv *.deb _cache
    dpkg -x _cache/*.deb _cache
    rm _cache/*.deb
done

export LAB_GFORTRAN="`pwd`/$(find _cache | grep x86_64-linux-gnu-gfortran-7$)"
export LAB_LIBGFORTRAN="`pwd`/$(find _cache | grep libgfortran.so.4$)"

Finally, install the package.

pip install package

Instructions for Windows

The package is not tested on Windows, although success has been reported with a simple pip install package in Cygwin.

@craftablescience
Copy link

Make sure that pip and related packages are up to date:
pip install --ugrade pip setuptools Cython numpy

Should be upgrade -- this will make it easier to copy-paste ;)

@wesselb
Copy link
Author

wesselb commented Mar 31, 2021

Good catch! Fixed. Thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment