devito icon indicating copy to clipboard operation
devito copied to clipboard

`examples/__init__.py` missing in pypi source

Open stephenmsachs opened this issue 1 year ago • 8 comments

I found out that building the tarball hosted on pypi will not include the examples directory (independent of $DEVITO_BENCHMARKS). It seems the file examples/__init__.py is not present in the tarball:

[stesachs@ip-10-8-209-211 devito]$ curl -sOL https://files.pythonhosted.org/packages/a7/f9/d9c8d1cadf404a4ada70746595896aad6c0e8e1584c1711f1015d280c2ee/devito-4.6.2.tar.gz
[stesachs@ip-10-8-209-211 devito]$ tar xf devito-4.6.2.tar.gz 
[stesachs@ip-10-8-209-211 devito]$ cd devito-4.6.2/
[stesachs@ip-10-8-209-211 devito-4.6.2]$ python '-m' 'pip' '-vvv' '--no-input' '--no-cache-dir' '--disable-pip-version-check' 'install' '--no-deps' '--ignore-installed' '--no-build-isolation' '--no-warn-script-location' '--no-index' '--prefix=~/py-devito-4.6.2-byhand' --force-reinstall '.' |& grep -c examples
0
[stesachs@ip-10-8-209-211 devito-4.6.2]$ touch examples/__init__.py
[stesachs@ip-10-8-209-211 devito-4.6.2]$ python '-m' 'pip' '-vvv' '--no-input' '--no-cache-dir' '--disable-pip-version-check' 'install' '--no-deps' '--ignore-installed' '--no-build-isolation' '--no-warn-script-location' '--no-index' '--prefix=~/py-devito-4.6.2-byhand' --force-reinstall '.' |& grep -c examples
160

Please let me know if this is the wrong place to post the issue.

stephenmsachs avatar Jul 05 '22 09:07 stephenmsachs

Hi @stephenmsachs, this is on our list to fix soon, there are a number of reasons we do not include examples in the pip (from PyPI) installation. We are also trying to improve our PyPI installation instructions in this PR: https://github.com/devitocodes/devito/pull/1920/files

Also, the examples directory is not in a sense a core component of the devito DSL and compiler framework, as they just showcase examples of how you can use the DSL to model problems.

I am assuming that you want to run examples and benchmark some of them.

Is there any specific reason that the below path will not work for you?

 # Clone Devito
 git clone https://github.com/devitocodes/devito.git
 cd devito

For a Python3 virtual environment:

python3 -m venv /path/to/new/virtual/environment
source activate /path/to/new/virtual/environment/bin/activate

For a Conda environment:

conda create -n devito
conda activate devito

and finally, install Devito along with any extra dependencies:

pip install -e .
 # To install additional dependencies
 # pip install -e .[extras,mpi,nvidia]

georgebisbas avatar Jul 05 '22 10:07 georgebisbas

Hi @georgebisbas,

Thanks for the quick reply.

I am actually developing a Spack package for devito. Spack installs Python packages by downloading the tarball from pypi and then running pip install . inside the sources. For now I have added a touch examples/__init__.py in the spack package. I'l update once there is a PR.

stephenmsachs avatar Jul 05 '22 10:07 stephenmsachs

FYI this is the PR to add devito tp Spack: https://github.com/spack/spack/pull/31495

stephenmsachs avatar Jul 11 '22 15:07 stephenmsachs

Thank you @stephenmsachs !

georgebisbas avatar Jul 17 '22 13:07 georgebisbas

@stephenmsachs would you like to point us to any resources wrt Devito in Spack?

georgebisbas avatar Sep 19 '22 11:09 georgebisbas

@stephenmsachs would you like to point us to any resources wrt Devito in Spack?

Not sure hat you mean by resources. There is a Spack package to build Devito here. You can build this via spack install py-devito. They use pypi under the hood, so at the time I could only add v4.6.2. Also, no GPU support yet.

stephenmsachs avatar Sep 19 '22 13:09 stephenmsachs

@stephenmsachs I have not forgotten about this, just left in side for a moment. In addition, the examples are not really part of the Devito DSL and compiler framework but rather examples of using the DSL to model practical applications. Having this in my TODO list.

georgebisbas avatar Sep 30 '22 18:09 georgebisbas

Is this still an issue?

mloubout avatar Apr 19 '24 01:04 mloubout