Skip to content

Commit

Permalink
Remove the need of installing numpy manually before installing Solcore
Browse files Browse the repository at this point in the history
* Added the function that install numpy before everything

* Ignoring Codacy

* Removed pre-installation of numpy due to the installing during setup fase

* Modified the docs reflecting the change (numpy not needed)
  • Loading branch information
Abelarm committed Oct 24, 2021
1 parent 760eddb commit 2ca5ffb
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test_unit_and_examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:

- name: Install python dependencies
run: |
python -m pip install --upgrade setuptools wheel pip twine numpy
python -m pip install --upgrade setuptools wheel pip twine
python -m pip install -e .[dev]
- name: Install S4 in Linux
Expand Down Expand Up @@ -119,7 +119,7 @@ jobs:
- name: Install python dependencies
run: |
python -m pip install --upgrade setuptools wheel pip twine numpy
python -m pip install --upgrade setuptools wheel pip twine
python -m pip install -e .[dev]
- name: Install Solcore Linux and MacOS
Expand Down
5 changes: 0 additions & 5 deletions docs/source/Installation/Solcore_on_Windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ sudo apt install python3-pip
sudo apt-get install libblas-dev liblapack-dev
```

- Install NumPy:

```bash
pip3 install numpy
```
- Install matplotlib (and tk, otherwise get an error later):

```bash
Expand Down
5 changes: 2 additions & 3 deletions docs/source/Installation/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@ Solcore is written mostly in Python, but the Poisson-Drift-diffusion (PDD) solve
- Python >3.7
- pip
- setuptools
- numpy
- :doc:`a suitable Fortran compiler (only needed for the PDD solver) <compilation>`

*Pip* is normally part of the standard Python installation, but you might need to install *setuptools* and *numpy* manually with::
*Pip* is normally part of the standard Python installation, but you might need to install *setuptools* manually with::

pip install setuptools numpy
pip install setuptools

Now, installing Solcore should be as easy as writing in the terminal::

Expand Down
16 changes: 13 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
from setuptools import find_packages
from setuptools import dist, find_packages


def pre_install_numpy():
try:
import numpy # noqa
except ImportError:
print('Installing numpy')
numpy_version = dist.Distribution().fetch_build_eggs(['numpy'])[0].version
print(f'Pre-installed numpy {numpy_version}')


pre_install_numpy()
from numpy.distutils.core import Extension, setup

import os
Expand Down Expand Up @@ -68,7 +80,6 @@ def gen_data_files(*dirs):
with open(os.path.join(here, "README.md"), encoding="utf-8") as f:
long_description = f.read()


install_requires = [
"numpy",
"matplotlib",
Expand Down Expand Up @@ -97,7 +108,6 @@ def gen_data_files(*dirs):
"test": tests_require,
}


setup(
name="solcore",
version=config.get("Configuration", "version"),
Expand Down

0 comments on commit 2ca5ffb

Please sign in to comment.