dean0x7d / pybinding

Scientific Python package for tight-binding calculations in solid state physics
https://pybinding.site
BSD 2-Clause "Simplified" License
188 stars 69 forks source link

Problem while installing pybinding #61

Open joyphysics opened 3 months ago

joyphysics commented 3 months ago

I am trying to install the package on Windows 11. Even I tried to install it on Ubuntu, I am still getting the same error.

I have -> Python 3.10.11 cmake version 3.30.1 visual studio 2022 17.10.5 and others as well....

pip3 install pybinding
Collecting pybinding
  Using cached pybinding-0.9.5.tar.gz (1.6 MB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: numpy>=1.12 in c:\users\hp\appdata\local\programs\python\python310\lib\site-packages (from pybinding) (2.0.1)
Requirement already satisfied: scipy>=0.19 in c:\users\hp\appdata\local\programs\python\python310\lib\site-packages (from pybinding) (1.14.0)
Requirement already satisfied: matplotlib>=2.0 in c:\users\hp\appdata\local\programs\python\python310\lib\site-packages (from pybinding) (3.9.1)
Requirement already satisfied: pytest>=5.0 in c:\users\hp\appdata\local\programs\python\python310\lib\site-packages (from pybinding) (8.3.2)
Requirement already satisfied: contourpy>=1.0.1 in c:\users\hp\appdata\local\programs\python\python310\lib\site-packages (from matplotlib>=2.0->pybinding) (1.2.1)
Requirement already satisfied: cycler>=0.10 in c:\users\hp\appdata\local\programs\python\python310\lib\site-packages (from matplotlib>=2.0->pybinding) (0.12.1)
Requirement already satisfied: fonttools>=4.22.0 in c:\users\hp\appdata\local\programs\python\python310\lib\site-packages (from matplotlib>=2.0->pybinding) (4.53.1)
Requirement already satisfied: kiwisolver>=1.3.1 in c:\users\hp\appdata\local\programs\python\python310\lib\site-packages (from matplotlib>=2.0->pybinding) (1.4.5)
Requirement already satisfied: packaging>=20.0 in c:\users\hp\appdata\local\programs\python\python310\lib\site-packages (from matplotlib>=2.0->pybinding) (24.1)
Requirement already satisfied: pillow>=8 in c:\users\hp\appdata\local\programs\python\python310\lib\site-packages (from matplotlib>=2.0->pybinding) (10.4.0)
Requirement already satisfied: pyparsing>=2.3.1 in c:\users\hp\appdata\local\programs\python\python310\lib\site-packages (from matplotlib>=2.0->pybinding) (3.1.2)
Requirement already satisfied: python-dateutil>=2.7 in c:\users\hp\appdata\local\programs\python\python310\lib\site-packages (from matplotlib>=2.0->pybinding) (2.9.0.post0)
Requirement already satisfied: iniconfig in c:\users\hp\appdata\local\programs\python\python310\lib\site-packages (from pytest>=5.0->pybinding) (2.0.0)
Requirement already satisfied: pluggy<2,>=1.5 in c:\users\hp\appdata\local\programs\python\python310\lib\site-packages (from pytest>=5.0->pybinding) (1.5.0)
Requirement already satisfied: exceptiongroup>=1.0.0rc8 in c:\users\hp\appdata\local\programs\python\python310\lib\site-packages (from pytest>=5.0->pybinding) (1.2.2)
Requirement already satisfied: tomli>=1 in c:\users\hp\appdata\local\programs\python\python310\lib\site-packages (from pytest>=5.0->pybinding) (2.0.1)
Requirement already satisfied: colorama in c:\users\hp\appdata\local\programs\python\python310\lib\site-packages (from pytest>=5.0->pybinding) (0.4.6)
Requirement already satisfied: six>=1.5 in c:\users\hp\appdata\local\programs\python\python310\lib\site-packages (from python-dateutil>=2.7->matplotlib>=2.0->pybinding) (1.16.0)
Building wheels for collected packages: pybinding
  Building wheel for pybinding (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [876 lines of output]
.
.
.
error continues . . . . 
.
.
.
      subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--config', 'Release', '--', '/v:m', '/m']' returned non-zero exit status 1.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pybinding
  Running setup.py clean for pybinding
Failed to build pybinding
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (pybinding)

Please provide a possible resolution to this issue or provide an alternate way to install the package. Thank you.

BertJorissen commented 3 months ago

use pip install pybinding-devon a new virtual environment (you can create a virtual environment using python3 -m venv newvenv and then use the python or python.exe in newvenv/bin/python or newenv\Scripts\python.exe)

Please also take in mind that the recent matplotlib version does not work with Pybind11 classes, you have to use matplotlib==3.9.0(which is set automatically when you use pip install pybinding-dev).

I only support python 3.9, 3.10, 3.11 and 3.12. This comes with a pre-compiled binary, to get small preformance benefits, you can compile from source (--no-binary) using the new pybinding-dev release.

Please let me know if this works. Best Bert

joyphysics commented 3 months ago

As per your suggestion, I installed pybinding-dev instead of pybinding, which worked well.

However, I actually want to install and use the BerryEasy package, but it appears to have a dependency on pybinding. When I try to install BerryEasy, it fails due to the missing pybinding dependency. Unfortunately, it seems that BerryEasy does not recognize pybinding-dev as a suitable replacement.

Could you please provide guidance on how to proceed with installing and using BerryEasy given that I have pybinding-dev installed? Is there a workaround or a specific way to configure BerryEasy to work with pybinding-dev or install it without pybinding ?

BertJorissen commented 3 months ago

you can first install pybinding with pip install pybinding-dev, and then install the dependencies for BerryEasy, pip isntall tqdm, and then you can install BerryEasy without the check for the dependencies, pip install BerryEasy --no-deps

BertJorissen commented 3 months ago

Also, there is support for the wavefunction and Berry phase in pybinding now, see https://bertjorissen.github.io/pybinding/tutorial/wavefunction.html (work in progress)

joyphysics commented 3 months ago

Thank you. That works perfectly. :)

etjensen commented 4 weeks ago

I had the same issue for a new Anaconda+Spyder install on my M2 Mac. I tried too many things before looking here in the GitHub. Can you please add this suggestion in the main pybinding installation docs.

BertJorissen commented 4 weeks ago

Just install using 'pip install pybinding-dev'. I don't hear from the original developer anymore, and I also don't have access to the main pypi release. It is what it is I guess 😅.

You can find some small changes in the documentation, but mostly the API updates, on bertjorissen.github.io/pybinding .

If you use the above version, please cite the 'Moldovan 2020' release as written in the docs and also the following paper: https://scipost.org/SciPostPhysCore.7.1.004 . Let me know if you have some issues, I'd be happy to patch it for you. The current release under 'pip install pybinding' is impossible to be installed on modern systems, don't even try. Use the 'pybinding-dev' option.

Unfortunately, academia doesn't care that much about maintaining code. I'm doing this for the last few years as volunteering work, but the whole academic system does not care. I'm now at the end of my own research project. If they are not going to find a solution for the problems with pybinding, it will die in a few years due to broken dependencies.