summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--var/spack/repos/builtin/packages/py-numpy/package.py21
1 files changed, 12 insertions, 9 deletions
diff --git a/var/spack/repos/builtin/packages/py-numpy/package.py b/var/spack/repos/builtin/packages/py-numpy/package.py
index 0054dfadbc..e4385985f7 100644
--- a/var/spack/repos/builtin/packages/py-numpy/package.py
+++ b/var/spack/repos/builtin/packages/py-numpy/package.py
@@ -201,15 +201,18 @@ class PyNumpy(PythonPackage):
return args
def setup_environment(self, spack_env, run_env):
- python_version = self.spec['python'].version.up_to(2)
-
- include_path = join_path(
- self.prefix.lib,
- 'python{0}'.format(python_version),
- 'site-packages',
- 'numpy/core/include')
-
- run_env.prepend_path('CPATH', include_path)
+ # If py-numpy is installed as an external package, python won't
+ # be available in the spec. See #9149 for details.
+ if 'python' in self.spec:
+ python_version = self.spec['python'].version.up_to(2)
+
+ include_path = join_path(
+ self.prefix.lib,
+ 'python{0}'.format(python_version),
+ 'site-packages',
+ 'numpy/core/include')
+
+ run_env.prepend_path('CPATH', include_path)
def test(self):
# `setup.py test` is not supported. Use one of the following