Pressio / pressio-demoapps

Suite of 1D, 2D, 3D demo apps of varying complexity with built-in support for sample mesh and exact Jacobians

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

python has changed installation method, need to fix

fnrizzi opened this issue · comments

should not do anymore python setup.py install but sometihing else.

in fact I get:

/usr/local/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(

Hello,
based on Why you shouldn't invoke setup.py directly, there are a few things which needs to be pointed out:

  • packeges setup should follow PEP517 and PEP518
  • setuptools is effectively deprecated, but there are no warnings anywhere
  • almost all development and maintenance on setuptools is done by Jason R. Coombs, who also maintains nearly 150 other Python packages

Summary:

  • The setuptools project has stopped maintaining all direct invocations of setup.py years ago, and distutils is deprecated. There are undoubtedly many ways that your setup.py-based system is broken today, even if it's not failing loudly or obviously.
  • Direct invocations of setup.py cannot bootstrap their own dependencies, and so some CLI is necessary for dependency management
  • The setuptools project no longer wants to provide any public CLI, and will be actively removing the existing interface (though the time scale for this is long).
  • PEP 517, 518 and other standards-based packaging are the future of the Python ecosystem and a lot of progress has been made on making this upgrade seamless.
setup.py command python -m build (with build)
setup.py sdist or setup.py bdist_wheel python -m build (with build)
setup.py test pytest (usually via tox or nox)
setup.py install pip install
setup.py develop pip install -e
setup.py upload twine upload (with twine)
setup.py check twine check (this doesn't do all the same checks but it's a start)
Custom commands tox and nox environments

@marcinwrobel1986 after merging your branch, I get this:

pip3 build.py # this works

# then I do: 
pip3 install .
DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
WARNING: Ignoring invalid distribution -ressiodemoapps (/usr/local/lib/python3.9/site-packages)
WARNING: Ignoring invalid distribution -ressiodemoapps (/usr/local/lib/python3.9/site-packages)
Processing /Users/fnrizzi/Desktop/work/ROM/gitrepos/pressio-demoapps
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: pressiodemoapps
  Building wheel for pressiodemoapps (pyproject.toml) ... done
  Created wheel for pressiodemoapps: filename=pressiodemoapps-0.1.0rc1-py3-none-any.whl size=275737 sha256=8d52394dfdfcd308a9186043cc1f38c67bc063904d56d2136b4406c257f18f17
  Stored in directory: /Users/fnrizzi/Library/Caches/pip/wheels/26/70/92/f9c808f7df02b9cf525aae1425350662e075261b2a1ba9dbd8
Successfully built pressiodemoapps
WARNING: Ignoring invalid distribution -ressiodemoapps (/usr/local/lib/python3.9/site-packages)
Installing collected packages: pressiodemoapps
DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
WARNING: Ignoring invalid distribution -ressiodemoapps (/usr/local/lib/python3.9/site-packages)
Successfully installed pressiodemoapps-0.1.0rc1
WARNING: Ignoring invalid distribution -ressiodemoapps (/usr/local/lib/python3.9/site-packages)
WARNING: Ignoring invalid distribution -ressiodemoapps (/usr/local/lib/python3.9/site-packages)

are all those warnings expected?

@marcinwrobel1986

  • another thing is missing: how do I specify the build mode? Release vs debug? this was missing in the documentation
  • you edits the documention in the wrong place: you edited files insde docs/_sources but should have edited files inside docs/src

@marcinwrobel1986 after merging your branch, I get this:

pip3 build.py # this works

# then I do: 
pip3 install .
DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
WARNING: Ignoring invalid distribution -ressiodemoapps (/usr/local/lib/python3.9/site-packages)
WARNING: Ignoring invalid distribution -ressiodemoapps (/usr/local/lib/python3.9/site-packages)
Processing /Users/fnrizzi/Desktop/work/ROM/gitrepos/pressio-demoapps
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: pressiodemoapps
  Building wheel for pressiodemoapps (pyproject.toml) ... done
  Created wheel for pressiodemoapps: filename=pressiodemoapps-0.1.0rc1-py3-none-any.whl size=275737 sha256=8d52394dfdfcd308a9186043cc1f38c67bc063904d56d2136b4406c257f18f17
  Stored in directory: /Users/fnrizzi/Library/Caches/pip/wheels/26/70/92/f9c808f7df02b9cf525aae1425350662e075261b2a1ba9dbd8
Successfully built pressiodemoapps
WARNING: Ignoring invalid distribution -ressiodemoapps (/usr/local/lib/python3.9/site-packages)
Installing collected packages: pressiodemoapps
DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
WARNING: Ignoring invalid distribution -ressiodemoapps (/usr/local/lib/python3.9/site-packages)
Successfully installed pressiodemoapps-0.1.0rc1
WARNING: Ignoring invalid distribution -ressiodemoapps (/usr/local/lib/python3.9/site-packages)
WARNING: Ignoring invalid distribution -ressiodemoapps (/usr/local/lib/python3.9/site-packages)

are all those warnings expected?

Hi Francesco,
should be:

python build.py

# this script taked command line arguments, so you can go with:
python build.py --help

# you will get the answer
usage: build.py [-h] [--openmp] [--build_mode BUILD_MODE]

optional arguments:
  -h, --help            show this help message and exit
  --openmp              Enables OpenMP if given
  --build_mode BUILD_MODE
                        Defines build mode: Release or Debug

The above simply means that, --openmp is a boolean type, so when specified then it's true, otherwise is false, regarding --build_mode you need to pass it Release or Debug, which I think is described in help, but could be --build_mode=Release or --build_mode Release, same with debug

Regarding DEPRECATION messages, please don't worry about that, we are PEP517 and PEP518 compatible.

I will create a PR on Monday to fix the docs.

For building the package we use build and the command we use is:

python -m build

@marcinwrobel1986 thanks! Ok we are all good.
Just to verify, to INSTALL it, one ALWYS has to do:

python build.py 
pip install .

Right?

I fixed the docs (I need to fix some bugs with openmp in python, so i omitted that now in docs) .

So we are all good.

@marcinwrobel1986 it seems that if i try:

python build.py --user 

does not work. I get a bunch of proxy errors. The old way (python setup.py install) works however. any idea?

@marcinwrobel1986 it seems that if i try:

python build.py --user 

does not work. I get a bunch of proxy errors. The old way (python setup.py install) works however. any idea?

Hi Francesco,

python build.py --help

if you want help. If you just want to build with OpenMP then:

python build.py --openmp

@marcinwrobel1986 sorry i meant: pip install --user . does not work , i get a bunch of proxy errros

I tried on develop branch, not in virtual env and worked for me:

pip install --user .
Processing /home/marcin/Dokumenty/NGA/projects/pressio-demoapps
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: pressiodemoapps
  Building wheel for pressiodemoapps (pyproject.toml) ... done
  Created wheel for pressiodemoapps: filename=pressiodemoapps-0.1.0rc1-py3-none-any.whl size=273390 sha256=c1d68965abbba689df5464e33f974895508475482d169d17057a0aeaba58350c
  Stored in directory: /home/marcin/.cache/pip/wheels/06/92/45/110174e2547693a3c193e2ecd6d258198fa35c48df2b397535
Successfully built pressiodemoapps
Installing collected packages: pressiodemoapps
Successfully installed pressiodemoapps-0.1.0rc1

BTW this build script is mine script to build library with CMake, it has nothing to do with building or installing Python package.
This is done with:
Just building:

python -m build

Building and installing at once:

pip install .

@marcinwrobel1986
sorry i meant: pip install --user . does not work , i get a bunch of proxy errros

Ok, I noticed one more problem, remember when you wanted me to change the name of the script from cmake_build.py to build.py? This has a conflict now, because then you call python -m build, then the script is ran instead of the build package which is called build :/ I propose to get back to cmake_build.py

ok can you change that please?