Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with Cython and numpy dependency #40

Open
mchalela opened this issue Mar 11, 2021 · 2 comments
Open

Error with Cython and numpy dependency #40

mchalela opened this issue Mar 11, 2021 · 2 comments

Comments

@mchalela
Copy link

Hello! I'm trying to install pmesh via pip install pmesh but I keep getting an error with cython.
It seems that you first need to have cython installed to be able to run line 46 of the setup, and also numpy to run line 3.
Is there a way to avoid using cython and numpy in the setup stage? I'm developing a package that will probably use pmesh as a dependency so numpy and cython won't be previously installed.
Thank you!!

import numpy

pmesh/setup.py

Lines 46 to 59 in 5c3a226

from Cython.Build import cythonize
extensions = cythonize(extensions)
setup(
name="pmesh", version=find_version("pmesh/version.py"),
author="Yu Feng",
description="Particle Mesh in Python",
package_dir = {'pmesh': 'pmesh'},
packages= ['pmesh', 'pmesh.tests'],
install_requires=['cython', 'numpy', 'mpi4py', 'mpsort', 'pfft-python'],
license='GPL3',
ext_modules = extensions,
extras_require={'full':['abopt'], 'abopt':['abopt']}
)

@mortele
Copy link

mortele commented Apr 9, 2021

@mchalela You can add a pyproject.toml file with [build-system] requires specifying dependencies which need to be present before setup.py is run, cf. PEP 518. Using this you can ensure numpy and cython is installed before any other dependencies, thus fixing the problem. Note that this only handles the install dependencies when using pip, running python3 setup.py install will still fail.

Alternatively, open a pull request doing exactly this in pmesh and fix the problem further upstream, so to say.

@rainwoodman
Copy link
Owner

A PR with a toml file is highly welcome. It sounds like we do need to tag a new release on pypi to make the file effective?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants