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

install_requires on setup.py #143

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

install_requires on setup.py #143

wants to merge 1 commit into from

Conversation

damonge
Copy link
Collaborator

@damonge damonge commented Aug 13, 2021

Closes #138

Copy link
Contributor

@carlosggarcia carlosggarcia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't seem to work. It fails in L.12. There might be a way of reading the setup first. Also, I think you might also need to add setuptools as dependency.

    ERROR: Command errored out with exit status 1:
     command: /home/ardok/.local/share/virtualenvs/prueba-wBi6XUP1/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-cq4656eh/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-cq4656eh/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-c3y58m7h
         cwd: /tmp/pip-req-build-cq4656eh/
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-req-build-cq4656eh/setup.py", line 12, in <module>
        import numpy
    ModuleNotFoundError: No module named 'numpy'
    ----------------------------------------

This is from a new environment created with pipenv.

@damonge
Copy link
Collaborator Author

damonge commented Aug 16, 2021

Seems to be working on github actions. What are you trying to do?
I tried mimicking what's done here: https://github.com/LSSTDESC/TJPCov/blob/a0c23af6c9d9ee462427aca1eb71b94a21db3d42/setup.py#L28

@damonge
Copy link
Collaborator Author

damonge commented Aug 16, 2021

OK, sorry, I see what you mean now. I can't really see a way around this without adding a lot of garbage on setup.py. Could you work around this on TJPCov's CI? E.g. force numpy to get installed before anything else happens. This should be a bare minimum requirement for anyone wanting to use tjpcov or namaster...

@carlosggarcia
Copy link
Contributor

It works in the GitHub actions because you're manually installing the dependencies before installing pymaster, so it is not pip resolving the dependencies. That is not what you want. You want to do pip install -U pymaster in your computer and get pymaster and all the dependencies automatically installed. That's what I did in my laptop with an empty environment.

- name: Install python dependencies
run: |
python -m pip install -U pip
pip install -U numpy
pip install -U scipy
pip install -U healpy
pip install -U flake8
pip install -U pytest
pip install -U pytest-cov
pip install -U coveralls
- name: Flake
run: |
flake8 pymaster --exclude=nmtlib.py
flake8 test --exclude=benchmarks
- name: Build NaMaster
run: |
python setup.py install

@carlosggarcia
Copy link
Contributor

@defjaf
Copy link

defjaf commented Nov 21, 2023

Following the Stack Overflow question pointed to by @carlosggarcia, and also using the information from #173 (comment), I think we can solve this problem by adding pyproject.toml containing the following:

[build-system]
requires = ["setuptools", "numpy"]

On my Mac, adding this file gives a successful install with

CC=gcc-13 LDFLAGS=-L/opt/homebrew/lib CPPFLAGS=-I/opt/homebrew/include pip install .

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

Successfully merging this pull request may close these issues.

setup.py missing install_requires
4 participants