I have created a custom console just as done in the PyScriptingConsole provided with the source code. Everything works fine except there seems to be issues when attempting to load numpy on Python 3.7.4
Yes, I have removed PythonQt::IgnoreSiteModule and yes, I do have the very latest version of numpy installed via pip. It also runs perfectly if I start python from cmd.exe in Windows.
if I input the following in my app though I get:
py>import sys
py>sys.path.clear()
py> sys.path.insert(0,"D:\python37\DLLs")
py> sys.path.insert(0,"D:\python37\Lib\site-packages")
py> import numpy
Traceback (most recent call last):
File "D:\python37\Lib\site-packages\numpy\core__init__.py", line 17, in <module>
from . import multiarray
File "D:\python37\Lib\site-packages\numpy\core\multiarray.py", line 14, in <module>
from . import overrides
File "D:\python37\Lib\site-packages\numpy\core\overrides.py", line 7, in <module>
from numpy.core._multiarray_umath import (
ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'</module></module></module>
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "D:\python37\Lib\site-packages\numpy__init.py", line 142, in <module>
from . import core
File "D:\python37\Lib\site-packages\numpy\core__init</module>.py", line 47, in <module>
raise ImportError(msg)
ImportError: </module></module></string>
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy c-extensions failed.
- Try uninstalling and reinstalling numpy.
- If you have already done that, then:
1. Check that you expected to use Python3.7 from "C:\Users\Praktikanten\source\repos\pythonQtTestRuns\Win32\Debug\pythonQtTestRuns.exe",
and that you have no directories in your PATH or PYTHONPATH that can
interfere with the Python and numpy version "1.16.3" you're trying to use.
2. If (1) looks fine, you can open a new issue at https://github.com/numpy/numpy/issues. Please include details on:
- how you installed Python
- how you installed numpy
- your operating system
- whether or not you have multiple versions of Python installed
- if you built from source, your compiler versions and ideally a build log
If you're working with a numpy git repository, try git clean -xdf
(removes all files not under version control) and rebuild numpy.
Note: this error has many possible causes, so please don't comment on
an existing issue about this - open a new one instead.
Original error was: No module named 'numpy.core._multiarray_umath'
I have also tried it without clearing sys.path and the console spits out the same error.
note that _multiarray_umath.cp37-win32.pyd is contained within my site-packages, maybe there is an issue opening .pyd files in general?
thanks in advance
Last edit: Nick Bowsher 2019-09-04
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have a very similar error when importing numpy. It occures when numpy wants to import numpy.core._muliarray_umath, but exits with "undefined symbol: PyExc_ImportError":
import numpy as np
Traceback (most recent call last):
File "pathToPython37/lib/python3.7/site-packages/numpy/core/init.py", line 17, in <module>
from . import multiarray
File "pathToPython37/lib/python3.7/site-packages/numpy/core/multiarray.py", line 14, in <module>
from . import overrides
File "pathToPython37/lib/python3.7/site-packages/numpy/core/overrides.py", line 7, in <module>
from numpy.core._multiarray_umath import (
ImportError: pathToPython37/lib/python3.7/site-packages/numpy/core/_multiarray_umath.cpython-37m-x86_64-linux-gnu.so: undefined symbol: PyExc_ImportError</module></module></module>
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "pathToPython37/lib/python3.7/site-packages/numpy/init.py", line 142, in <module>
from . import core
File "pathToPython37/lib/python3.7/site-packages/numpy/core/init.py", line 47, in <module>
raise ImportError(msg)
ImportError: </module></module></module></string>
IMPORTANT: PLEASE READ THIS FOR ADVICE ...
...
Original error was: pathToPython37/lib/python3.7/site-packages/numpy/core/_multiarray_umath.cpython-37m-x86_64-linux-gnu.so: undefined symbol: PyExc_ImportError
I intalled python 3.7.4 and numpy 1.17.2 via Miniconda on Debian 10, but I also tried different version of numpy - with no luck. I can import numpy from the console of the OS, but not from within my application.
Alright so I solved my problem. The whole time I was on Debug mode and the external package imports would not work for whatever reason. Even though I correctly linked all debug libs etc.
Luckily I just switched over to release mode and everything is working fine now. It wouldn't be bad to know why it doesn't work in Debug mode though.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If you are in debug mode then you need a debug version of numpy's shared
libraries, which means building a debug version of numpy yourself.
Windows can't mix Debug and Release mode DLLs.
On 13/09/19 9:34 PM, Nick Bowsher wrote:
Alright so I solved my problem. The whole time I was on Debug mode and
the external package imports would not work for whatever reason. Even
though I correctly linked all debug libs etc.
Luckily I just switched over to release mode and everything is working
fine now. It wouldn't be bad to know why it doesn't work in Debug mode
though.
wow. That actually sounds quite tedious considering all the site packages one can use in a project. Does anyone know how to get some precompiled debug module libraries for windows ?(from OSGeo maybe?). And that still does't solve the mystery as to why the standard modules such as os or sys run in debug and release mode. (I don't see any debug libraries for those in my distro yet they work)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
wow. That actually sounds quite tedious considering all the site packages one can use in a project. Does anyone know how to get some precompiled debug module libraries for windows ?(from OSGeo maybe?). And that still does't solve the mystery as to why the standard modules such as os or sys run in debug and release mode. (I don't see any debug libraries for those in my distro yet they work)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Specific DLLs may or may not work with each other, depending on
respective compiler options at build time (Google or see here https://stackoverflow.com/questions/11658915/mixing-debug-and-release-library-binary-bad-practice
for background). DLLs for the standard modules are built as part of
Python (they are the files in Python's lib/lib-dynload directory);
numpy is not part of standard Python, so is built by separately. Did you
build your own Python??
It's only those modules that provide DLLs (pyd extension) that are
impacted -- no problems whatsoever with pure Python modules.
On 14/09/19 8:44 AM, Nick Bowsher wrote:
wow. That actually sounds quite tedious considering all the site
packages one can use in a project. Does anyone know how to get some
precompiled debug module libraries for windows ?(from OSGeo maybe?).
And that still does't solve the mystery as to why the standard modules
such as os or sys run in debug and release mode. (I don't see any
debug libraries for those in my distro yet they work)
C extensions are typically not deployed in debug mode (there are no wheels for them) and building them yourself in debug mode can be difficult or even mostly impossible (scipy for example is really hard to build yourself on Windows).
So you can choose between tryping to get a debug build running (which almost nobody of the Python community uses), or to live with a release build. The VS debugger works on release mode as well, so it may not be such a big limitation. Anyways, it is not a PythonQt issue, but a problem of Python in general.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
First of all thumbs up for this very useful tool!
I have created a custom console just as done in the PyScriptingConsole provided with the source code. Everything works fine except there seems to be issues when attempting to load numpy on Python 3.7.4
Yes, I have removed PythonQt::IgnoreSiteModule and yes, I do have the very latest version of numpy installed via pip. It also runs perfectly if I start python from cmd.exe in Windows.
if I input the following in my app though I get:
py>import sys
py>sys.path.clear()
py> sys.path.insert(0,"D:\python37\DLLs")
py> sys.path.insert(0,"D:\python37\Lib\site-packages")
py> import numpy
Traceback (most recent call last):
File "D:\python37\Lib\site-packages\numpy\core__init__.py", line 17, in <module>
from . import multiarray
File "D:\python37\Lib\site-packages\numpy\core\multiarray.py", line 14, in <module>
from . import overrides
File "D:\python37\Lib\site-packages\numpy\core\overrides.py", line 7, in <module>
from numpy.core._multiarray_umath import (
ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'</module></module></module>
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "D:\python37\Lib\site-packages\numpy__init.py", line 142, in <module>
from . import core
File "D:\python37\Lib\site-packages\numpy\core__init</module>.py", line 47, in <module>
raise ImportError(msg)
ImportError: </module></module></string>
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy c-extensions failed.
- Try uninstalling and reinstalling numpy.
- If you have already done that, then:
1. Check that you expected to use Python3.7 from "C:\Users\Praktikanten\source\repos\pythonQtTestRuns\Win32\Debug\pythonQtTestRuns.exe",
and that you have no directories in your PATH or PYTHONPATH that can
interfere with the Python and numpy version "1.16.3" you're trying to use.
2. If (1) looks fine, you can open a new issue at
https://github.com/numpy/numpy/issues. Please include details on:
- how you installed Python
- how you installed numpy
- your operating system
- whether or not you have multiple versions of Python installed
- if you built from source, your compiler versions and ideally a build log
git clean -xdf
(removes all files not under version control) and rebuild numpy.
Note: this error has many possible causes, so please don't comment on
an existing issue about this - open a new one instead.
Original error was: No module named 'numpy.core._multiarray_umath'
I have also tried it without clearing sys.path and the console spits out the same error.
note that _multiarray_umath.cp37-win32.pyd is contained within my site-packages, maybe there is an issue opening .pyd files in general?
thanks in advance
Last edit: Nick Bowsher 2019-09-04
Can you try to add these paths to the system PATH variable? Might be worth a try.
You can do that in the python console, too:
Hello,
I have a very similar error when importing numpy. It occures when numpy wants to import numpy.core._muliarray_umath, but exits with "undefined symbol: PyExc_ImportError":
import numpy as np
Traceback (most recent call last):
File "pathToPython37/lib/python3.7/site-packages/numpy/core/init.py", line 17, in <module>
from . import multiarray
File "pathToPython37/lib/python3.7/site-packages/numpy/core/multiarray.py", line 14, in <module>
from . import overrides
File "pathToPython37/lib/python3.7/site-packages/numpy/core/overrides.py", line 7, in <module>
from numpy.core._multiarray_umath import (
ImportError: pathToPython37/lib/python3.7/site-packages/numpy/core/_multiarray_umath.cpython-37m-x86_64-linux-gnu.so: undefined symbol: PyExc_ImportError</module></module></module>
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "pathToPython37/lib/python3.7/site-packages/numpy/init.py", line 142, in <module>
from . import core
File "pathToPython37/lib/python3.7/site-packages/numpy/core/init.py", line 47, in <module>
raise ImportError(msg)
ImportError: </module></module></module></string>
IMPORTANT: PLEASE READ THIS FOR ADVICE ...
...
Original error was: pathToPython37/lib/python3.7/site-packages/numpy/core/_multiarray_umath.cpython-37m-x86_64-linux-gnu.so: undefined symbol: PyExc_ImportError
I intalled python 3.7.4 and numpy 1.17.2 via Miniconda on Debian 10, but I also tried different version of numpy - with no luck. I can import numpy from the console of the OS, but not from within my application.
My python.prf:
Does anybody have a solution or hint?
Last edit: Marius Alexander 2019-09-11
Alright so I solved my problem. The whole time I was on Debug mode and the external package imports would not work for whatever reason. Even though I correctly linked all debug libs etc.
Luckily I just switched over to release mode and everything is working fine now. It wouldn't be bad to know why it doesn't work in Debug mode though.
If you are in debug mode then you need a debug version of numpy's shared
libraries, which means building a debug version of numpy yourself.
Windows can't mix Debug and Release mode DLLs.
On 13/09/19 9:34 PM, Nick Bowsher wrote:
wow. That actually sounds quite tedious considering all the site packages one can use in a project. Does anyone know how to get some precompiled debug module libraries for windows ?(from OSGeo maybe?). And that still does't solve the mystery as to why the standard modules such as os or sys run in debug and release mode. (I don't see any debug libraries for those in my distro yet they work)
wow. That actually sounds quite tedious considering all the site packages one can use in a project. Does anyone know how to get some precompiled debug module libraries for windows ?(from OSGeo maybe?). And that still does't solve the mystery as to why the standard modules such as os or sys run in debug and release mode. (I don't see any debug libraries for those in my distro yet they work)
Specific DLLs may or may not work with each other, depending on
respective compiler options at build time (Google or see here
https://stackoverflow.com/questions/11658915/mixing-debug-and-release-library-binary-bad-practice
for background). DLLs for the standard modules are built as part of
Python (they are the files in Python's
lib/lib-dynload
directory);numpy is not part of standard Python, so is built by separately. Did you
build your own Python??
It's only those modules that provide DLLs (
pyd
extension) that areimpacted -- no problems whatsoever with pure Python modules.
On 14/09/19 8:44 AM, Nick Bowsher wrote:
C extensions are typically not deployed in debug mode (there are no wheels for them) and building them yourself in debug mode can be difficult or even mostly impossible (scipy for example is really hard to build yourself on Windows).
So you can choose between tryping to get a debug build running (which almost nobody of the Python community uses), or to live with a release build. The VS debugger works on release mode as well, so it may not be such a big limitation. Anyways, it is not a PythonQt issue, but a problem of Python in general.