devitocodes / devito

DSL and compiler framework for automated finite-differences and stencil computation
http://www.devitoproject.org
MIT License
535 stars 222 forks source link

`examples/__init__.py` missing in pypi source #1954

Open stephenmsachs opened 1 year ago

stephenmsachs commented 1 year ago

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.

georgebisbas commented 1 year ago

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 acore 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]
stephenmsachs commented 1 year ago

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 commented 1 year ago

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

georgebisbas commented 1 year ago

Thank you @stephenmsachs !

georgebisbas commented 1 year ago

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

stephenmsachs commented 1 year ago

@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.

georgebisbas commented 1 year ago

@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.

mloubout commented 2 months ago

Is this still an issue?