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

Fix #22: Remove numpy dependency on info setup.py commands. #23

Closed
wants to merge 2 commits into from
Closed

Fix #22: Remove numpy dependency on info setup.py commands. #23

wants to merge 2 commits into from

Conversation

jason-neal
Copy link
Contributor

This checks what setup command is passed. If it is one of the info commands, (e.g. "egg_info") then numpy is not required and so is not imported for dependency determination .
Allows dependency determination without numpy, thus resolving #22, allowing pip to install PyAstronomy and numpy at the same time.

Inspired by the setup.py file for scipy.

I have only tested it locally using a fresh conda enviroment (without numpy installed).

Running pip install -e . fails.

$ pip install -e . --no-cache              
Obtaining file:///home/jneal/Phd/Codes/Repos/PyAstronomy
Installing collected packages: PyAstronomy
  Running setup.py develop for PyAstronomy
    Complete output from command /home/jneal/miniconda3/envs/test_pyast/bin/python -c "import setuptools, tokenize;__file__='/home/jneal/Phd/Codes/Repos/PyAstronomy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" develop --no-deps:
    Please install 'numpy' first.
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/home/jneal/Phd/Codes/Repos/PyAstronomy/setup.py", line 177, in <module>
        class WithExtCommand(Command):
    NameError: name 'Command' is not defined
    
    ----------------------------------------
Command "/home/jneal/miniconda3/envs/test_pyast/bin/python -c "import setuptools, tokenize;__file__='/home/jneal/Phd/Codes/Repos/PyAstronomy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" develop --no-deps" failed with error code 1 in /home/jneal/Phd/Codes/Repos/PyAstronomy/

but with this PR pip install -e . numpy --no-cache works.

$ pip install -e . numpy --no-cache
Obtaining file:///home/jneal/Phd/Codes/Repos/PyAstronomy
Collecting numpy
  Downloading numpy-1.12.1-cp34-cp34m-manylinux1_x86_64.whl (16.8MB)
    100% |████████████████████████████████| 16.8MB 906kB/s 
Installing collected packages: numpy, PyAstronomy
  Running setup.py develop for PyAstronomy
Successfully installed PyAstronomy numpy-1.12.1

When this is pushed to pypi this should allow PyAstronomy to be placed alongside numpy in a requirements.txt and be installed on fresh environments.

Allows dependency determination (egg_info command) without numpy.
@sczesla
Copy link
Owner

sczesla commented Apr 26, 2017

Hi,
Thanks for pointing out and suggesting a fix! Merging the PR in its current form, setup.py stops working for me altogether. Yet, I think the approach is right. I will have a closer look asap.
Cheers, Stefan

@sczesla
Copy link
Owner

sczesla commented May 29, 2017

Solved in 0.11.0.

@sczesla sczesla closed this May 29, 2017
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.

2 participants