Hi Ernst-Georg, maybe you are running into the same issue as I was:
https://github.com/rdkit/rdkit/discussions/6148#discussioncomment-5450102 You have to explicitly tell python where the dlls are: os.add_dll_directory(r"C:\path\to\rdkit\lib") before importing rdkit. >From python documentation: DLL dependencies for extension modules and DLLs loaded with ctypes <https://docs.python.org/3/library/ctypes.html#module-ctypes> on Windows are now resolved more securely. Only the system paths, the directory containing the DLL or PYD file, and directories added with add_dll_directory() <https://docs.python.org/3/library/os.html#os.add_dll_directory> are searched for load-time dependencies. *Specifically, PATH and the current working directory are no longer used, and modifications to these will no longer have any effect on normal DLL resolution*. Best Regards, Joos > > ---------- Forwarded message ---------- > From: pgchem pgchem <pgc...@tuschehund.de> > To: "rdkit-discuss@lists.sourceforge.net" < > rdkit-discuss@lists.sourceforge.net> > Cc: > Bcc: > Date: Wed, 10 May 2023 16:32:31 +0200 (CEST) > Subject: [Rdkit-discuss] Building RDKit on Windows. Only static libraries > produced? How to make the Python wrapper work? > Hello all, > > I'm currently trying to build RDKit 2023_03_1 on Windows 11 with Visual > Studio 2022 Community. The building itself works: > > - No errors during the build > - I get a working extension against PostgreSQL 15.2 > - I get working static libraries for Visual Studio (RDGeneral.lib etc.) > - I get a rdkit package for Python 3.10 > > BUT this does not work: > > from rdkit import Chem > > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > File "C:\RDKit\lib\site-packages\rdkit\__init__.py", line 6, in <module> > from . import rdBase > ImportError: DLL load failed while importing rdBase: The specified module > could not be found. > > I am pretty sure, that the environment is ok, I have checked with the > dependency walker that rdBase.pyd sees everything it needs. > > However, when I take a look at the rdkit package from PyPI, there are a > lot of *.dlls. while my build only produces static libraries (*.lib). > > When I compare the sizes of rdBase.pyd from PyPI and mine, mine is much > larger, so I assume that it also is statically linked - so it should work?, > but it doesn't. > > Any pointers to what I am doing wrong here? > > This is my cmake command: > > c:/cmake/bin/cmake -DRDK_BUILD_PYTHON_WRAPPERS=ON > -DBOOST_ROOT=C:/Devel/RDBuild/boost -DRDK_BUILD_CAIRO_SUPPORT=ON > -DRDK_BUILD_INCHI_SUPPORT=ON -DRDK_BUILD_AVALON_SUPPORT=ON > -DRDK_BUILD_PGSQL=ON -DPostgreSQL_ROOT="C:\PostgreSQL\15" > -DRDK_INSTALL_INTREE=OFF -DCMAKE_INSTALL_PREFIX=c:/RDKit > -DEIGEN3_INCLUDE_DIR=C:/Devel/RDBuild/eigen3 > -DFREETYPE_INCLUDE_DIRS=c:/Devel/RDbuild/freetype/include > -DFREETYPE_LIBRARY="c:/Devel/RDBuild/freetype/release > dll/win64/freetype.lib" -DZLIB_INCLUDE_DIR=c:/Devel/RDBuild/zlib/include > -DZLIB_LIBRARY=c:/Devel/RDBuild/zlib/libz.lib > -DCAIRO_INCLUDE_DIRS=c:/Devel/RDBuild/cairo/include > -DCAIRO_LIBRARIES=c:/Devel/RDBuild/cairo/lib/x64/cairo.lib > -DRDK_BUILD_FREETYPE_SUPPORT=ON -DRDK_BUILD_COMPRESSED_SUPPLIERS=ON > -G"Visual Studio 17 2022" -A x64 .. > > and the MSBuild command: > > & "C:\Program Files\Microsoft Visual > Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe" > /p:Configuration=Release INSTALL.vcxproj > > best regards > > Ernst-Georg > > > > ---------- Forwarded message ---------- > From: Ernst-Georg Schmid <pgc...@tuschehund.de> > To: "rdkit-discuss@lists.sourceforge.net" < > rdkit-discuss@lists.sourceforge.net> > Cc: > Bcc: > Date: Thu, 11 May 2023 14:35:23 +0200 > Subject: Re: [Rdkit-discuss] Building RDKit on Windows. Only static > libraries produced? How to make the Python wrapper work? > Am 10.05.2023 um 16:32 schrieb pgchem pgchem: > > I'm currently trying to build RDKit 2023_03_1 on Windows 11 with Visual > > Studio 2022 Community. The building itself works: > > - No errors during the build > > - I get a working extension against PostgreSQL 15.2 > > - I get working static libraries for Visual Studio (RDGeneral.lib etc.) > > - I get a rdkit package for Python 3.10 > > BUT this does not work: > > from rdkit import Chem > > Traceback (most recent call last): > > File "<stdin>", line 1, in <module> > > File "C:\RDKit\lib\site-packages\rdkit\__init__.py", line 6, in <module> > > from . import rdBase > > ImportError: DLL load failed while importing rdBase: The specified > > module could not be found. > > Hello again, > > I have managed to build the shared objects also by now. I had to carve > this out of the azure pipelines, apparently it only works correctly if > you build like there, i.e. using cmake instead of MSBuild directly. > > E.g. > > C:\CMake\bin\cmake --build . --config=Release --target install > > instead of > > & "C:\Program Files\Microsoft Visual > Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe" > /p:Configuration=Release INSTALL.vcxproj (as the RDKit Book says) > > But the rdkit Python package still throws abovementioned error. I did > the same build on Ubuntu, and everything worked out of the box. I have > also checked various "solutions" from the WWW but to no avail. I cannot > see any unresolved dependencies for rdBase.pyd. Any helpful suggestions > or pointers are appreciated. > > best regards > > Ernst-Georg > > > > > _______________________________________________ > Rdkit-discuss mailing list > Rdkit-discuss@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/rdkit-discuss >
_______________________________________________ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss