8000 Merge pull request #11002 from rgommers/multiarray-import-msg · numpy/numpy@c233a1e · GitHub
[go: up one dir, main page]

Skip to content

Commit c233a1e

Browse files
authored
Merge pull request #11002 from rgommers/multiarray-import-msg
MAINT: add clearer message to assist users with failed builds.
2 parents 4ae5811 + b27a565 commit c233a1e

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

numpy/core/__init__.py

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,35 @@
1515
try:
1616
from . import multiarray
1717
except ImportError as exc:
18+
import sys
1819
msg = """
20+
21+
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
22+
1923
Importing the multiarray numpy extension module failed. Most
2024
likely you are trying to import a failed build of numpy.
21-
If you're working with a numpy git repo, try `git clean -xdf` (removes all
22-
files not under version control). Otherwise reinstall numpy.
25+
Here is how to proceed:
26+
- If you're working with a numpy git repository, try `git clean -xdf`
27+
(removes all files not under version control) and rebuild numpy.
28+
- If you are simply trying to use the numpy version that you have installed:
29+
your installation is broken - please reinstall numpy.
30+
- If you have already reinstalled and that did not fix the problem, then:
31+
1. Check that you are using the Python you expect (you're using %s),
32+
and that you have no directories in your PATH or PYTHONPATH that can
33+
interfere with the Python and numpy versions you're trying to use.
34+
2. If (1) looks fine, you can open a new issue at
35+
https://github.com/numpy/numpy/issues. Please include details on:
36+
- how you installed Python
37+
- how you installed numpy
38+
- your operating system
39+
- whether or not you have multiple versions of Python installed
40+
- if you built from source, your compiler versions and ideally a build log
41+
42+
Note: this error has many possible causes, so please don't comment on
43+
an existing issue about this - open a new one instead.
2344
2445
Original error was: %s
25-
""" % (exc,)
46+
""" % (sys.executable, exc)
2647
raise ImportError(msg)
2748
finally:
2849
for envkey in env_added:

0 commit comments

Comments
 (0)
0