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

Fixing setup.py (install numpy) #185

Merged
merged 3 commits into from
May 19, 2022
Merged

Conversation

kinow
Copy link
Contributor

@kinow kinow commented May 19, 2022

Hi,

I noticed that in the last release it had a GitHub Action to deploy to PYPI, but looks like that's still not working (related to #170 & #176).

I imported the project into PyCharm, fixed a couple warnings, and then had the same error from GitHub Actions. In GH Actions, the error is as below.

image

Reproduced locally on a fresh virtual environment.

(venv) kinow@ranma:~/Development/python/workspace/wrf-python$ pip install -e .
Obtaining file:///home/kinow/Development/python/workspace/wrf-python
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [7 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/home/kinow/Development/python/workspace/wrf-python/setup.py", line 16, in <module>
          import numpy.distutils.core
      ModuleNotFoundError: No module named 'numpy'
      Says: None
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

The issue is that we were expecting importlib.util.find_spec('numpy') to raise an error, but since 3.4 (was find_module I believe) it returns None when the module is not found.

image

I simply raised the exception when the module returned is None, and that fixed the installation on my environment. Tested that running the installation again doesn't raise the issue.

Cheers,
Bruno

@michaelavs
Copy link
Contributor

Thank you for taking the time to look into this issue! Once CI tests pass I will review your changes and hopefully we will be able to get this merged and ready for a release!

@michaelavs michaelavs self-requested a review May 19, 2022 13:44
@michaelavs michaelavs merged commit 53b283f into NCAR:develop May 19, 2022
@kinow kinow deleted the fixing-setuppy branch May 19, 2022 20:43
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.

None yet

2 participants