Closed gdurif closed 2 years ago
Note: To install using pip from git (using this branch) and specifying the subdirectory:
pip install git+https://github.com/getkeops/keops.git@python_package_subdir#subdirectory=pykeops
Note:
$ python -c "import pykeops"
[KeOps] Warning : Cuda libraries were not detected on the system ; using cpu only mode
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/xxx/.pyenv/lib/python3.8/site-packages/pykeops/__init__.py", line 76, in <module>
import pykeops.common.keops_io
File "/xxx/.pyenv/lib/python3.8/site-packages/pykeops/common/keops_io/__init__.py", line 12, in <module>
import pykeops.common.keops_io.LoadKeOps_cpp
File "/xxx/.pyenv/lib/python3.8/site-packages/pykeops/common/keops_io/LoadKeOps_cpp.py", line 9, in <module>
from keopscore.utils.misc_utils import KeOps_OS_Run
ImportError: cannot import name 'KeOps_OS_Run' from 'keopscore.utils.misc_utils' (/xxx/.pyenv/lib/python3.8/site-packages/keopscore/utils/misc_utils.py)
(Same problem with a cuda environment)
import keopscore
seems to workEdit: origin of the problem found, c.f. #225
Note: pip install git+https://github.com/getkeops/keops.git@python_package_subdir#subdirectory=pykeops
is not working because it installs keopscore==2.0b1
from PyPI which is buggy (c.f. #225 )
Fix: local install of keopscore
before pip git install
$ pip install ./keopscore
Processing ./keopscore
Preparing metadata (setup.py) ... done
Using legacy 'setup.py install' for keopscore, since package 'wheel' is not installed.
Installing collected packages: keopscore
Running setup.py install for keopscore ... done
Successfully installed keopscore-2.0b1
$ pip install git+https://github.com/getkeops/keops.git@python_package_subdir#subdirectory=pykeops
Collecting git+https://github.com/getkeops/keops.git@python_package_subdir#subdirectory=pykeops
Cloning https://github.com/getkeops/keops.git (to revision python_package_subdir) to /tmp/pip-req-build-f9xy05h2
Running command git clone --filter=blob:none --quiet https://github.com/getkeops/keops.git /tmp/pip-req-build-f9xy05h2
Running command git checkout -b python_package_subdir --track origin/python_package_subdir
Switched to a new branch 'python_package_subdir'
Branch 'python_package_subdir' set up to track remote branch 'python_package_subdir' from 'origin'.
Resolved https://github.com/getkeops/keops.git to commit 369dc9286bd90d8730e5ff87f385483bd5162c63
Running command git submodule update --init --recursive -q
Preparing metadata (setup.py) ... done
Requirement already satisfied: keopscore==2.0b1 in ./.pyenv/lib/python3.8/site-packages (from pykeops==2.0b1) (2.0b1)
Collecting numpy
Using cached numpy-1.22.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (16.8 MB)
Collecting pybind11
Using cached pybind11-2.9.1-py2.py3-none-any.whl (211 kB)
Using legacy 'setup.py install' for pykeops, since package 'wheel' is not installed.
Installing collected packages: pybind11, numpy, pykeops
Running setup.py install for pykeops ... done
Successfully installed numpy-1.22.3 pybind11-2.9.1 pykeops-2.0
$ python -c "import pykeops; pykeops.test_numpy_bindings()"
[KeOps] Warning : Cuda libraries were not detected on the system ; using cpu only mode
[KeOps] Generating code for formula Sum_Reduction((Var(0,3,0)-Var(1,3,1))|(Var(0,3,0)-Var(1,3,1)),1) ... OK
[pyKeOps] Compiling pykeops cpp c872f1d359 module ... OK
pyKeOps with numpy bindings is working!
Note:
Remaining TODOs (for other PRs):
pykeops/pykeops/generate_wheel.sh
script and more generally improve wheel/dist buildingkeopscore
and pykeops
(c.f. #226 )@bcharlier @joanglaunes can we merge this?
New repository structure :
TODOs:
pip install
from github^[2] )[1] local
pip install keopscore
orpip install pykeops
works with pip v22.0.4 but not with pip v20.0.2[2]
pip install -e 'git+https://…/repo.git@branch#egg=package&subdirectory=package'