Closed hongyi-zhao closed 2 years ago
Compiling topocm's requirements from source is hard; did you consider conda? That's the recommended way to run the course materials.
Now, after installation of the kwant
dependencies, I've successfully created the python virtualenv used by topocm
, see here for more detailed info. I describe the steps as following:
#https://kwant-project.org/doc/1/pre/install#unix-like-systems-gnu-linux
$ sudo apt-get install python3-dev python3-setuptools python3-scipy python3-matplotlib python3-pytest python3-sympy g++ gfortran libmumps-scotch-dev
#https://kwant-project.org/install#installing-non-python-dependencies
$ sudo apt-get install build-essential gfortran libopenblas-dev liblapack-dev libmumps-scotch-dev
$ pyenv shell 3.9.7
$ pyenv virtualenv --system-site-packages topocm_content
$ pyenv shell topocm_content
$ pip install cython pytest
$ git clone https://github.com/topocm/topocm_content.git topocm_content.git
$ cd topocm_content.git
$ awk '/dependencies:/{a=NR}; {b[NR]=$0} END { for (i=1; i<=NR; i++) if (i>a && b[i] !~ / (python=|pip:)/) {split(b[i],c," "); print c[length(c)]}}' environment.yml | sed -re 's/(=|>|<).*$//;s/matplotlib-base/matplotlib/' | xargs -n1 pip install
If you want to build kwant
from source and build documentation at the same time, please use the following steps described here:
#https://gitlab.kwant-project.org/kwant/kwant/-/issues/413#note_56463
#https://kwant-project.org/doc/1/pre/install#unix-like-systems-gnu-linux
$ sudo apt-get install python3-dev python3-setuptools python3-scipy python3-matplotlib python3-pytest python3-sympy g++ gfortran libmumps-scotch-dev
#https://kwant-project.org/install#installing-non-python-dependencies
$ sudo apt-get install build-essential gfortran libopenblas-dev liblapack-dev libmumps-scotch-dev
$ pyenv shell 3.9.7
$ pyenv virtualenv --system-site-packages kwant
$ pyenv shell kwant
$ pip install cython pytest
$ git clone https://gitlab.kwant-project.org/kwant/kwant.git kwant.git
$ cd kwant.git
#https://kwant-project.org/doc/1/pre/install#building-and-installing-kwant
$ python3 setup.py build
$ python3 setup.py install
#Or replace the above two commands with the following one:
$ pip install -e .
#After installation, tests can be run with:
$ python3 -c 'import kwant; kwant.test()'
#https://kwant-project.org/doc/1/pre/install#building-the-documentation
#As a prerequisite for building the documentation, Kwant must have been built successfully using python3 setup.py build as described above (or Kwant must be already installed in Python’s search path).
$ sudo apt install librsvg2-bin
#https://github.com/missinglinkelectronics/sphinxcontrib-svg2pdfconverter#sphinx-svg-to-pdf-converter-extension
$ pip install sphinxcontrib-svg2pdfconverter[CairoSVG] plotly qsymm
$ make html
$ make latex
#The LaTeX files are in build/latex.
#Run 'make' in that directory to run these through (pdf)latex
#(use `make latexpdf' here to do that automatically).
$ cd build/latex
$ make all-pdf
@hongyi-zhao I'm going to close this issue: installing Kwant via pip is outside the scope of what we aim to support with the course; conda is the recommended option.
On Ubuntu 20.04.3 LTS, I try to create the python virtualenv for this project using pip, but failed to install
kwant
. The errors are shown as follows:See here for the relevant discussion. Any hints for fixing this problem will be highly appreciated.
Regards, HZ