I probably need the .whl version for the janus installation as my PC is operating off-line. I get the following results trying to upgrade to the new version of janus:
py -3.11 -m pip install --no-build-isolation "H:\...\Python packages\janus_swi-1.4.0.tar.gz"
Processing h:\...\python packages\janus_swi-1.4.0.tar.gz
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: janus-swi
Building wheel for janus-swi (pyproject.toml) ... error
error: subprocess-exited-with-error
Ă— Building wheel for janus-swi (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [23 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-cpython-311
creating build\lib.win-amd64-cpython-311\janus_swi
copying janus\janus.py -> build\lib.win-amd64-cpython-311\janus_swi
copying janus\janus_swi.py -> build\lib.win-amd64-cpython-311\janus_swi
copying janus\_find_swipl.py -> build\lib.win-amd64-cpython-311\janus_swi
copying janus\__init__.py -> build\lib.win-amd64-cpython-311\janus_swi
running egg_info
writing janus_swi.egg-info\PKG-INFO
writing dependency_links to janus_swi.egg-info\dependency_links.txt
writing top-level names to janus_swi.egg-info\top_level.txt
reading manifest file 'janus_swi.egg-info\SOURCES.txt'
writing manifest file 'janus_swi.egg-info\SOURCES.txt'
copying janus\hash.c -> build\lib.win-amd64-cpython-311\janus_swi
copying janus\janus.c -> build\lib.win-amd64-cpython-311\janus_swi
copying janus\janus.pl -> build\lib.win-amd64-cpython-311\janus_swi
copying janus\mod_swipl.c -> build\lib.win-amd64-cpython-311\janus_swi
running build_ext
building 'janus_swi._swipl' extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for janus-swi
Failed to build janus-swi
ERROR: Could not build wheels for janus-swi, which is required to install pyproject.toml-based projects
I have exactly the same problem trying to install janus_swi.
I did this successfully some months ago already but now on my new computer I get this same error where it suggests to install Visual C++. I installed Visual Studio 2022 but get again the same error messsage. I am on Windows 11 2H24 with Python 3.13 and Swi-Prolog 9.2.5-1.x64
Sorry for the late reply. I was off-line for a few days.
I would like to have the possibility to call Prolog from Python. My development computer is off-line for security/privacy reasons. I’ve been looking for a solution, but couldn’t find any wheel (.whl) version for this package. Since it’s no longer a high priority I didn’t bump this thread.
In the meantime I fixed it:
I had installed Visual Studio Community 2022 but not the Workload “Desktop Development with C++”. After installing this workload everything worked.
I installed janus_swi successfully with:
I have bumbed the version to 1.5.0 and uploaded both a new source archive and a binary wheel to PyPi. The binary wheel was created using CPython 3.13 and SWI-Prolog 9.3.15, but might run on a wider range of versions.
Also documented building the wheel for Windows. I notably discovered that you must make sure to run the 64-bit developer prompt for VS2022, named x64 Native Tools Command. If you get a lot of errors on undefined PL_* functions, you are probably using the 32 bit setup of VS2022 …
P.s. Is someone aware of a service to automate this? Note that for building you need a WIndows machine using Python, SWI-Prolog and VS2022. Well, possibly you can get away with other tools, i.e., using MinGW and possibly cross-compiling from Linux.
Now it seems cibuildwheel wants to include dependencies into the wheel. I don’t know how we should deal with that. There was a recent discussion providing SWI-Prolog itself as a wheel. Can’t find that right now, but that seems an important relation.
I’ve a problem installing with the wheel file on my Windows 10 PC.
C:.…\Python311>py -3.11 -m pip install --no-build-isolation “H:.…\Python packages\janus_swi-1.5.0-cp313-cp313-win_amd64.whl”
ERROR: janus_swi-1.5.0-cp313-cp313-win_amd64.whl is not a supported wheel on this platform.
Though a year ago it was successfully installed :-
I’m hesitating though to install the new Python release as I’m afraid that I’ll run into the same troubles (re-)installing the Python packages on the off-line PC.