joselado / dmrgpy

DMRGPy is a Python library to compute quasi-one-dimensional spin chains and fermionic systems using matrix product states with DMRG as implemented in ITensor. Most of the computations can be performed both with DMRG and exact diagonalization for small systems, which allows one to benchmark the results.
GNU General Public License v3.0
88 stars 20 forks source link

Add template pyproject.toml #25

Closed migueltorrescosta closed 7 months ago

migueltorrescosta commented 7 months ago

Problem

We are not able to install this remote github repo with a single command. This consumes human time for researchers who could be running a single command, rather than clonning the repo, setup their own environment and running custom shell scripts to get started.

❯ pip install git+https://github.com/joselado/dmrgpy.git@master
Defaulting to user installation because normal site-packages is not writeable
Collecting git+https://github.com/joselado/dmrgpy.git@master
  Cloning https://github.com/joselado/dmrgpy.git (to revision master) to /tmp/pip-req-build-iov_x8sl
  Running command git clone --filter=blob:none --quiet https://github.com/joselado/dmrgpy.git /tmp/pip-req-build-iov_x8sl
  Resolved https://github.com/joselado/dmrgpy.git to commit 5540b739376d546f387381f171c1d9d877eac3be
ERROR: git+https://github.com/joselado/dmrgpy.git@master does not appear to be a Python project: neither 'setup.py' nor 'pyproject.toml' found.

Solution

Add a pyproject.toml file with the required dependencies: numpy scipy numba statsmodels statistics matplotlib

Testing

I have ran the command with the created fork:

❯ pip install git+https://github.com/migueltorrescosta/dmrgpy.git@add_pyproject
Collecting git+https://github.com/migueltorrescosta/dmrgpy.git@add_pyproject
  Cloning https://github.com/migueltorrescosta/dmrgpy.git (to revision add_pyproject) to /tmp/pip-req-build-qrx2gtmd
  Running command git clone --filter=blob:none --quiet https://github.com/migueltorrescosta/dmrgpy.git /tmp/pip-req-build-qrx2gtmd
  Running command git checkout -b add_pyproject --track origin/add_pyproject
  Switched to a new branch 'add_pyproject'
  Branch 'add_pyproject' set up to track remote branch 'add_pyproject' from 'origin'.
  Resolved https://github.com/migueltorrescosta/dmrgpy.git to commit 70258aa51a8b0bc85c0b419f76b33eaee125a6f1
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: dmrgpy
  Building wheel for dmrgpy (pyproject.toml) ... done
  Created wheel for dmrgpy: filename=dmrgpy-0.1.0-py3-none-any.whl size=1112315 sha256=af8d48c080746473a957b5de5d093bcc2a5a20ac1829fc624bf0145462b82dd0
  Stored in directory: /tmp/pip-ephem-wheel-cache-gkrjq3t4/wheels/58/0f/75/e8107a72c6cdf92b25679424df2b1bf87aa4a12587b1fc55d2
Successfully built dmrgpy
Installing collected packages: dmrgpy
Successfully installed dmrgpy-0.1.0

:warning: This install procedure assumes that the C++ compiler is already setup. This can be added as a build.py file, as described in this StackOverflow answer.

joselado commented 7 months ago

Dear migueltorrescosta,

thank you for the note. Indeed it would be great to sharpen the installation in case there were some missing libraries. I'll think about what is the best way of implementing this. In the meantime, it can be great that you make a clone of the repository on your side so that interested researchers can use your version.

Best regards, Jose

migueltorrescosta commented 7 months ago

Thank you for the original code @joselado :raised_hands: For anyone looking for this functionality, I have a working clone on https://github.com/migueltorrescosta/dmrgpy/tree/add_pyproject, and it can be installed via

pip install git+https://github.com/migueltorrescosta/dmrgpy.git@add_pyproject

Updates from @joselado do not automatically propagate to my fork of the code.