wlav / cppyy

Other
391 stars 40 forks source link

Issue while importing cppyy 2..4.1 under python 3.7 - visual studio 2019 - windows 10 #117

Closed mboker001 closed 1 year ago

mboker001 commented 1 year ago

I am trying to import CPPYY (version 2.4.1) under a python 3.7 environment on windows 10 and visual studio 2019. when i run the command :

import cppyy

i get the following error message. Any idea how to fix the issue Many Thanks

C:\MyPyenv\venv3\lib\site-packages\cppyy_backend\loader.py:139: UserWarning: No precompiled header available (No module named 'cppyy_backend._version'); this may impact performance. warnings.warn('No precompiled header available (%s); this may impact performance.' % msg) input_line_1:1:10: fatal error: 'new' file not found

include

     ^~~~~

Warning in cling::IncrementalParser::CheckABICompatibility(): Failed to extract C++ standard library version. Replaced symbol atexit cannot be found in JIT! Replaced symbol at_quick_exit cannot be found in JIT! Replaced symbol __dllonexit cannot be found in JIT! Replaced symbol _onexit cannot be found in JIT! In file included from input_line_3:1: In file included from C:/MyPyenv/venv3/lib/site-packages/cppyy_backend\include\Rtypes.h:22: In file included from C:/MyPyenv/venv3/lib/site-packages/cppyy_backend\include/RtypesCore.h:23: In file included from C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\ucrt\stddef.h:12: C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\ucrt\corecrt.h:10:10: fatal error: 'vcruntime.h' file not found

include

     ^~~~~~~~~~~~~

Traceback (most recent call last): File "", line 1, in File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.3.3\plugins\python-ce\helpers\pydev_pydev_bundle\pydev_import_hook.py", line 21, in do_import

wlav commented 1 year ago

Do you have MSVC installed and are you running python from an environment with MSVC setup?

mboker001 commented 1 year ago

Hi, thank you for your reply. i have the following full C++ development setup installed :C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133

mboker001 commented 1 year ago

i am running python from a virtual environment. how can i check that MSVC is set up in that environment?

wlav commented 1 year ago

Easiest is probably to check whether the MSVC command line tools are available., eg. cl.exe through the PATH envar.

wlav commented 1 year ago

I do expect that they'd be available b/c otherwise the installation would have failed to begin with (the CPyCppyy package needs to be compiled). Perhaps the problem is that the environment isn't propagated into PyCharm?

mboker001 commented 1 year ago

MSVC is apparently available. Trying now to run Python from visual studio power shell .... looks as if working better... still facing issues with adding required include path for my dll (for additional header files included in the dll .h file).

wlav commented 1 year ago

Closing as presumed resolved.